Files
bips/bip-0034.mediawiki
T

47 lines
2.9 KiB
Plaintext
Raw Normal View History

<pre>
BIP: 34
Layer: Consensus (soft fork)
Title: Block v2, Height in Coinbase
2025-04-11 20:08:17 -07:00
Authors: Gavin Andresen <gavinandresen@gmail.com>
2025-04-11 18:08:44 -07:00
Status: Deployed
2025-04-11 18:19:21 -07:00
Type: Specification
2025-10-08 14:59:36 -07:00
Assigned: 2012-07-06
2026-11-04 02:57:50 +10:00
Version: 1.0.4
</pre>
==Abstract==
Bitcoin blocks and transactions are versioned binary structures. Both currently use version 1. This BIP introduces an upgrade path for versioned transactions and blocks. A unique value is added to newly produced coinbase transactions, and blocks are updated to version 2.
==Motivation==
# Clarify and exercise the mechanism whereby the bitcoin network collectively consents to upgrade transaction or block binary structures, rules and behaviors.
# Enforce block and transaction uniqueness, and assist unconnected block validation.
==Specification==
# Treat transactions with a version greater than 1 as non-standard (official Satoshi client will not mine or relay them).
# Add height as the first item in the coinbase transaction's scriptSig, and increase block version to 2. The format of the height is "minimally encoded serialized CScript" -- first byte is number of bytes in the number (will be 0x03 on main net for the next 150 or so years with 2<sup>23</sup>-1 blocks), following bytes are little-endian representation of the number (including a sign bit). Height is the height of the mined block in the block chain, where the genesis block is height zero (0).
2026-11-04 02:57:50 +10:00
# For new chains (such as [[bip-0325.mediawiki|signet]] or [[bip-0094.mediawiki|testnet4]]) that enforce this rule immediately after the genesis block, "minimally encoded serialized CScript" results in a different encoding for blocks at heights 1-16: those values must be encoded as the single byte 0x51 to 0x60 (<code>OP_1..OP_16</code>), with no "number of bytes" prefix. Note that the minimum length of the coinbase transaction's scriptSig is two bytes, so the height push alone is insufficient for blocks 1-16. In addition, this BIP never applies to the genesis block.
# 75% rule: If 750 of the last 1,000 blocks are version 2 or greater, reject invalid version 2 blocks. (testnet3: 51 of last 100)
# 95% rule ("Point of no return"): If 950 of the last 1,000 blocks are version 2 or greater, reject all version 1 blocks. (testnet3: 75 of last 100)
==Backward compatibility==
All older clients are compatible with this change. Users and merchants should not be impacted. Miners are strongly recommended to upgrade to version 2 blocks. Once 95% of the miners have upgraded to version 2, the remainder will be orphaned if they fail to upgrade.
==Implementation==
https://github.com/bitcoin/bitcoin/pull/1526
2014-11-11 10:15:58 -05:00
==Result==
Block number 227,835 (timestamp 2013-03-24 15:49:13 GMT) was the last version 1 block.
==Changelog==
2026-11-04 02:57:50 +10:00
* 1.0.4: 2026-11-04: clarify encoding for early blocks
* 1.0.3: 2020-11-18: clarify that encoding must be minimal
* 1.0.2: 2016-02-05: correction to format prediction regarding sign bit
* 1.0.1: 2016-02-01: updated to Final, logged activation block
* 1.0.0: 2012-07-06: proposed