0

what will happen to transactions on smaller length chain when peered with longer length chain in private ethereum?

Below is the scenario

Step 1: I have started Ethreum private chain in 2 different machines with same genesis file

Step 2: Both the chains started and the nodes started mining and getting transactions(independently and unique)

Step 3: Mining is stopped in node2 and now it has 1000 blocks. Mining continues in node1 and has 10000 blocks.

Now that the first 1000 blocks of both the chains are independent and have the details of different unique transactions in each.

What will happen if I peer node2 with node 1?

Please help

1 Answer 1

1

Just to make sure: the chains could not connect if they didn't have the same genesis file.

If you now connect the nodes to each other they have to reach consensus about what is the canonical chain. So they start to go through the regular consensus protocol which basically says that the longest (actually heaviest, but doesn't make a difference here) chain is the canonical chain. So as node1 has more blocks its blockchain becomes the canonical chain and node2's blockchain is essentially declared an uncle chain and transactions in those blocks are no longer valid.

Uncle blocks give mining rewards until 7th generation but unfortunately I haven't been able to find definite information about what happens to the 8th and onwards blocks. I assume they just stay in as uncle blocks without reward. Some more info for example here: https://ethereum.stackexchange.com/a/58003/31933

Transactions which end up in uncle blocks are reverted and they become available again in the transaction pool so some node should eventually pick them up and process them again. Of course if they are very old transactions the required preconditions (such as required Ether balance) might not exist anymore so they get reverted as valid non-successful transactions in the canonical chain.

If you had used same transactions in the same order until some point in the beginning the nodes would only discard (make as uncles) blocks starting from the first differentiating block. They wouldn't discard blocks which are the same in both chains (as long as all the blocks before those are also the same).

2
  • Thank you for the response. Now that the transactions get discarded from the lighter/smaller chain. Will those transactions go back into the pool and will be picked by the miners again or will they be just lost and users need to re-transact again? Commented Jul 23, 2019 at 6:21
  • Thanks for the comment. Edited my answer for more information about uncles. Miners should never need to re-transact due to consensus. Commented Jul 23, 2019 at 6:39

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.