Search code examples
data-structuresblockchainhyperledgersystem-designhyperledger-sawtooth

How is it possible for a '(Hyperledger Sawtooth) transaction to exist in multiple blocks at a time'?


Below statement is from this documentation.

Transaction receipts will only be stored in this off-chain store and will not be included in the block. Note that because a transaction may exist in multiple blocks at a time, the transaction receipt is stored by both transaction id and block state root hash.

Question:

A transaction is unique (in a batch), and is supposed to be included in ONLY ONE block, upon arriving at consensus. And this process can happen, ONLY ONCE per transaction. If, that's the case, how is it possible for the transaction to 'exist in multiple blocks at a time'?


Solution

  • A transaction usually is in only one block, with copies of the same block at all Sawtooth validator nodes.

    However, if the blockchain "forks", then there are two possibly conflicting versions of the blockchain state and a transaction may appear in only one or the other blockchain or in both in a different order and different blocks.

    A fork may occur for multiple reasons. A common reason is because nodes lose communication for a long period of time, so the network becomes partitioned and therefore the nodes become partitioned. When communication is restored, the blockchain resolves itself and one of the blockchains is chosen as the "correct" blockchain and all nodes sync to the "correct" (or chosen) blockchian.