Hyperledger Fabric中的系統鏈碼——VSCC, ESCC, LSCC, ESCC, QSCC

系統鏈碼也與用戶鏈碼相同。這些鏈碼內置於peer節點中。

Hyperledger Fabric 中提供了以下系統鏈代碼:

  • LSCC
  • ESCC
  • VSCC
  • CSCC
  • QSCC

1、LSCC: Lifecycle System Chaincode

This system chaincode is used for managing the lifecycle of chaincode. It is used for install, instantiate and update chaincode. When we install chaincode, the process goes through LSCC

2、ESCC: Endorsement System Chaincode

This system chaincode is used to endorse the transaction by digitally signing the response.
The client sends the transaction proposal to invoke chaincode function at the endorsement phase. client sign proposal with his credential and send to endorsement peers. First endorsing peer simulate transaction and verify if the client is authorized to invoke transaction on the channel. The endorsement peer executes the chaincode and creates a read/write(R/W) set. Transaction result includes response value, read set and write set. Then endorsement peer call ESCC and sign this transaction response with peer identity and send back to client.

3、VSCC: Validation System Chaincode

This is used to validate the transaction against its endorsement policy.
A Validation system chaincode evaluates endorsements in the transaction against the endorsement policy specified for the chaincode. If the endorsement policy is not satisfied, then that transaction is marked invalid.
When all peers get a block from the orderer, first they verify orderer's signature on the block. Every block is decoded and all the transaction goes through VSCC before performing MVCC validation. VSCC validates endorsements in the transaction against endorsement policy specified for chaincode. If the endorsement policy fails to satisfy, then the transaction is marked as invalid.
Note: MVCC - Multiversion Concurrency Control — It ensures that the version of keys read by transaction during the endorsement phase is the same as the current state in a local ledger at commit time. It is performed on all valid transactions in the block which is validated by VSCC. If the read set version does not match, the transaction is marked as invalid. MVCC is not chaincode, it's a mechanism to avoid the double-spending problem in Hyperledger fabric

4、CSCC: Configuration system Chaincode

This chaincode is used to manage channel configuration. When we create a channel, update channel, the process goes through the configuration system chaincode. Actually it validates the channel creation/updation.

5、QSCC: Query System Chaincode

This Chaincode runs in all peer and provide ledger API like getTransactionByTransactionID, getBlockByBlockNumber, GetBlockByTxID, GetChainInfo, GetBlockByTxID.

Hope this article will help you. It's basic information about the system chaincodes.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章