what is read set and write set in Hyperledger Fabric 1.0?

Viewed 1796

I am confused to understand what is read and write set in fabric 1.0, Kindly someone explain by taking example if possible.

2 Answers

Read and write set is generated by Endorser and used by committer to validate the transaction.

Data in fabric word-state is stored in key-value pair. Whenever committer commit(insert/update/delete) a transaction in world-state , it also generates a version of this key-value pair and insert. Example :

  key="K1", value="V1, version="111"
  key="K2", value="V2, version="112"

In current fabric version, height of the transaction is used as the latest version for all the keys modified by the transaction.

Endorser Generate read-write sets. Read-set contain the key=,value=,version= of the pair which are going to be affected by current transaction (Before committing). write-set contains the new value(s) for above key(s) (without version as version is generated by committer).

Committer before committing the transaction , uses the read set portion of the read-write set for checking the validity of a transaction and the write set portion of the read-write set for updating the values of the affected keys and also generates a new version for this key-value-pair.

Related