Skip to content

Commit 09252b7

Browse files
edited §9.1: Locktime and updated some older references
1 parent b487dfd commit 09252b7

4 files changed

Lines changed: 208 additions & 62 deletions

docs/05_2_Creating_a_Raw_Transaction.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,20 @@ $ bitcoin-cli decoderawtransaction $rawtxhex
172172

173173
Check the `vin`. Are you spending the right transaction? Does it contain the expected amount of money? (Check with `bitcoin-cli gettransaction` and be sure to look at the right `vout`.) Check your `vout`. Are you sending the right amount? Is it going to the right address? Finally, do the math to make sure the money balances. Does the value of the UTXO minus the amount being spent equal the expected transaction fee?
174174

175-
> ℹ️ **NOTE: Sequence:** You may note that each input has a sequence number, set here to `4294967293`, which is `0xFFFFFFFF-2`. This is the last frontier of Bitcoin transactions, because it's a standard field in transactions that was originally intended for a specific purpose, but was never fully implemented. So now there's this integer sitting around in transactions that could be repurposed for other uses. And, in fact, it has been. As of this writing there are three different uses for the variable that's called `nSequence` in the Bitcoin Core code: it enables RBF, `nLockTime`, and relative timelocks. It used to always be set to `4294967295` (`0xFFFFFFFF`), which meant "nothing special", but nowadays it's set to `4294967293` (`0xFFFFFFFF-2`), which means "allow Replace-by-Fee by default", which is explained in [§6.2](06_2_Resending_a_Transaction_with_RBF.md). Other values mean other things.
175+
> ℹ️ **Sequence Usages.** You may note that each input has a sequence
176+
number, set here to `4294967293`, which is `0xFFFFFFFF-2`. This is the
177+
last frontier of Bitcoin transactions, because it's a standard field
178+
in transactions that was originally intended for a specific purpose,
179+
but was never fully implemented. So now there's this integer sitting
180+
around in transactions that could be repurposed for other uses. And,
181+
in fact, it has been. As of this writing there are three different
182+
uses for the variable that's called `nSequence` in the Bitcoin Core
183+
code: it enables RBF, `nLockTime`, and relative timelocks. It used to
184+
always be set to `4294967295` (`0xFFFFFFFF`), which meant "nothing
185+
special", but nowadays it's set to `4294967293` (`0xFFFFFFFF-2`),
186+
which means "allow Replace-by-Fee by default", which is explained in
187+
[§6.2](06_2_Resending_a_Transaction_with_RBF.md). Other values mean
188+
other things.
176189

177190
### Sign the Raw Transaction
178191

docs/06_2_Resending_a_Transaction_with_RBF.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ When RBF came around as a new version of transaction replacement, it went back t
2525

2626
That was it! With RBF enabled, transactions could be replaced; with RBF disabled, transactions could not. (Except today, all transactios can be replaced, _in theory_.)
2727

28-
> ℹ️ **Sequence Usage (v1).** This is the first use of the `sequence` value in Bitcoin. You can set it between 1 and 0xffffffff-2 (4294967293) and enable RBF, but if you're not careful you can run up against the parallel use of `sequence` for relative timelocks. We suggest always setting it to "0xffffffff-2", which is what Bitcoin Core does, but the other option is to set it to to "1" or to a value between 0xf0000000 (4026531840) and 0xffffffff-2 (4294967293). Setting `sequence` to "1" effectively makes relative timelocks irrelevent and setting it to 0xf0000000 or higher deactivates them. This is all explained in later sections. For now, just choose one of the non-conflicting values for `sequence`.
28+
> ℹ️ **Sequence Usage #1.** This is the first use of the `sequence` value in Bitcoin. You can set it between 1 and 0xffffffff-2 (4294967293) and enable RBF, but if you're not careful you can run up against the parallel use of `sequence` for relative timelocks. We suggest always setting it to "0xffffffff-2", which is what Bitcoin Core does, but the other option is to set it to to "1" or to a value between 0xf0000000 (4026531840) and 0xffffffff-2 (4294967293). Setting `sequence` to "1" effectively makes relative timelocks irrelevent and setting it to 0xf0000000 or higher deactivates them. This is all explained in later sections. For now, just choose one of the non-conflicting values for `sequence`.
2929
3030
## Understand How RBF Works
3131

docs/09_0_Expanding_Bitcoin_Transactions_Other.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Chapter Eight: Expanding Bitcoin Transactions in Other Ways
22

3-
The definition of basic transactions back in [Chapter Six](06_0_Expanding_Bitcoin_Transactions_Multisigs.md) said that they sent _funds_ _immediately_, but those are both elements that can be changed. This final section on Expanding Bitcoin Transactions talks about how to send things other than cash and how to do it at a time other than now.
3+
The definition of basic transactions back in [Chapter
4+
Seven](07_0_Expanding_Bitcoin_Transactions_Multisigs/) said that they
5+
sent [a] funds [b] immediately, but those are both elements that can be
6+
changed. This final section on Expanding Bitcoin Transactions talks
7+
about how to send things other than cash and how to do it at a time
8+
other than now.
49

510
## Objectives for This Section
611

0 commit comments

Comments
 (0)