What is chaincode container in Hyperledger Fabric?

只愿长相守 提交于 2020-01-01 05:48:08

问题


Chaincode is already installed in the peer file system. Why does instantiating chaincode start the chaincode container? What is the purpose of the chaincode container?


回答1:


The purpose of the chaincode container is to ensure isolation of the smart contract's execution from the peer itself, so that a smart contract (chaincode) cannot crash or even access the peer because of an error or malicious code. When you instantiate a chaincode, the peer populates a container image with the chaincode and invokes the Docker management API to deploy that image. If the container isn't running, it will start a new one. Once running, all transactions and proposals received by the peer will be transmitted to that container for execution.




回答2:


The chaincode container runs the smart contract logic. When you instantiate a chaincode, the Init method is simulated and returned to the client for sending to the orderer for creation of a new transaction (init transaction, that binds the chaincode to the channel). That's why the container starts up, if it hasn't been running before.



来源:https://stackoverflow.com/questions/45728688/what-is-chaincode-container-in-hyperledger-fabric

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!