Is there a robust way to test for a corrupted blockchain?

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.

kobejohn

Posted 2017-03-26T10:46:49.693

Reputation: 121

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 2017-03-26T17:22:47.590

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 2017-03-27T03:42:55.660

@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 2017-03-27T06:29:58.390

@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 againCodebrekers 2018-06-20T06:34:45.523

@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 2018-06-20T20:17:22.347

No answers