During consensus, if two miners mine two different blocks around the same time, then they will broadcast to the network those two different blocks after they have executed the transactions locally and possibly updated their local states.

One of the blocks will end up being in the longest blockchain, so the other block that did not end up in that chain may have updated its owner node's local states. How does that node "undo" the transactions to reset its local states?

1 Answer 1


If a block does not end up in the longest (main) chain, then none of its transactions are on the main chain. So any state changes caused by those transactions never happened on the main chain. They would only be on the short offshoot that contains that block, which gets abandoned. The node that created that block would at some time sync with the main chain and everything would be fine.

  • Can you explain the part about "sync with the main chain and everything would be fine"? How does the node that produced the offshoot block know what the previous states were before the transactions in the offshoot block was applied (since it has already applied those transactions)?
    – platypus
    May 24, 2017 at 23:48
  • There is no local state. At some time, the node that produced the block that did not get into the longest chain will sync and "see" the longest chain (sorry, I do not precisely know how the sync'ing occurs but it will learn about the real longest chain at some later time), so it will append any other blocks it finds to that chain. The final state of the latest block on that chain is the current system state. So it will apply the new transactions to that state. That is the general idea, as per my understanding. I don't know the technical details of the process. May 25, 2017 at 20:08

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.