3

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.

Thanks

2
  • 3
    Related: ethereum.stackexchange.com/questions/319/…
    – eth
    Commented Apr 21, 2017 at 5:29
  • The time that the block has been in the chain is less important than the amount of work done on top of it, i.e. the number of blocks. As @eth linked, 12 is a good number for most use cases Commented Apr 21, 2017 at 15:08

1 Answer 1

2

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 and acknowledge you have read our privacy policy.

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