Skip to content

Commit

Permalink
[FAB-3671] chaincodedev mode doc needs updating
Browse files Browse the repository at this point in the history
Just a doc update for peer-chaincode mode.
[ci skip]

Change-Id: Id622e78ec5b871870f5599176a18fe4d335063d1
Signed-off-by: Srinivasan Muralidharan <muralisr@us.ibm.com>
  • Loading branch information
Srinivasan Muralidharan committed May 4, 2017
1 parent a48169d commit abb96ab
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions docs/source/peer-chaincode-devmode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------

Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit abb96ab

Please sign in to comment.