From abb96ab41e70a47a53da9f54f1823ede0e13ad22 Mon Sep 17 00:00:00 2001 From: Srinivasan Muralidharan Date: Thu, 4 May 2017 16:35:20 -0400 Subject: [PATCH] [FAB-3671] chaincodedev mode doc needs updating Just a doc update for peer-chaincode mode. [ci skip] Change-Id: Id622e78ec5b871870f5599176a18fe4d335063d1 Signed-off-by: Srinivasan Muralidharan --- docs/source/peer-chaincode-devmode.rst | 31 ++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/docs/source/peer-chaincode-devmode.rst b/docs/source/peer-chaincode-devmode.rst index a615cb1295a..a613386c503 100644 --- a/docs/source/peer-chaincode-devmode.rst +++ b/docs/source/peer-chaincode-devmode.rst @@ -11,6 +11,8 @@ of the box” - with one exception: we create two channels instead of using the default ``testchainid`` channel to show how the single running instance can be accessed from multiple channels. +All commands are executed from the ``fabric`` folder. + Start the orderer ----------------- @@ -34,10 +36,18 @@ MSP. The ``--peer-chaincodedev=true`` puts it in “dev” mode. Create channels ch1 and ch2 --------------------------- +Generate the transactions for creating the channels using ``configtxgen`` tool. + +:: + configtxgen -channelID ch1 -outputCreateChannelTx ch1.tx -profile SampleSingleMSPChannel + configtxgen -channelID ch2 -outputCreateChannelTx ch2.tx -profile SampleSingleMSPChannel + +where SampleSingleMSPChannel is a channel profile in ``sampleconfig/configtx.yaml`` + :: - peer channel create -o 127.0.0.1:7050 -c ch1 - peer channel create -o 127.0.0.1:7050 -c ch2 + peer channel create -o 127.0.0.1:7050 -c ch1 -f ch1.tx + peer channel create -o 127.0.0.1:7050 -c ch2 -f ch2.tx Above assumes orderer is reachable on ``127.0.0.1:7050``. The orderer now is tracking channels ch1 and ch2 for the default configuration. @@ -58,12 +68,23 @@ Start the chaincode go build CORE_CHAINCODE_LOGLEVEL=debug CORE_PEER_ADDRESS=127.0.0.1:7051 CORE_CHAINCODE_ID_NAME=mycc:0 ./chaincode_example02 -The chaincode is started with peer and chaincode logs showing it got -registered successfully with the peer. +The chaincode is started with peer and chaincode logs indicating successful registration with the peer. +Note that at this stage the chaincode is not associated with any channel. This is done in subsequent steps +using the ``instantiate`` command. Use the chaincode ----------------- +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. + +:: + + peer chaincode install -n mycc -v 0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 + +Once installed, the chaincode is ready to be instantiated. + :: peer chaincode instantiate -n mycc -v 0 -c '{"Args":["init","a","100","b","200"]}' -o 127.0.0.1:7050 -C ch1 @@ -81,6 +102,8 @@ committed. The above invoke the chaincode over the two channels. +Finally, query the chaincode on the two channels. + :: peer chaincode query -n mycc -c '{"Args":["query","a"]}' -o 127.0.0.1:7050 -C ch1