Shubham Chadokar
Shubham Chadokar

Reputation: 2773

What is the difference between "start the chaincode" and "install the chaincode"? -- Hyperledger Fabric

I was following the documentation to run the GO chaincode in fabric network. Chaincode for Developers

For installing the chaincode and running, it instruct to open 3 terminals:
Terminal 1 - Start the network
Terminal 2 - Build & start the chaincode
Terminal 3 - Use the chaincode (install, instantiate, invoke etc in peer)

Terminal 2 :

The chaincode is started with peer and chaincode logs indicating successful registration with the peer.

What exactly terminal 2 is doing as chaincode will install and instantiated in terminal 3?
What is the meaning of start the chaincode and chaincode registration with peer?

Thanks!

Upvotes: 1

Views: 167

Answers (1)

Harshit
Harshit

Reputation: 905

In "dev mode" chaincode is built and started by us as a user, where normally it's the peer who starts and maintains the chaincode. So in the second terminal, we are building the chaincode on our own by running :

go build

whereas, you are right if we run peer chaincode instantiate peer builds the chaincode on its own but not in this case as we build it.

Moreover, we set the properties in the second terminal for use during chaincode install and instantiate as the chaincode has not yet been associated with any channel by running,

CORE_PEER_ADDRESS=peer:7052 CORE_CHAINCODE_ID_NAME=mycc:0 ./sacc

But yeah they have mentioned

Even though you are in --peer-chaincodedev mode, you still have to install the chaincode so the life-cycle system chaincode can go through its checks normally. This requirement may be removed in future when in --peer-chaincodedev mode.

Lets hope its soon :)

Upvotes: 1

Related Questions