6

I've recently written my own blockchain parser. It works well (yay!) up to a certain block and then fails because the data read is pure nonsense.

I've tracked down the error away from my code to the data on the disc and I get the same result if I parse the file only using a sheet of paper and a hex editor. Even after deleting the file and executing bitcoind -reindex I still get the same erroneous results.

My question is if anybody can reproduce this or if my data is still corrupted somehow. Maybe I just need to delete all files and let bitcoind create them again?

My findings:

  • blk00622.dat causes the trouble
  • Problem still exists after deleting blk00622.dat and running bitcoind -reindex (according to diff the new file equals the old one)
  • The last ok block is block #428949 (at file address 0x7B748DF). I have no problem parsing it with my hex editor, I get the same results as shown here: https://blockchain.info/de/block-index/1144703
  • The erroneous block begins at file address 0x7C68AB3
  • It starts with F9 BE B4 D9 41 0F 0F 00 F9 BE B4 D9*

F9 BE B4 D9 is the block's magic number and 41 0F 0F 00 is the block size. The strange thing here is that the following version number again equals the magic number (which makes me thing that maybe my data is still corrupt). The remaining data of the block makes no sense, for example the time field points to 03/04/1948 ..

Edit: Please see the comments below for an URL to the file (I am not allowed to put more than 2 links in here unfortunately).

Thanks!

*see https://en.bitcoin.it/wiki/Block

  • Maybe it would help if you could post a copy of the offending blk00622.dat somewhere? – Nate Eldredge Sep 30 '16 at 18:54
  • The file is available at: userpages.uni-koblenz.de/~hheinz/btc/blk00622.dat – user41830 Sep 30 '16 at 20:18
  • It does seem like that file is corrupted. I don't understand how it can be recreated exactly the same. Note that reindexing itself won't recreate the file; it would have to come from redownloading those blocks from the network. I would wonder if you are really looking at the files that you think you are. – Nate Eldredge Oct 1 '16 at 14:01
  • 2
    Thanks for taking a look. Unfortunately I deleted my shell history file so I can not guarantee that I did not make a mistake. I now ran bitcoind again with with an other -datadir and now the new file differs from the old one. – user41830 Oct 2 '16 at 14:12
1

That block file is corrupted. You will have to delete blk00622.dat and any higher numbered blk*.dat file and rev00622.dat and any higher numbered rev*.dat file. Then you will need to reindex. This should fix the issue as the corrupted blocks will be redownloaded.

0

Blockparsers fail if downloading of blockchain is not completed.

Make sure you download all blockchain then try your blockparser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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