Skip to content

Commit b44cca0

Browse files
committed
final edit, v3.0, chapter 6
1 parent c218623 commit b44cca0

4 files changed

Lines changed: 221 additions & 52 deletions

‎docs/06_0_Controlling_Bitcoin_Transactions.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Chapter Six: Controlling Bitcoin Transactions
22

3-
Sending a transaction isn't always the end of the story. Using the RBF (replace-by-fee) and CPFP (child-pays-for-parent) protocols, a developer can continue to control the transaction after it's been sent, to improve efficiency or to recover transactions that get stuck. These methods will begin to spotlight the true power of Bitcoin.
3+
Sending a transaction isn't always the end of the story. Using the RBF
4+
(replace-by-fee) and CPFP (child-pays-for-parent) protocols, a
5+
developer can continue to control the transaction after it's been
6+
sent, to improve efficiency or to recover transactions that get
7+
stuck. These methods will begin to spotlight the true power of
8+
Bitcoin.
49

510
## Objectives for This Section
611

‎docs/06_1_Watching_for_Stuck_Transactions.md‎

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
# 6.1: Watching for Stuck Transactions
22

3-
Sometimes a Bitcoin transaction can get stuck. Usually it's because there wasn't sufficient transaction fee, but it can also be because of a one-time network or software glitch.
3+
Sometimes a Bitcoin transaction can get stuck. Usually it's because
4+
there wasn't sufficient transaction fee, but it can also be because of
5+
a one-time network or software glitch.
46

57
## Watch Your Transactions
68

7-
You should _always_ watch to ensure that your transactions go out. `bitcoin-cli listtransactions` will show all of your incoming and outgoing transactions, while `bitcoin-cli gettransaction` with a txid will show a specific transaction.
9+
You should _always_ watch to ensure that your transactions go
10+
out. `bitcoin-cli listtransactions` will show all of your incoming and
11+
outgoing transactions, while `bitcoin-cli gettransaction` with a txid
12+
will show a specific transaction.
813

9-
The following shows a transaction that has not been put into a block. You can tell this because it has no confirmations.
14+
The following shows a transaction that has not been put into a
15+
block. You can tell this because it has no confirmations.
1016

1117
```sh
1218
bitcoin-cli -named gettransaction txid=1050f6e2d68e7e4555bd682f24157f9bb19f666cf2ba1d1b3ff959ff4f893654
@@ -43,11 +49,31 @@ bitcoin-cli -named gettransaction txid=1050f6e2d68e7e4555bd682f24157f9bb19f666cf
4349
| }
4450
```
4551
46-
A transaction can be considered stuck if it stays in this state for an extended amount of time. Early on, you could be sure that every transaction would go out _eventually_. But, that's no longer the case due to the increased usage of Bitcoin. Now, if a transaction is stuck too long, it will drop out of the mempool and then be lost from the Bitcoin network.
47-
48-
> 📖 ***What is mempool?*** Mempool (or Memory Pool) is a pool of all unconfirmed transactions at a bitcoin node. These are the transactions that a node has received from the peer-to-peer network which are not yet included in a block. Each bitcoin node can have a slightly different set of transactions in its mempool: different transactions might have propogated to a specific node. This depends on when the node was last started and also its limits on how much it's willing to store. When a miner makes a block, they use transactions from their own mempool. Then, when a block is verified, all the miners remove the transactions that block contains from their individual pools. Most mempools will not keep unconfirmed transactions for longer than two weeks, and that number could drop dramatically (to as low as a few days) in times of congestion.
49-
50-
This list of all [unconfirmed transactions on the mainnet](https://blockchain.info/unconfirmed-transactions) might not match any individual machine's mempool, but it should (mostly) be a superset of them.
52+
A transaction can be considered stuck if it stays in this state for an
53+
extended amount of time. Early on in the history of Bitcoin, you could
54+
be sure that every transaction would go out _eventually_. But, that's
55+
no longer the case due to its increased usage. Now, if a transaction
56+
is stuck too long, it will drop out of the mempool and then be lost
57+
from the Bitcoin network.
58+
59+
> 📖 ***What is mempool?*** Mempool (or Memory Pool) is a pool of all
60+
unconfirmed transactions at a Bitcoin node. These are the transactions
61+
that a node has received from the peer-to-peer network which are not
62+
yet included in a block. Each Bitcoin node can have a slightly
63+
different set of transactions in its mempool: different transactions
64+
might have propogated to a specific node. This depends on when the
65+
node was last started and also its limits on how much it's willing to
66+
store. When a miner makes a block, they use transactions from their
67+
own mempool. Then, when a block is verified, all the miners remove the
68+
transactions that block contains from their individual pools. Most
69+
mempools will not keep unconfirmed transactions for longer than two
70+
weeks, and that number could drop dramatically (to as low as a few
71+
days) in times of congestion.
72+
73+
This list of all [unconfirmed transactions on the
74+
mainnet](https://blockchain.info/unconfirmed-transactions) might not
75+
match any individual machine's mempool, but it should (mostly) be a
76+
superset of them.
5177
5278
## Decide What to Do
5379
@@ -57,13 +83,19 @@ If your transaction is stuck longer than you want, you can typically do one of f
5783
5884
**2. Wait Until it Expires.** If you accidentally sent with no transaction fee, or if any number or other conditions are met, then your transaction might never go through. However, your coins aren't lost. As long as you don't have a wallet that purposefully resends unconfirmed transactions, it should eventually clear from the mempool, and then you can try again.
5985
60-
**3. Use RBF as the Sender.** If you are the sender of the transaction, and you opted-in to RBF (Replace-By-Fee), then you can try again with a higher fee. See [§6.2: Resending a Transaction with RBF](06_2_Resending_a_Transaction_with_RBF.md).
86+
**3. Use RBF as the Sender.** If you are the sender of the transaction, and you opted-in to RBF (Replace-by-Fee), then you can try again with a higher fee. See [§6.2: Resending a Transaction with RBF](06_2_Resending_a_Transaction_with_RBF.md).
6187
62-
**4. Use CPFP as the Receiver.** Alternatively, if you are the receiver of the transaction, you can use CPFP (Child-pays-for-parent) to use the unconfirmed transaction as an input to a new transaction. See [§6.3: Funding a Transaction with CPFP](06_3_Funding_a_Transaction_with_CPFP.md)
88+
**4. Use CPFP as the Receiver.** Alternatively, if you are the
89+
receiver of the transaction, you can use CPFP (Child-Pays-for-Parent)
90+
to use the unconfirmed transaction as an input to a new
91+
transaction. See [§6.3: Funding a Transaction with
92+
CPFP](06_3_Funding_a_Transaction_with_CPFP.md)
6393
6494
## Summary: Watching for Stuck Transactions
6595
66-
This is an introduction to the power of Bitcoin transactions. If you know that a transaction is stuck, then you can decide to free it up with features like RBF or CPFP.
96+
This is an introduction to the power of Bitcoin transactions. If you
97+
know that a transaction is stuck, then you can decide to free it up
98+
with features like RBF or CPFP.
6799
68100
| Role | Feature | Section |
69101
|-------|----------|-----|

0 commit comments

Comments
 (0)