Nodes deployed with Chainstack follow the canonical chain. If there is a block reorganization, the nodes will automatically follow the longest chain that has been determined.
"The term "blockchain reorganization" is used to refer to the situation where a client discovers a new difficultywise-longest well-formed blockchain which excludes one or more blocks that the client previously thought were part of the difficultywise-longest well-formed blockchain. These excluded blocks become orphans. Chain reorganization is a client-local phenomenon; the entire bitcoin network doesn't "reorganize" simultaneously." ~ https://en.bitcoin.it/wiki/Chain_Reorganization
How do you spot these?
When subscribing to incoming blocks, you might notice the block number shift in block hash. This doesn't happen very often, but it does happen.
Notice that this block number has uncle rewards https://etherscan.io/block/3887081
How do I handle reorgs?
If you're indexing the blockchain, you don't want to store an uncle or reorg block data.
- don't index too close to the tip of the chain, as it can happen
- implement a delay when doing
eth_getBlockByNumber
oreth_getBlockReceipt
- keep an eye out for reorgs and how often they happen via the block explorer like https://etherscan.io/blocks_forked and https://polygonscan.com/blocks_forked
Comments
0 comments
Article is closed for comments.