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.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)