2

While running bitcoind I once had the blockchain get corrupted and it manifested as a non-obvious error message which unfortunately I can't remember. I would like to know if there is a robust way to check that the blockchain has been corrupted, preferably using a standard tool such as bitcoin-cli.

I'd prefer to err on the side of false positives (it's not corrupt but the test says it is corrupt) if necessary.

  • Reindexing with bitcoind -reindex should detect any corruption, but takes a long time. In principle it should be sufficient to compute the hashes of all the blocks in the blk*.dat files and check that they all link together in a chain. – Nate Eldredge Mar 26 '17 at 17:22
  • By corrupted blockchain, do you mean that literally the blocks on disk are corrupted (uncommon) or that Bitcoin Core's database was in an inconsistent state (common)? – Pieter Wuille Mar 27 '17 at 3:42
  • @PieterWuille I'm sorry I'm not sure. At the time I looked up the error and found that it likely indicated a "corrupt" blockchain. I did not look into it further and simply used -reindex to rebuild and it worked after that. If the common case is an inconsistent state, then I guess that is what I would want to check for. – kobejohn Mar 27 '17 at 6:29
  • @kobejohn: You got any solution for the same because I am facing the same issue and tried for reindexing but after 91% reindex the same error came again – Codebrekers Jun 20 '18 at 6:34
  • @Codebrekers Unfortunately I do not. I put that project on hold so I did not work on it. If I were going to, I would probably try an alternate implementation like BitPrim to see if it is more reliable. – kobejohn Jun 20 '18 at 20:17

Your Answer

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

Browse other questions tagged or ask your own question.