You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 30, 2018. It is now read-only.
Binh Q Nguyen edited this page May 23, 2016
·
6 revisions
Issue #?
Hyperledger Fabric transaction is a chaincode function invocation, which typically reads some variables, performs some logic, then writes the variables back to persistent store, part of the ledger. The variables are part of the state key-value pairs, isolated per chaincode. If a chaincode is none deterministic (malicious code or bugs), the resulting variables on each peer might be different, which would cause the block to be rejected from committing to the blockchain.
This proposal (suggested by @chetmurthy) outlines a method to ensure that accepted transactions are deterministic and verifiable thereafter.
Let's call the variables that a chaincode reads, during a transaction, a "readset", and likewise, the variables that a chaincode writes, a "writeset". Let's also make sure that each variable keeps monotonically increased versions; that is, every time a variable is updated, its version is increased.
When a transaction T arrives at a peer, the peer prepares T as follow:
Verify T transactor's signature
Speculatively execute T. This execution holds the result in a temporary buffer as implemented now. The peer collects the readset and the writeset, including the versions
Set T' = T + readset + writeset
Send T' to consensus
Consensus validates T' and if agreed, include it in block
Peers applies T' from the block
T' is recorded on blockchain if it is committed. This will include the necessary data for post verification without requiring replaying the transactions from genesis or from last checkpoint snapshot.