In Hyperledger, read-write sets are used during the endorsement and validation phases of a transaction as follows:
-
Endorsement: When a transaction proposal is submitted, it is processed by peers, which simulate the transaction and generate a read-write set. The read set records the current state data that was read, while the write set specifies changes to be made to the ledger. This read-write set is signed and forms part of the endorsement.
-
Validation: When the transaction is submitted to the ordering service and included in a block, other peers validate it by comparing the read set against the current state of the ledger. If the state matches (i.e., no other transactions modified the data since it was read), the transaction is deemed valid and the write set is applied to update the ledger.
This ensures both consistency and integrity in Hyperledger Fabric's permissioned blockchain network.