1

Has anyone used this blockchain parser for Bitcoin https://code.google.com/p/blockchain/ ?

http://codesuppository.blogspot.in/2014/01/a-command-line-interface-for-blockchain.html

I tried to parse blockchain generated by Bitcoin (bitcoind -regtest -daemon) in regtest mode but it is not reading(parsing) it correctly.

I copied the file blk00000.dat (this is the only file generated in regtest mode) to /home/somesh/Desktop/blockchain-read-only/ folder. I executed the command:
./blockchain.out /home/somesh/Desktop/blockchain-read-only

output:

Successfully opened block-chain input file '/home/somesh/Desktop/blockchain-read-only/blk00000.dat'
Welcome ...
Commands available: ... (then prints all the available commands)

then I selected scanning option

scan

The following is the message I get on scanning

Scanning block-chain re-started from block 0 up to a maximum of 500000 blocks..<br>
Warning: Missing block-header; scanning for next one.
Failed to open block-chain input file '/home/somesh/Desktop/blockchain-read-only/blk00001.dat'<br>
Finished scanning block headers. Built block-chain with 0 blocks found..

It is working fine for Bitcoin's real blockchain but not for the blockchain generated in regtest mode.

I think the parser is not able to find the block header in blk00000.dat and is skipping to next file.

Warning: Missing block-header; scanning for next one.

what changes do I have to make ?

2
  • First: are you sure it is looking for the files in the right directory? ls /home/somesh/Desktop/blockchain-read-only/blk00001.dat confirms that the file exists? (Normally it would be in a subdirectory called blocks.) Can you also include the exact command you are running, with all arguments? Sep 25, 2014 at 12:59
  • I updated my question with the commands that I used.
    – somesh
    Sep 25, 2014 at 15:25

1 Answer 1

4

When working in regTest (or testNet) mode the 'magic number' identifying the start of each block is different to what it is for the live network. The parser you mention may well use the magic number to identify the start of blocks. This may be the cause of your problem and why it is not finding any blocks in the regTest blockchain file.

RegTest (and testNet): 0xdab5bffa Live: 0xd9b4bef9

Hence it is likely that the parser code needs to be modified to work with regTest/testNet magic numbers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.