export FABRIC_CFG_PATH=$GOPATH/src/github.com/hyperledger/fabric/demo/deploy
rm -fr config/*
rm -fr crypto-config/*
cryptogen generate --config=./crypto-config.yaml
configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./config/genesis.block
configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./config/examplechannel.tx -channelID examplechannel
configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./config/Org1MSPanchors.tx -channelID examplechannel -asOrg Org1MSP
configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./config/Org2MSPanchors.tx -channelID examplechannel -asOrg Org2MSP
peer channel create -o orderer.example.com:7050 -c examplechannel -f /etc/hyperledger/config/examplechannel.tx
peer channel join -b examplechannel.block
peer channel update -o orderer.example.com:7050 -c examplechannel -f /etc/hyperledger/config/Org1MSPanchors.tx
peer chaincode install -n examplechaincode -v 1.0.0 -l golang -p github.com/chaincode/examplechaincode
peer chaincode instantiate -o orderer.example.com:7050 -C examplechannel -n examplechaincode -l golang -v 1.0.0 -c '{"Args":["init"]}'
peer chaincode invoke -C examplechannel -n examplechaincode -c '{"Args":["set", "example1", "user222xxx"]}'
peer chaincode install -n examplechaincode -v 1.0.2 -l golang -p github.com/chaincode/examplechaincode
peer chaincode upgrade -C examplechannel -n examplechaincode -v 1.0.2 -c '{"Args":[""]}'
peer chaincode invoke -n examplechaincode -c '{"Args":["set", "vvv", "{67789}"]}' -C examplechannel
peer chaincode invoke -n examplechaincode -c '{"Args":["set", "example1", "1233user xxx"]}' -C examplechannel
peer chaincode query -n examplechaincode -c '{"Args":["get", "vvv"]}' -C examplechannel
peer chaincode query -n examplechaincode -c '{"Args":["getHistory", "567876545678"]}' -C examplechannel
peer chaincode query -n examplechaincode -C examplechannel -c '{"Args":["get", "example1"]}'