A demo without 🚀 science, just simple UTXO spending logic.

Overview

Stuck TX Demo

Docker container that runs 4 dogecoind to demonstrate "the stuck tx problem".

Scenario

  1. A wallet sends out 3 transactions to a recipient of resp 51k, 52k and 53k DOGE.
  2. All transactions get stuck because there is no miner that is accepting the fee
  3. The first transaction (tx0) gets replaced by respending its inputs
  4. The second transaction (tx1) gets replaced without respending inputs
  5. The third transaction (tx2) is forgotten
  6. When the wallet (or an attacker!!!) sends the original tx1 again, the recipient gets the amount twice

Usage

You need an x86 linux pc or vm with docker and git installed.

git clone https://github.com/patricklodder/wallet-stucktx-demo.git
cd wallet-stucktx-demo
docker build -t wallet-stucktx-demo:latest .
docker run wallet-stucktx-demo:latest

Example output

[00] Setup...  (T=T-2h)
  wallet: sends   txs with 0.10000000 DOGE/kb fee
  relay1: accepts txs with 1.00000000 DOGE/kb fee
  relay2: accepts txs with 0.00100000 DOGE/kb fee
   miner: accepts txs with 1.00000000 DOGE/kb fee

[01] Mining blocks and seeding wallet...  (T=T-2h)
  our wallet has 5 inputs with a total balance of 500000.00000000 DOGE

[02] Sending 3 too low fee transactions... (T-2h)
  tx0: 041166db29f2b683d6d93e80c89f1c21d6ed1784cca1affb1237f80ac35389d7 sending 51000 to n4LRQGEKcyRCXqD2MH3ompyMTJKitxu1WP
  tx1: 2e81e9aeefeb6ca1e0c242bcb29e447ee70e5ae5e106e476d754ea7bb09b1d68 sending 52000 to n4LRQGEKcyRCXqD2MH3ompyMTJKitxu1WP
  tx2: 1a0a798316436d96a5e0ef9fdc5ee563b38da973a7a589730ef7af9f01424acc sending 53000 to n4LRQGEKcyRCXqD2MH3ompyMTJKitxu1WP
  our wallet node has 3 mempool entries
  our wallet has 2 inputs with a total balance of 343999.93220000 DOGE

[03] Syncing mempools... (T=T-2h)
  wallet has 041166db29f2b683d6d93e80c89f1c21d6ed1784cca1affb1237f80ac35389d7 in mempool
  wallet has 2e81e9aeefeb6ca1e0c242bcb29e447ee70e5ae5e106e476d754ea7bb09b1d68 in mempool
  wallet has 1a0a798316436d96a5e0ef9fdc5ee563b38da973a7a589730ef7af9f01424acc in mempool
  relay2 has 041166db29f2b683d6d93e80c89f1c21d6ed1784cca1affb1237f80ac35389d7 in mempool
  relay2 has 2e81e9aeefeb6ca1e0c242bcb29e447ee70e5ae5e106e476d754ea7bb09b1d68 in mempool
  relay2 has 1a0a798316436d96a5e0ef9fdc5ee563b38da973a7a589730ef7af9f01424acc in mempool
  relay1 does not have 041166db29f2b683d6d93e80c89f1c21d6ed1784cca1affb1237f80ac35389d7 in mempool
  relay1 does not have 2e81e9aeefeb6ca1e0c242bcb29e447ee70e5ae5e106e476d754ea7bb09b1d68 in mempool
  relay1 does not have 1a0a798316436d96a5e0ef9fdc5ee563b38da973a7a589730ef7af9f01424acc in mempool
   miner does not have 041166db29f2b683d6d93e80c89f1c21d6ed1784cca1affb1237f80ac35389d7 in mempool
   miner does not have 2e81e9aeefeb6ca1e0c242bcb29e447ee70e5ae5e106e476d754ea7bb09b1d68 in mempool
   miner does not have 1a0a798316436d96a5e0ef9fdc5ee563b38da973a7a589730ef7af9f01424acc in mempool

[04] Mining a block... (T=T-2h)
  wallet still has 041166db29f2b683d6d93e80c89f1c21d6ed1784cca1affb1237f80ac35389d7 in mempool
  wallet still has 2e81e9aeefeb6ca1e0c242bcb29e447ee70e5ae5e106e476d754ea7bb09b1d68 in mempool
  wallet still has 1a0a798316436d96a5e0ef9fdc5ee563b38da973a7a589730ef7af9f01424acc in mempool
  relay2 still has 041166db29f2b683d6d93e80c89f1c21d6ed1784cca1affb1237f80ac35389d7 in mempool
  relay2 still has 2e81e9aeefeb6ca1e0c242bcb29e447ee70e5ae5e106e476d754ea7bb09b1d68 in mempool
  relay2 still has 1a0a798316436d96a5e0ef9fdc5ee563b38da973a7a589730ef7af9f01424acc in mempool
  our wallet has 2 inputs with a total balance of 343999.93220000 DOGE

==============================================

[05] Timewarp back to the future, mempools expire... (T=T+0)
  wallet has 0 transactions in mempool
  relay1 has 0 transactions in mempool
  relay2 has 0 transactions in mempool
   miner has 0 transactions in mempool

[06] Our wallet seems confused now... (T=T+0)
  our wallet has 2 inputs with a total balance of 200000.00000000 DOGE
  very concern!

[07] But the wallet still remembers these transactions... (T=T+0)
  wallet remembers tx 041166db29f2b683d6d93e80c89f1c21d6ed1784cca1affb1237f80ac35389d7 for -51000.00000000
  wallet remembers tx 2e81e9aeefeb6ca1e0c242bcb29e447ee70e5ae5e106e476d754ea7bb09b1d68 for -52000.00000000
  wallet remembers tx 1a0a798316436d96a5e0ef9fdc5ee563b38da973a7a589730ef7af9f01424acc for -53000.00000000

[08] Replace tx0 for 51000 correctly... (T=T+0)
  copy inputs:
    aeaef799f34676b2de572d6de105485147263df68490cfe9232595a3a60f47b6 / 1
  copy outputs:
    mtPvDHF7AqorQiZzrAjnYT4Q1U8eJnKk1K: 48999.97740000
    n4LRQGEKcyRCXqD2MH3ompyMTJKitxu1WP: 51000.00000000
  change fee to 1 DOGE by changing the change output:
    mtPvDHF7AqorQiZzrAjnYT4Q1U8eJnKk1K: 48999.00000000
  create, sign and push new tx:
    wallet sent d7703393f53fce77f859e6ed3b7a8a96eaa3749d372ddce8500be85dadbf1528

[09] The replacement tx0 gets accepted everywhere... (T=T+0)
  wallet has d7703393f53fce77f859e6ed3b7a8a96eaa3749d372ddce8500be85dadbf1528 in mempool
  relay1 has d7703393f53fce77f859e6ed3b7a8a96eaa3749d372ddce8500be85dadbf1528 in mempool
  relay2 has d7703393f53fce77f859e6ed3b7a8a96eaa3749d372ddce8500be85dadbf1528 in mempool
   miner has d7703393f53fce77f859e6ed3b7a8a96eaa3749d372ddce8500be85dadbf1528 in mempool
  and gets mined...
  our wallet has 3 inputs with a total balance of 248999.00000000 DOGE
  that takes care of tx1! wow

[10] We do an oopsie and we accidentally: (T=T+0)
     send out a new tx1 without replacing the original inputs, and
     completely forget about tx2
  wallet has 31cf7f93fcf22ec5d83846c9bec8409d38a491faccd019844e1a5ad6bdf1ca50 in mempool
  relay1 has 31cf7f93fcf22ec5d83846c9bec8409d38a491faccd019844e1a5ad6bdf1ca50 in mempool
  relay2 has 31cf7f93fcf22ec5d83846c9bec8409d38a491faccd019844e1a5ad6bdf1ca50 in mempool
   miner has 31cf7f93fcf22ec5d83846c9bec8409d38a491faccd019844e1a5ad6bdf1ca50 in mempool
  it gets mined...
  our wallet has 3 inputs with a total balance of 196998.00000000 DOGE
  such confuse!!!

==============================================

[11] The miner updates... (T=T+0)
  wallet: sends   txs with 0.10000000 DOGE/kb fee
  relay1: accepts txs with 1.00000000 DOGE/kb fee
  relay2: accepts txs with 0.00100000 DOGE/kb fee
   miner: accepts txs with 0.00100000 DOGE/kb fee

[12] Our wallet sends out cached transactions... (T=T+0)
  wallet has 2e81e9aeefeb6ca1e0c242bcb29e447ee70e5ae5e106e476d754ea7bb09b1d68 in mempool
  wallet has 1a0a798316436d96a5e0ef9fdc5ee563b38da973a7a589730ef7af9f01424acc in mempool
   miner has 2e81e9aeefeb6ca1e0c242bcb29e447ee70e5ae5e106e476d754ea7bb09b1d68 in mempool
   miner has 1a0a798316436d96a5e0ef9fdc5ee563b38da973a7a589730ef7af9f01424acc in mempool

[13] The cached transactions get mined... (T=T+0)
  our wallet has 5 inputs with a total balance of 291997.95480000 DOGE

  (negative confirmations indicate a replaced transaction)
  041166db29f2b683d6d93e80c89f1c21d6ed1784cca1affb1237f80ac35389d7 for -51000.00000000 has -4 conf
  2e81e9aeefeb6ca1e0c242bcb29e447ee70e5ae5e106e476d754ea7bb09b1d68 for -52000.00000000 has 1 conf
  1a0a798316436d96a5e0ef9fdc5ee563b38da973a7a589730ef7af9f01424acc for -53000.00000000 has 1 conf
  d7703393f53fce77f859e6ed3b7a8a96eaa3749d372ddce8500be85dadbf1528 for -51000.00000000 has 4 conf
  31cf7f93fcf22ec5d83846c9bec8409d38a491faccd019844e1a5ad6bdf1ca50 for -52000.00000000 has 3 conf

HOUSTON, WE HAVE A PROBLEM!
    let's make it n4LRQGEKcyRCXqD2MH3ompyMTJKitxu1WP's problem!
    Dear n4LRQGEKcyRCXqD2MH3ompyMTJKitxu1WP, you owe us 52,000 DOGE. Plz send.

=====THE END=====

Owner
Patrick Lodder
Patrick Lodder
Python wrapper for the GitLab API

Python GitLab python-gitlab is a Python package providing access to the GitLab server API. It supports the v4 API of GitLab, and provides a CLI tool (

1.9k Dec 31, 2022
Smilecreator4 - This site is for people who want to hack or want to learn it!

smilecreator4 This site is for people who want to hack or want to learn it! Furthermore, this program does not work without turning off Antivirus or W

1 Jan 04, 2022
It's My Bot, For my group in telegram :)

Get Start USage This robot is written in Python language for devdood Group in Telegram ... You can easily edit and use this source Edit and Run You ne

Mohsen farzadmanesh 7 Sep 24, 2022
Assassination API for getting random quotes from Assassination Classroom.

Assassination API Take advantage of what you have, while you have it. Quotes from Assassination Classroom Assassination classroom is one of best anime

Swanand Mulay 3 Jul 15, 2022
BaiduPCS API & App 百度网盘客户端

BaiduPCS-Py A BaiduPCS API and An App BaiduPCS-Py 是百度网盘 pcs 的非官方 api 和一个命令行运用程序。

Peter Ding 450 Jan 05, 2023
Python 3 SDK/Wrapper for Huobi Crypto Exchange Api

This packages intents to be an idiomatic PythonApi wrapper for https://www.huobi.com/ Huobi Api Doc: https://huobiapi.github.io/docs Showcase TODO Con

3 Jul 28, 2022
Python SDK for Facebook's Graph API

Facebook Python SDK This client library is designed to support the Facebook Graph API and the official Facebook JavaScript SDK, which is the canonical

Mobolic 2.7k Jan 07, 2023
A tool that helps keeping track of your AWS quota utilization

aws-quota-checker A tool that helps keeping track of your AWS quota utilization. It'll determine the limits of your AWS account and compare them to th

Max 63 Dec 14, 2022
Código python para automatizar a junção de arquivos CSV's e salva-los em uma pasta final de destino.

merge_csv Código python para automatizar a junção de arquivos CSV's e salva-los em uma pasta final de destino. Esse projeto é usado pra unir alguns ar

Welder Fariles 1 Jan 12, 2022
Local community telegram bot

Бот на районе Телеграм-бот для поиска адресов и заведений в вашем районе города или в небольшом городке. Требует недели прогулок по району д

Ilya Zverev 32 Jan 19, 2022
A python discord client interaction emulator for the DC29 badge code channel

dc29-discord-signalbot A python discord client interaction emulator for the DC29 badge code channel Prep Open Developer mode Open the developer mode f

8 Aug 23, 2021
CoWIN Vaccination slot booking telegram bot with auto captcha resolver & alerting feature.Now, never miss a slot.

COWIN VACCINATION SLOT AUTO BOOKING (Bot with captcha solving & alerting capabilities. Never miss the vaccine slot.) June-10-2021/ 0030 hrs: 23 succes

Shashank Bafna 17 Nov 12, 2022
Discord bot that displays the current Swatch Internet Time (.beat) as a status.

Internet-Time-Display Discord bot that displays the current Swatch Internet Time (.beat) as a status. Visit the website! Add the bot to your server! A

2 Mar 15, 2022
Wechat based auto reply with pyautogui

Python-微信 自动回复 练手~ 一直想做个给微信发个消息,就可以跑Python程序,并将结果发送给我的东西,之前看了 B站@不高兴就喝水 的视频,终于有了灵感~ 使用的是模拟点击方案,请求期间是不能操作了。 库 pyautogui 用于模拟鼠标键盘操作和定位操作位置 pyperclip 剪贴板

Vito Song 1 Oct 22, 2022
Python Library for Secp256k1 Bitcoin curve to do fast ECC calculation

secp256k1 Python Library for Secp256k1 Bitcoin curve to do fast ECC calculation Example Usage import secp256k1 as ice print('[C]',privatekey_to_addres

iceland 49 Jan 01, 2023
Modified Version of mega.py package for Pyrogram Bots

Pyro Mega.py Python library for the Mega.co.nz API, currently supporting: login uploading downloading deleting searching sharing renaming moving files

I'm Not A Bot #Left_TG 10 Aug 03, 2022
An iCal file to transport you to a new place every day until you die

everydayvirtualvacation An iCal file to transport you to a new place every day until you die The library is closed 😔 😔 including a video of the plac

Jacob Chapman 33 Apr 19, 2022
Telegram vc userbot

Telegram Vc Userbot Available Commands /ping :- To check whether userbot is up or not /joinvc :- To join vc /leavevc :- To leave vc /join_group :- To

NandyDark 7 Nov 18, 2022
Ice-Userbot adalah userbot Telegram modular yang berjalan di Python3 dengan database sqlalchemy

Ice-Userbot Telegram Ice-Userbot adalah userbot Telegram modular yang berjalan di Python3 dengan database sqlalchemy. Berbasis Paperplane dan ProjectB

6 Apr 29, 2022
PlexAutoSkip - Automatically skip content in Plex

PlexAutoSkip Automatically skip tagged content in Plex A background python scrip

Michael Higgins 97 Dec 21, 2022