Skip to content

Commit e70196c

Browse files
committed
bip54: additional coinbase fields for GBT
1 parent ed7af6a commit e70196c

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

bip-0054.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,38 @@ that include 64-byte transactions.
150150
The coinbase transaction is usually crafted by mining pool software. To the best of the authors'
151151
knowledge, there does not exist an open source reference broadly in use today for such software.
152152
We encourage mining pools to update their software to craft coinbase transactions that are
153-
forward-compatible with the changes proposed in this BIP.
153+
forward-compatible with the changes proposed in this BIP. This can be done by using the new
154+
`getblocktemplate` fields described below, once node software supports it.
155+
156+
## getblocktemplate changes
157+
158+
The template Object of the `getblocktemplate` JSON-RPC call ([bip-0022][BIP22]) is extended with
159+
the following keys:
160+
161+
| Key | Required | Type | Description |
162+
|-----|----------|------|-------------|
163+
| `coinbase_locktime` | Yes | Number | coinbase `nLockTime` value |
164+
| `coinbase_sequence` | Yes | Number | coinbase `nSequence` value |
165+
| `coinbase_version` | Yes | Number | coinbase `nVersion` value |
166+
167+
Types are JSON types as defined in [bip-0022][BIP22].
168+
169+
The `coinbase_locktime` field specifies the exact value that MUST be used for the coinbase
170+
transaction's `nLockTime` field.
171+
172+
The `coinbase_sequence` field specifies a value that SHOULD be used for the coinbase transaction
173+
input's `nSequence` field. If a different value is used, it MUST NOT be `0xffffffff`[^12].
174+
175+
The `coinbase_version` field specifies the value that SHOULD be used for the coinbase transaction's
176+
`nVersion` field[^13].
177+
154178

155179
## Reference implementation
156180

157181
An implementation of BIP54 for Bitcoin Core is available [here][inquisition-implem].
158182

183+
The `getblocktemplate` extension is implemented in [bitcoin/bitcoin#34419][GBT implem].
184+
159185
## Test vectors
160186

161187
Documented test vectors are available [here](./bip-0054/test_vectors/) for all mitigations
@@ -218,6 +244,23 @@ bip-0034 height commitment and the corresponding future block height.
218244
coinbase transactions as not having duplicate past Consensus Cleanup activation would be consistent
219245
for any implementation which enforces `nLockTime` from the genesis block, which is the behaviour
220246
notably of Bitcoin Core but also of all other implementations the authors are aware of.
247+
[^12]: **Why SHOULD for `coinbase_sequence`?**
248+
The only consensus constraint on `nSequence` is to disallow `0xffffffff`.
249+
The server could communicate this via a bit mask, but for simplicity it
250+
provides the entire `nSequence` value. Clients SHOULD use this value, so
251+
that future soft forks can safely add additional constraints.
252+
[^13]: **Why is `coinbase_version` included?**
253+
This BIP does not constrain the coinbase transaction's `nVersion`, but
254+
including it means `getblocktemplate` now covers all coinbase transaction
255+
fields that could potentially be constrained by a future soft fork. The
256+
coinbase input's prevout txid (32 zero bytes) and vout index (`0xffffffff`)
257+
are fixed by consensus, so they can be safely hardcoded in mining software.
258+
At the time of writing, there is no consensus constraint on transaction
259+
versions. Transaction version 2 is the latest version with defined
260+
semantics, as specified in [bip-0068][BIP68], but its relative lock-time
261+
rules do not apply to the coinbase input. Nonetheless, clients SHOULD use
262+
this value so that they don't need to be updated if a future soft fork
263+
constrains `nVersion`.
221264

222265
[BIP30]: https://github.com/bitcoin/bips/blob/master/bip-0030.mediawiki
223266
[BIP-XXXX]: https://github.com/TheBlueMatt/bips/blob/7f9670b643b7c943a0cc6d2197d3eabe661050c2/bip-XXXX.mediawiki
@@ -242,3 +285,6 @@ notably of Bitcoin Core but also of all other implementations the authors are aw
242285
[Core 29.0]: https://bitcoincore.org/en/releases/29.0
243286
[inquisition-implem]: https://github.com/darosior/bitcoin/tree/2509_inquisition_consensus_cleanup
244287
[Core 30.0]: https://bitcoincore.org/en/releases/30.0
288+
[BIP22]: https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki
289+
[BIP68]: https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki
290+
[GBT implem]: https://github.com/bitcoin/bitcoin/pull/34419

0 commit comments

Comments
 (0)