Skip to content

Commit 707af53

Browse files
committed
Add BIP-xxxx: additional coinbase fields for GBT
1 parent ecb074d commit 707af53

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

bip-coinbase-fields-bip54.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
```
2+
BIP: ?
3+
Layer: API/RPC
4+
Title: getblocktemplate - additional coinbase fields
5+
Authors: Sjors Provoost <sjors@sprovoost.nl>
6+
Status: Draft
7+
Type: Specification
8+
Assigned: ?
9+
License: BSD-2-Clause
10+
Requires: 22
11+
```
12+
13+
## Abstract
14+
15+
This BIP describes modifications to the `getblocktemplate` JSON-RPC call
16+
([BIP 22](bip-0022.mediawiki)) to allow servers to specify the coinbase
17+
transaction's `nVersion`, `nLockTime`, and `nSequence` fields.
18+
19+
## Motivation
20+
21+
[BIP 54](bip-0054.md) proposes new consensus rules that would constrain the
22+
coinbase transaction's `nLockTime` and `nSequence` fields. Although BIP 54
23+
is the direct motivation for this BIP, it can be implemented independently.
24+
This BIP only adds these fields to the server response, it does not constrain
25+
their values.
26+
27+
BIP 54 does not constrain `nVersion`, but it's included in this BIP so that
28+
`getblocktemplate` now covers all coinbase transaction fields.[^complete]
29+
30+
## Specification
31+
32+
### Block Template
33+
34+
The template Object is extended to include new keys:
35+
36+
| Key | Required | Type | Description |
37+
|-----|----------|------|-------------|
38+
| `coinbase_version` | Yes | Number | coinbase `nVersion` value |
39+
| `coinbase_locktime` | Yes | Number | coinbase `nLockTime` value |
40+
| `coinbase_sequence` | Yes | Number | coinbase `nSequence` value |
41+
42+
Types are JSON types as defined in [BIP 22](bip-0022.mediawiki).
43+
44+
The `coinbase_version` field specifies the value that MUST be
45+
used for the coinbase transaction's `nVersion` field.[^version]
46+
47+
The `coinbase_locktime` field specifies the exact value that
48+
SHOULD be used for the coinbase transaction's `nLockTime` field.
49+
If BIP54 is activated then it MUST be used.[^locktime]
50+
51+
The `coinbase_sequence` field specifies a value that MUST be used
52+
for the coinbase transaction input's `nSequence` field.[^sequence]
53+
54+
## Rationale
55+
56+
Included as footnotes.
57+
58+
## Backward Compatibility
59+
60+
Servers that do not support this BIP will not include the new fields. Clients
61+
that do not understand these fields may ignore them. However, they will produce
62+
invalid blocks if [BIP 54](bip-0054.md) is activated, unless they independently
63+
implement the required constraints.
64+
65+
## Reference Implementation
66+
67+
- Bitcoin Core: [bitcoin/bitcoin#34419](https://github.com/bitcoin/bitcoin/pull/34419)
68+
69+
## Copyright
70+
71+
This BIP is licensed under the BSD 2-clause license.
72+
73+
[^version]: **What value should servers use for `coinbase_version`?**
74+
At the time of writing, there is no consensus constraint on transaction
75+
versions. Transaction version 2 is the latest version with defined
76+
semantics, as specified in [BIP 68](bip-0068.mediawiki), but its relative
77+
lock-time rules do not apply to the coinbase input. If future consensus
78+
rules constrain transaction versions, servers MUST reflect those rules in
79+
`coinbase_version`. Clients MUST use this value so that they don't need
80+
to be updated again later.
81+
82+
[^locktime]: **Why SHOULD vs MUST?**
83+
Unless BIP 54 is not activated, the `nLockTime` field could potentially be
84+
used as an `extraNonce`, which downstream software may need to roll. This
85+
use case would be ruled out by BIP 54 activation. It requires an `nLockTime`
86+
that's interpreted as a height and also constrains `nSequence`. That leaves
87+
no flexibility in `nLockTime`.
88+
89+
[^sequence]: **Why not use a bit mask?**
90+
The only restriction BIP 54 proposes for `nSequence` is to disallow
91+
`0xffffffff`. The server could communicate this intention via a bit mask,
92+
but for simplicity it just provides the entire `nSequence` value. Clients
93+
MUST use this value, so that future soft forks can safely add additional
94+
constraints.
95+
96+
[^complete]: **Does `getblocktemplate` now cover all coinbase transaction
97+
fields?**
98+
All fields that could potentially be constrained by a soft fork are now
99+
covered. The coinbase input's prevout txid (32 zero bytes) and vout index
100+
(0xffffffff) are fixed by consensus, so they can be safely hardcoded in
101+
mining software.
102+
103+

0 commit comments

Comments
 (0)