What is the accepted methodology of checking the integrity of a chain?

If I poll my Geth/Parity node for block data using web3.js how can I confirm that the data returned is not going to be subject to a later reorganisation?

Is it simply a case of implementing some self-checking. I.E. fetching the block data again x hours in the future, and confirming the hashes etc match. If so, what are considered 'safe' parameters for stating that a block is definitely part of the chain?

Tools such as block explorers need to be fetching new data 'as close to as it happens' as possible so that they can present useful and insightful data, yet it is completely plausible that the data at the head of the chain could change.



You simply need to pick a confirmation limit that you are happy with. A common one in the ETH ecosystem is 12, so you would only consider data 'safe' if it was mined at least 12 blocks ago. You can check this is the case simply by fetching your latest block number, then subtracting 12 and calling that your latest 'safe' block.

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.