Bitcoin Forum
May 27, 2024, 10:11:49 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Creating the 100 Miner Test Blocks.  (Read 827 times)
MatthewLM (OP)
Legendary
*
Offline Offline

Activity: 1190
Merit: 1004


View Profile
October 17, 2012, 06:01:20 PM
 #1

Hello. I'm trying to generate the mining test blocks from here: https://github.com/bitcoin/bitcoin/blob/master/src/test/miner_tests.cpp

I assume they work on top of the genesis block and so I tried creating them but the first fails with a bad hash. The first block data I have is this:

Code:
0x1, 0x0, 0x0, 0x0, // Version 1
0x6f, 0xe2, 0x8c, 0xa, 0xb6, 0xf1, 0xb3, 0x72, 0xc1, 0xa6, 0xa2, 0x46, 0xae, 0x63, 0xf7, 0x4f, 0x93, 0x1e, 0x83, 0x65, 0xe1, 0x5a, 0x8, 0x9c, 0x68, 0xd6, 0x19, 0x0, 0x0, 0x0, 0x0, 0x0, // Genesis Prev Hash
0x42, 0xa, 0x9e, 0xc3, 0xf4, 0xa4, 0x97, 0x26, 0x7d, 0xb5, 0xe0, 0x7d, 0xdd, 0x2e, 0xea, 0x53, 0xa5, 0x37, 0x68, 0xbc, 0x49, 0xd7, 0x89, 0xb9, 0x9c, 0x8a, 0x7a, 0x5a, 0x98, 0x92, 0x9b,
0xba, // Merkle Root
0x2a, 0xab, 0x5f, 0x49, // TimeStamp
0xff, 0xff, 0x0, 0x1d, // Target
0x23, 0xe2, 0xa3, 0xa4, // Nonce
0x1, // Transaction number
0x1, 0x0, 0x0, 0x0, // Transaction version
0x1, // Input number
0x0 <repeats 32 times>, // Coinbase output reference hash
0xff, 0xff, 0xff, 0xff, // Coinbase output reference index
0x5, // Input script length
0x4, // Extra nonce
0x0, 0x0, 0x0, 0x0, // Height
0xff, 0xff, 0xff, 0xff, // Sequence
0x1, // Output number
0x0, 0xf2, 0x5, 0x2a, 0x1, 0x0, 0x0, 0x0, // Output value
0x0, // Output script length. Assuming nothing comes after with zero length???
0x0, 0x0, 0x0, 0x0 // Locktime

What am I doing wrong, does anyone know?

I need to do this to do some block validation tests.
MatthewLM (OP)
Legendary
*
Offline Offline

Activity: 1190
Merit: 1004


View Profile
October 17, 2012, 06:56:43 PM
 #2

Okay the issue was with the input script length. Mine was 5 bytes but it should have only been 2 bytes. One byte each for the two numbers. All sorted now.
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!