2

In my application, I am using events/logs to capture and display information. So, to decrease the response time, I am returning the result as soon as the block is mined and not waiting for 5-6 block confirmations. As waiting for block confirmations will increase the response time.

So can I trust that all transactions in these blocks will be in the main chain?

1 Answer 1

2

So can I trust that all transactions in these blocks will be in the main chain?

In a word (or two): not necessarily :-)

I wrote a quick (dumb) script a while back to scrape data from Etherscan relating to chain reorganisations (i.e. ephemeral chain fork events).

Running the script again, for the last 10 day's worth of blocks, gives:

Forks of length 1: 742
Forks of length 2: 8

I believe that forks of length 3 and 4 have happened in the past.

Although these forks happen often, and blocks get rejected, there's a chance that the same transactions will be present in the block that is ultimately accepted.

3
  • Thank You. I understood that I cannot trust the blocks with 1 confirmation to be in the main chain. I have one more doubt that if the transaction ends on an uncle block then the transactions gets returned back to mempool to be picked by any other block. So can we ensure that no matters what happens, the transaction will always end up in the main chain.
    – krritik
    Commented Feb 21, 2021 at 10:27
  • 1
    Correct - if the block get made an uncle, then the transactions go back into the mempool. However, once they go back into the mempool there's no guarantee that they will be included in a later block (although it's likely they will be). Commented Feb 21, 2021 at 14:48
  • @RichardHorrocks : What happens if the uncle block(s) contain duplicates of transactions already included in the blocks on the main chain? I mean, they must be validated somehow before they're added to the transaction pool each time, I'd guess, right?
    – anotherDev
    Commented Aug 8, 2021 at 10:37

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.