User:5tu: Difference between revisions
Line 43: | Line 43: | ||
| [http://https://breadwallet.com/ BreadWallet (iOS)] || <span style="color:green">Yes</span> || <span style="color:red">No</span> || <span style="color:orange">Unknown</span> || ? | | [http://https://breadwallet.com/ BreadWallet (iOS)] || <span style="color:green">Yes</span> || <span style="color:red">No</span> || <span style="color:orange">Unknown</span> || ? | ||
|- | |- | ||
| CoPay/Bitpay (iOS) || <span style="color: | | CoPay/Bitpay (iOS) || <span style="color:green">Yes</span> || <span style="color:red">No</span> || <span style="color:orange">Unknown</span> || ? | ||
|- | |- | ||
| Electrum || <span style="color:red">No</span> || <span style="color:green">Yes</span> || <span style="color:orange">Unknown</span> || ? | | Electrum || <span style="color:red">No</span> || <span style="color:green">Yes</span> || <span style="color:orange">Unknown</span> || ? |
Revision as of 10:26, 2 December 2016
THIS IS WORK IN PROGRESS AND NOT ACCURATE YET
Purpose
When submitting a transaction from your wallet to the bitcoin network you broadcast a transaction to one of the thousands of bitcoin nodes making up the network.
If the transaction is considered valid by this node, the transaction is next put in the nodes waiting area (mempool) and is shared to this node's neighbours where they now check if they believe it is valid and forward it on to their neighbours and so on to propagating your transaction around the bitcoin network until everyone has seen it.
Eventually when a miner finds a solution to the next block they would have included your transaction in that block so becomes part of the blockchain. Once this happens the transaction is eventually removed from the mempool waiting area. The other nodes will now see this new valid block and remove the transaction from their mempool.
A common problem that happens in a transaction is the fee paid is too low based on the network demand. This can lead to transactions being stuck for hours or even days. Keep in mind that if you have a source transaction of say 0.5btc and sent only 0.1btc somewhere, the 0.4btc change (less fee) is also being sent in the transaction so your full 0.5btc is tied up until the transaction is confirmed or discarded.
Transactions are typically only discarded from mempool when the machine is restarted or times out. Also when a machine is restarted it syncs with it's neighbours again meaning even a restart may not clear it. The timeout is very subjective and is typically days with many wallets not handling this very elegantly.
Unsticking a transaction
To cancel the transaction there are a few approaches
- Child pays for parent (CPFP). - This approach is to construct another follow on transaction that pays a larger fee which covers the required fee for both the current and previous transaction. This is typically the best approach if possible since it doesn't invalidate your original transaction.
- Double spend (RBF) - This approach is to simply spend the same money again but this time apply a larger fee. Most nodes will ignore double spend requests unless the RBF (Replace By Fee) option was originally set in the transaction. To know if this is possible you need to know if your wallet constructs transactions with this RBF flag. (Most don't as of writing this)
https://github.com/petertodd/replace-by-fee-tools
- Time out - This approach is to simply wait it out until the transaction is eventually removed from mempools of the network.
Wallet support
TODO
Wallet | CPFP | RBF | Export Private Key | Dynamic Fees |
---|---|---|---|---|
Armoury | No | Yes | Unknown | ? |
Bitcoin Wallet(Android) | Yes | No | Unknown | ? |
Bitcoind GUI | No | Coming Soon | Unknown | ? |
BreadWallet (iOS) | Yes | No | Unknown | ? |
CoPay/Bitpay (iOS) | Yes | No | Unknown | ? |
Electrum | No | Yes | Unknown | ? |
GreenAddress | No | No | Unknown | ? |
Jaxx (iOS) | No | No | Unknown | ? |
Multibit | No | No | Unknown | ? |
MyCelium | No | No | Unknown | ? |
Trezor | No | No | Unknown | ? |
Walkthrough manually unsticking a transaction
(TODO) If you know the private keys of the original transaction you can manually construct a transaction using coinb.in or on the bitcoin-cli commandline.
Publish New Transaction Manually
Bitcoin-cli
You can use "createrawtransaction" to manually add inputs and mark the "nsequence" field to a value less than 0xffffffff. If you would like to replace the first transaction created this way. You will have to dump the transaction to free the UTXOs for use again using the "abandontransaction" command.
Once you've dumped the first transaction. You should be able to repeat the process above then increment the "nsequence" field. This new transaction when broadcasted should then be accepted by any node that supports full RBF.
CPFP General
This is the general principle of CPFP, and it may not be entirely correct.
Step 1: Find the txid of your unconfirmed transaction Step 2: Calculate the fee for the unconfirmed transaction with a fee of 0.0001 BTC/Kb Step 3: Create a transaction that spends the unconfirmed transaction to another Bitcoin address. Include in its fee the recommended fee and the fee you calculated in step 2. (e.g. fee of 0.0001 BTC for both transactions means 0.0002 BTC fee in this new one) Step 4: Sign the new transaction. Step 5: Push the transaction to the network. It is recommended to use http://eligius.st/~wizkid057/newstats/pushtxn.php because the mining pool Eligius is one of the only pools to implement CPFP. This will push straight to them and the rest of the network. Step 6: Wait for someone, probably Eligius, to mine a block and include both of your transactions. This could take a couple hours since Eligius has a small percentage of the hashrate of the network.
CPFP Using BreadWallet
BreadWallet allows for CPFP via a tap of the button. If you have a compatible HD wallet (e.g. Multibit Standard, Hive), you can install BreadWallet and type your master seed in there to use their functionality. Compatibility Excel Chart
CPFP Electrum
- In the "Addresses" tab click the arrow next to "Change" to show your change addresses.
- Find the Address in your change addresses which contains the change from your MOST RECENT UNCONFIRMED TRANSACTION. (Find this by right clicking the transaction and checking the details window and look at the addresses and amounts of BTC at the bottom window to find your change address)
- Right click the change address in your "Addresses" tab, and click "Send From." This will take you to the send tab.
- Set the Fee box to y that we calculated. The unit is BTC.
- Send the remainder of the bitcoins in that address to another address of yours.
- Click Button to sign and check transaction. (There should be no error, as it is not being sent)
- On the check transaction window, Click save. Then save the file somewhere.
- Open the file, and find the looooong string of hex characters between quotes.
- Copy the string (like 01000000bef39df829...00000000)
- Paste it into http://eligius.st/~wizkid057/newstats/pushtxn.php but wait on clicking the button.
- Click "Broadcast" on the Electrum transaction checking window.
- Wait about 20 seconds. (or if an error message pops up in Electrum, just go straight to the next step)
- Click "OK" on the website to push the transaction.
You may need to use the console If you want to use CPFP, you need to use Electrum console commands, specifically createrawtx