Thursday, June 14, 2018

Hyperledger Fabric operation

Fabric operation sequence

1. Create channel
2. Peer join channel
3. Install Chaincode
4. Instantiate Chaincode

Create channel

1. an orderer endpoint and its ca certificate
2. channel name
3. channel transaction file
4. tls flag
5. timeout value
6. peer command, set as environment variable
7. peer information

Example:
peer channel create -o {{ cliorderer.name }}:7050 -c firstchannel
  -f /etc/hyperledger/allorgs/keyfiles/firstchannel.tx
  --tls true --timeout $TIMEOUT
  --cafile msp/tlscacerts/tlsca.{{ cliorderer.org }}-cert.pem

Instantiate chaincode (Per channel)

1. an orderer endpoint and its ca certificate
2. channel name
3. chaincode name and chaincode must be placed at the right location
4. tls flag
5. timeout value
6. version number
7. argument
8. peer information, set as environment variable
9. endorsement policy
peer chaincode instantiate -o {{ cliorderer.name }}:7050 --tls true
  --cafile msp/tlscacerts/tlsca.{{ cliorderer.org }}-cert.pem
  -C firstchannel -n firstchaincode -v 1.0
  -c '{"Args":["init","a", "100", "b","200"]}'
  -P "AND ('{{ orgmembers }}.member')"

Join channel (Per peer)

1. channel block
8. peer information, set as environment variable
peer channel join -b firstchannel.block

Install chaincode (Per peer)

1. chaincode name and version
2. chaincode path in GOPATH src directory, for example: $GOPATH/src/chaincode
3. peer information, set as environment variable
peer chaincode install -n firstchaincode -v 1.0 -p chaincode

No comments:

Post a Comment