0

On web3.eth.subscribe('newBlockHeaders') I get notification and trying to get last block via saved block number earlier. It was happen with 9559839 block number on mainnet. First, I was get data with 197 transactions, a little bit later with 41 transactions (as it should be). And among these 41 transactions 33 was included in the block that I received earlier.

geth was launched on fast sync mode

1 Answer 1

1

This is quote normal situation, when several blocks with the same number are mined. Here is your block 41 transaction: https://etherscan.io/block/9559839, and here are two other blocks with the same number: (https://etherscan.io/uncle/0x42f5c5c14ffca28215cb3029f3f0d5b83cae3526b3da8bb9775a3ddd7b15c7a6 and https://etherscan.io/uncle/0x151331fd5bd238c6a1544703e8b9719ef85c2f01f00786b4a6aea954ac35d226). One of them is probably the block you saw with 197 transactions.

Different miners are working in parallel on the same block numbers. In case two or more miners manage to find block almost simultaneously, several blocks with the same number start spreading over the network. Each node decides by itself what block to trust and set further. This ambiguous situation remains until block with the next number is mined. In this next block only of only the competing previous blocks is referred as parent (this block becomes the "true" one whose transactions are actually persisted), and the other competing blocks become uncles and their transactions are effectively reverted. Here is the next block that refers one "true" parent and two uncles: https://etherscan.io/block/9559840

2
  • How do I know if a block will become uncle? Feb 27, 2020 at 9:09
  • You cannot know this until it happens. This is up to the miners to decide what blocks to include into main chain. Common practice is to wait for certain number of blocks (known as "confirmations"), say 12, after the block you are considering, and if the block is still in the chain, than you may more or less trust it. Feb 27, 2020 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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