Bitcoin Forum
December 29, 2025, 01:31:59 PM *
News: Latest Bitcoin Core release: 30.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Testnet4 - BIP Rule Ignore  (Read 70 times)
BloodyMary53 (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 10


View Profile
December 05, 2024, 03:12:33 AM
Merited by NotATether (4), vapourminer (2), pooya87 (2), ABCbits (2)
 #1

Hello,

I am currently working with Testnet4.

The following is set in chainparams.cpp:

Line 315
consensus.BIP34Height = 1;

If I now look at the value in the coinbase data field of block 1, it is not compliant with the BIP34 rules.
Only from block 17 onwards, the value in the Coinbase data field is set correctly according to the BIP34 rules.

Why is this the case?

Best regards
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3850
Merit: 7535


Just writing some code


View Profile WWW
December 05, 2024, 04:34:59 AM
Merited by pooya87 (4), ABCbits (4), BloodyMary53 (2)
 #2

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.

NotATether
Legendary
*
Offline Offline

Activity: 2198
Merit: 9182


Trêvoid █ No KYC-AML Crypto Swaps


View Profile WWW
December 05, 2024, 12:12:05 PM
Merited by garlonicon (1)
 #3

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?

.
 betpanda.io 
 
ANONYMOUS & INSTANT
.......ONLINE CASINO.......
▄███████████████████████▄
█████████████████████████
█████████████████████████
████████▀▀▀▀▀▀███████████
████▀▀▀█░▀▀░░░░░░▄███████
████░▄▄█▄▄▀█▄░░░█▄░▄█████
████▀██▀░▄█▀░░░█▀░░██████
██████░░▄▀░░░░▐░░░▐█▄████
██████▄▄█░▀▀░░░█▄▄▄██████
█████████████████████████
█████████████████████████
█████████████████████████
▀███████████████████████▀
▄███████████████████████▄
█████████████████████████
██████████▀░░░▀██████████
█████████░░░░░░░█████████
███████░░░░░░░░░███████
████████░░░░░░░░░████████
█████████▄░░░░░▄█████████
███████▀▀▀█▄▄▄█▀▀▀███████
██████░░░░▄░▄░▄░░░░██████
██████░░░░█▀█▀█░░░░██████
██████░░░░░░░░░░░░░██████
█████████████████████████
▀███████████████████████▀
▄███████████████████████▄
█████████████████████████
██████████▀▀▀▀▀▀█████████
███████▀▀░░░░░░░░░███████
██████░░░░░░░░░░░░▀█████
██████░░░░░░░░░░░░░░▀████
██████▄░░░░░░▄▄░░░░░░████
████▀▀▀▀▀░░░█░░█░░░░░████
████░▀░▀░░░░░▀▀░░░░░█████
████░▀░▀▄░░░░░░▄▄▄▄██████
█████░▀░█████████████████
█████████████████████████
▀███████████████████████▀
.
SLOT GAMES
....SPORTS....
LIVE CASINO
▄░░▄█▄░░▄
▀█▀░▄▀▄░▀█▀
▄▄▄▄▄▄▄▄▄▄▄   
█████████████
█░░░░░░░░░░░█
█████████████

▄▀▄██▀▄▄▄▄▄███▄▀▄
▄▀▄█████▄██▄▀▄
▄▀▄▐▐▌▐▐▌▄▀▄
▄▀▄█▀██▀█▄▀▄
▄▀▄█████▀▄████▄▀▄
▀▄▀▄▀█████▀▄▀▄▀
▀▀▀▄█▀█▄▀▄▀▀

Regional Sponsor of the
Argentina National Team
garlonicon
Copper Member
Legendary
*
Offline Offline

Activity: 944
Merit: 2309


View Profile
December 05, 2024, 12:57:08 PM
 #4

Quote
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
Code:
def script_BIP34_coinbase_height(height):
    if height <= 16:
        res = CScriptOp.encode_op_n(height)
        # Append dummy to increase scriptSig size above 2 (see bad-cb-length consensus rule)
        return CScript([res, OP_1])
    return CScript([CScriptNum(height)])
BloodyMary53 (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 10


View Profile
December 05, 2024, 11:41:58 PM
 #5

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
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!