simple

command
v0.0.0-...-02ea70c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

README

Go Chaincode simple code

This tutorial will explain how to write Hyperledger Fabric chain code based on Go

Chaincode development example

Writing your own chain code requires an understanding of the Fabric platform, Go. An application is a basic example chain code that creates assets (key-value pairs) on a ledger.

Put

docker exec cli peer chaincode invoke -o orderer.example.com:7050 -C bezant-channel -n simple-go --peerAddresses peer0.bezant.example.com:7051 -c '{"Args":["put", "a", "10"]}'

Get

docker exec cli peer chaincode query -C bezant-channel -n simple-go --peerAddresses peer0.bezant.example.com:7051 -c '{"Args":["get", "a"]}'

PutByWalletAddress

docker exec cli peer chaincode invoke -o orderer.example.com:7050 -C bezant-channel -n simple-go --peerAddresses peer0.bezant.example.com:7051 -c '{"Args":["putByWalletAddress", "10"]}'

Instantiate

docker exec cli peer chaincode install -n simple-go -v 1.0 -p simple-go
docker exec cli2 peer chaincode install -n simple-go -v 1.0 -p simple-go                                                                                            
docker exec cli peer chaincode instantiate -o orderer.example.com:7050 -C bezant-channel -n simple-go -v 1.0 -c '{"Args":["init"]}'               

Upgrade

docker exec cli peer chaincode install -n simple-go -v 1.1 -p simple-go
docker exec cli2 peer chaincode install -n simple-go -v 1.1 -p simple-go                                                                                            
docker exec cli peer chaincode upgrade -o orderer.example.com:7050 -C bezant-channel -n simple-go -v 1.1 -c '{"Args":["init"]}'               

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL