1

I have been reading about blockchain forks and the longest chain situations and I cannot really understand what is going to happend in the situation when the transacton were included in both accepted AND rejected blocks? If transactions in rejected block are going back to the mempool, does it means that there will be blocks with duplicated transactions? I have drawed something out for better understanding of this: https://imgur.com/a/3ViIu I guess I`m missing something fundamental here. Thanks in advance!

0

Firstly, there is not only a single mempool, every node maintains its own mempool based on what transactions and blocks it has seen. Since these mempools will generally match pretty well, this fact is sometimes abbreviated by talking about "the mempool" and meaning the general body of unconfirmed transactions most nodes are aware of. If we were able to guarantee that everyone had the same mempool, we wouldn't need a blockchain. The main purpose of the blockchain is to give a decision between different versions of the mempool.

Secondly, from the perspective of each chain tip, the other chain tip is invalid and is treated as if it doesn't exist. Adding the observation that each node has its own mempool and assuming that the network is well-connected, you can find out the state of each node in regard to the chain tip they follow by acting as if the other chain doesn't exist.

enter image description here

Regarding your image:

  • A node whose chain tip is C has TX10 in the mempool while TX3 and TX4 are confirmed.
  • A node whose chain tip is D considers TX4 and TX10 to be confirmed and has TX3 in the mempool.

When block G is discovered, all nodes will reorganize to the lower chain tip DFG. At that point they will roll back to B, add TX14, TX15, TX3, and TX4 to their mempool, then apply block D, removing TX4 and TX10 from the mempool, apply block F, removing TX9 and TX15 from the mempool, and then applying block G, removing TX21 and TX20 from the mempool. TX3 remains in the mempool, because it is not confirmed in the lower chain yet.

  • Wow,that was one really great explanation! Thank you! – Sivich Sep 18 '17 at 8:08
0

Tx message Rule# 8: https://en.bitcoin.it/wiki/Protocol_rules Reject if we already have matching tx in the pool, or in a block in the main branch.

  • Thanks for the answer! So if I understand it correctly the rejected blocks(and all the transactions in that block) are going back to the mempool. Then, if someone trying to include the transaction that is already in the main branche(accepted branche) that transaction will be rejected? Is that correct? What is going to happend to rejected transaction(it will be just deleted from mempool)? – Sivich Sep 7 '17 at 11:58
  • 1)Yes, if someone tries to spend any transaction from main chain, it would be rejected. That's what double spending is. If a block is rejected, (i am assuming it is rejected according to the block protocols attached above, and you are not referring to side chain), transactions will stay in mem pool, they would never get added to the blockchain. 2) If transaction was invalid acc. to protocols, it will never make to pool. I hope you get that, everyone is maintaining their own chains and list of transactions. It is not shared and could be asynchronous wrt other nodes at a given period of time – Piyush Chittara Sep 7 '17 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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