Let we have an ethereum node which is for a watch purposes only (it doesn't create any transactions, just updates it's replica of the whole chain).

To get notifications about top blocks in the chain in most of the Ethereum libraries (especially web3j and EthereumJ) we should write some listener class with some method which will eventually be called. Something like this:

class EthereumListener {
    public void onBlock(Block block) {
        long blockNumber = block.getNumber();

My question is: may I be sure that the block which the listener is being notified is already on the main chain and will not become stale?

In other words: may the block be Uncle? May it be that if I later ask client for the block with this number I get a block with different content because Uncle block was replaced by the valid one in the client's replica?

If the answer is 'Yes' my second question is: does library (web3j or EthereumJ) notify me through the onBlock method about the new valid block when it replaces an Uncle one?

In other words: may blockNumber be the same between different invocations of onBlock method?

1 Answer 1


No, it is not sure a block will not be replaced by another one. The more confirmations a block has, the less likely it wil be replaced. You will never have a 100% confidence it will not be replaced, but asking for several confirmation you can have a really high confidence, in practice it will be pretty close to 100%.

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.