Hey everyone,
I’m digging into Testnet4 right now.
In the file chainparams.cpp, I see this line:
Line 315
consensus.BIP34Height = 1;
But when I check the coinbase data in block 1, it doesn’t follow the BIP34 rules. It’s only from block 17 onwards that the coinbase data is actually set up right according to those rules.
Any idea why that’s happening?
Cheers
Testnet4 Ignoring BIP Rules
4 replies 321 views
Those blocks actually are compliant. They only do not look like all the ones after because of the script encoding rules for the numbers 1 through 16.
BIP 34 specifies that the height is encoded as "minimally encoded serialized CScript". For 1 through 16, this minimal encoding is actually the opcodes OP_1 through OP_16, which correspond to the hex values 0x51 through 0x60. All other numbers are length prefixed and encoded in little endian.
Is there a unit test in the codebase for BIP34 block checks, or validating new blocks in general?
https://github.com/bitcoin/bitcoin/blob/master/test/functional/test_framework/blocktools.py#L118
Thanks for your answers.
Is the reason for this behavior that the Bitcoin script specifications are specifically optimized for small numbers?
And the bitcoin script generally uses special opcodes (OP_1 to OP_16, corresponding to 0x51 to 0x60) for numbers 1 to 16 as part of the minimal encoding rules?
Or is there an additional justification or other reason for this behavior?
Best regards
?Reply
Sign in to reply to this topic
Related topics
- Are you in favor of BIP-110? Let's get a Bitcoin poll going. 0
- BIP proposal for Trezor and others 10
- Knight Hider's Bitcoin Testnet4 faucet Open for Requests 19
- Bitcoin Core displaying coins (UTXOs) in a new tab 13
- Erlay seems to have some issues here’s a better proposal for a bitcoin protocol without invites 3
- New Optional Hourglass Implementation is Live 3