Ubuntu 22.04 LTS
root@orderer:~# vi /etc/hosts
192.168.0.209 orderer.example.com
192.168.0.237 peer0.org1.example.com
192.168.0.35 peer0.org2.example.com
192.168.0.148 peer0.org3.example.com
root@orderer:~# apt update
root@orderer:~# apt -y install apt-transport-https ca-certificates curl software-properties-common
root@orderer:~# curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
root@orderer:~# add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
root@orderer:~# apt -y update
root@orderer:~# apt -y install docker-ce
root@orderer:~# service docker start
root@orderer:~# systemctl enable docker
root@orderer:~# curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
root@orderer:~# chmod +x /usr/local/bin/docker-compose
root@orderer:~# docker-compose -v
docker-compose version 1.29.2, build 5becea4c
root@orderer:~# wget https://golang.google.cn/dl/go1.16.14.linux-amd64.tar.gz
root@orderer:~# tar zxf go1.16.14.linux-amd64.tar.gz
root@orderer:~# mv go /usr/local/
root@orderer:~# vim /etc/profile
export GOPATH=~/Go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
export GO111MODULE=on
export GOPROXY=https://goproxy.cn,direct
root@orderer:~# source /etc/profile
root@orderer:~# go version
go version go1.16.14 linux/amd64
root@orderer:~# apt -y install git
root@orderer:~# git clone -b v2.2.1 https://github.com/hyperledger/fabric.git #这里可能中断,请多重复几次
root@orderer:~# cd fabric/scripts/
root@orderer:~/fabric/scripts # /.bootstrap.sh #这里可能中断,请多重复几次
root@orderer:~/fabric/scripts # cp -r fabric-samples/ ~/
root@orderer:~# cp fabric-samples/bin/* /usr/local/bin/
root@orderer:~# vim /etc/profile
export PATH=~/fabric-samples/bin:$PATH
root@orderer:~# source /etc/profile
root@orderer:~# mkdir hyperledger
root@orderer:~# mkdir hyperledger/multinodes/
root@orderer:~# cd hyperledger/multinodes/
root@orderer:~/hyperledger/multinodes# cryptogen showtemplate > crypto-config.yaml
root@orderer:~/hyperledger/multinodes# vim crypto-config.yaml
OrdererOrgs:
- Name: Orderer
Domain: example.com
EnableNodeOUs: true
Specs:
- Hostname: orderer
PeerOrgs:
- Name: org1
Domain: org1.example.com
EnableNodeOUs: true
Template:
Count: 1
Users:
Count: 1
- Name: org2
Domain: org2.example.com
EnableNodeOUs: true
Template:
Count: 1
Users:
Count: 1
- Name: org3
Domain: org3.example.com
EnableNodeOUs: true
Template:
Count: 1
Users:
Count: 1
root@orderer:~/hyperledger/multinodes # cryptogen generate --config=crypto-config.yaml
org1.example.com
org2.example.com
org3.example.com
root@org1:~# mkdir hyperledger
root@org1:~# mkdir hyperledger/multinodes/
root@org2:~# mkdir hyperledger
root@org2:~# mkdir hyperledger/multinodes/
root@org3:~# mkdir hyperledger
root@org3:~# mkdir hyperledger/multinodes/
root@orderer:~/hyperledger/multinodes # scp -r ./crypto-config [email protected]:~/hyperledger/multinodes/
root@orderer:~/hyperledger/multinodes # scp -r ./crypto-config [email protected]:~/hyperledger/multinodes/
root@orderer:~/hyperledger/multinodes # scp -r ./crypto-config [email protected]:~/hyperledger/multinodes/
root@orderer:~/hyperledger/multinodes # vi /configtx.yaml
Organizations:
- &OrdererOrg
Name: OrdererOrg
ID: OrdererMSP
MSPDir: ./crypto-config/ordererOrganizations/example.com/msp
Policies:
Readers:
Type: Signature
Rule: "OR('OrdererMSP.member')"
Writers:
Type: Signature
Rule: "OR('OrdererMSP.member')"
Admins:
Type: Signature
Rule: "OR('OrdererMSP.admin')"
OrdererEndpoints:
- orderer.example.com:7050
- &Org1
Name: Org1MSP
ID: Org1MSP
MSPDir: ./crypto-config/peerOrganizations/org1.example.com/msp
Policies:
Readers:
Type: Signature
Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')"
Writers:
Type: Signature
Rule: "OR('Org1MSP.admin', 'Org1MSP.client')"
Admins:
Type: Signature
Rule: "OR('Org1MSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('Org1MSP.peer')"
AnchorPeers:
- Host: peer0.org1.example.com
Port: 7051
- &Org2
Name: Org2MSP
ID: Org2MSP
MSPDir: ./crypto-config/peerOrganizations/org2.example.com/msp
Policies:
Readers:
Type: Signature
Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')"
Writers:
Type: Signature
Rule: "OR('Org2MSP.admin', 'Org2MSP.client')"
Admins:
Type: Signature
Rule: "OR('Org2MSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('Org2MSP.peer')"
AnchorPeers:
- Host: peer0.org2.rainpt.com
Port: 8051
- &Org3
Name: Org3MSP
ID: Org3MSP
MSPDir: ./crypto-config/peerOrganizations/org3.example.com/msp
Policies:
Readers:
Type: Signature
Rule: "OR('Org3MSP.admin', 'Org3MSP.peer', 'Org3MSP.client')"
Writers:
Type: Signature
Rule: "OR('Org3MSP.admin', 'Org3MSP.client')"
Admins:
Type: Signature
Rule: "OR('Org3MSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('Org3MSP.peer')"
AnchorPeers:
- Host: peer0.org3.rainpt.com
Port: 9051
Capabilities:
Channel: &ChannelCapabilities
V2_0: true
Orderer: &OrdererCapabilities
V2_0: true
Application: &ApplicationCapabilities
V2_0: true
Application: &ApplicationDefaults
Organizations:
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
LifecycleEndorsement:
Type: ImplicitMeta
Rule: "MAJORITY Endorsement"
Endorsement:
Type: ImplicitMeta
Rule: "MAJORITY Endorsement"
Capabilities:
<<: *ApplicationCapabilities
Orderer: &OrdererDefaults
OrdererType: solo
Addresses:
- orderer.example.com:7050
EtcdRaft:
Consenters:
- Host: orderer.example.com
Port: 7050
ClientTLSCert: ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
ServerTLSCert: ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
BatchTimeout: 2s
BatchSize:
MaxMessageCount: 10
AbsoluteMaxBytes: 99 MB
PreferredMaxBytes: 512 KB
Organizations:
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
BlockValidation:
Type: ImplicitMeta
Rule: "ANY Writers"
Channel: &ChannelDefaults
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
Capabilities:
<<: *ChannelCapabilities
Profiles:
ThreeOrgsOrdererGenesis:
<<: *ChannelDefaults
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Capabilities:
<<: *OrdererCapabilities
Consortiums:
SampleConsortium:
Organizations:
- *Org1
- *Org2
- *Org3
ThreeOrgsChannel:
Consortium: SampleConsortium
<<: *ChannelDefaults
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
- *Org3
Capabilities:
<<: *ApplicationCapabilities
root@orderer:~/hyperledger/multinodes # configtxgen -profile ThreeOrgsOrdererGenesis -channelID fabric-channel -outputBlock ./channel-artifacts/genesis.block
2023-01-07 23:59:46.178 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2023-01-07 23:59:46.198 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: solo
2023-01-07 23:59:46.198 CST [common.tools.configtxgen.localconfig] Load -> INFO 003 Loaded configuration: /root/hyperledger/multinodes/configtx.yaml
2023-01-07 23:59:46.200 CST [common.tools.configtxgen] doOutputBlock -> INFO 004 Generating genesis block
2023-01-07 23:59:46.200 CST [common.tools.configtxgen] doOutputBlock -> INFO 005 Writing genesis block
root@orderer:~/hyperledger/multinodes # configtxgen -profile ThreeOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID mychannel
2023-01-08 00:00:03.256 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2023-01-08 00:00:03.274 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/hyperledger/multinodes/configtx.yaml
2023-01-08 00:00:03.274 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 003 Generating new channel configtx
2023-01-08 00:00:03.277 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 004 Writing new channel tx
root@orderer:~/hyperledger/multinodes # configtxgen -profile ThreeOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP
2023-01-08 00:00:20.598 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2023-01-08 00:00:20.617 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/hyperledger/multinodes/configtx.yaml
2023-01-08 00:00:20.617 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
2023-01-08 00:00:20.619 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 004 Writing anchor peer update
root@orderer:~/hyperledger/multinodes # configtxgen -profile ThreeOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP
2023-01-08 00:00:35.567 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2023-01-08 00:00:35.586 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/hyperledger/multinodes/configtx.yaml
2023-01-08 00:00:35.586 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
2023-01-08 00:00:35.588 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 004 Writing anchor peer update
root@orderer:~/hyperledger/multinodes # configtxgen -profile ThreeOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org3MSPanchors.tx -channelID mychannel -asOrg Org3MSP
2023-01-08 00:01:02.890 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2023-01-08 00:01:02.910 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/hyperledger/multinodes/configtx.yaml
2023-01-08 00:01:02.910 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
2023-01-08 00:01:02.912 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 004 Writing anchor peer update
root@orderer:~/hyperledger/multinodes # scp -r ./channel-artifacts [email protected]:~/hyperledger/multinodes/
root@orderer:~/hyperledger/multinodes # scp -r ./channel-artifacts [email protected]:~/hyperledger/multinodes/
root@orderer:~/hyperledger/multinodes # scp -r ./channel-artifacts [email protected]:~/hyperledger/multinodes/
root@orderer:~/hyperledger/multinodes # vi docker-compose.yaml
version: '2'
services:
orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer:2.2
environment:
- FABRIC_LOGGING_SPEC=INFO
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_LISTENPORT=7050
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
- ORDERER_GENERAL_TLS_ENABLED=true
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
- ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1
- ORDERER_KAFKA_VERBOSE=true
- ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
volumes:
- ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
ports:
- 7050:7050
extra_hosts:
- "orderer.example.com:192.168.0.209"
- "peer0.org1.example.com:192.168.0.237"
- "peer0.org2.example.com:192.168.0.35"
- "peer0.org3.example.com:192.168.0.148"
root@org1:~/hyperledger/multinodes # vi docker-compose.yaml
version: '2'
services:
couchdb0.org1.example.com:
container_name: couchdb0.org1.example.com
image: couchdb:3.1
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=adminpw
ports:
- 5984:5984
peer0.org1.example.com:
container_name: peer0.org1.example.com
image: hyperledger/fabric-peer:2.2
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_LISTENADDRESS=0.0.0.0:7051
- CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
- CORE_CHAINCODE_EXECUTETIMEOUT=300s
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0.org1.example.com:5984
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=adminpw
depends_on:
- couchdb0.org1.example.com
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 7051:7051
- 7052:7052
- 7053:7053
extra_hosts:
- "orderer.example.com:192.168.0.209"
- "peer0.org1.example.com:192.168.0.237"
- "peer0.org2.example.com:192.168.0.35"
- "peer0.org3.example.com:192.168.0.148"
cli:
container_name: cli
image: hyperledger/fabric-tools:2.2
tty: true
stdin_open: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric-cluster/chaincode/go
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
extra_hosts:
- "orderer.example.com:192.168.0.209"
- "peer0.org1.example.com:192.168.0.237"
- "peer0.org2.example.com:192.168.0.35"
- "peer0.org3.example.com:192.168.0.148"
root@org2:~/hyperledger/multinodes # vi docker-compose.yaml
version: '2'
services:
couchdb0.org2.example.com:
container_name: couchdb0.org2.example.com
image: couchdb:3.1
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=adminpw
ports:
- 5984:5984
peer0.org2.example.com:
container_name: peer0.org2.example.com
image: hyperledger/fabric-peer:2.2
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.org2.example.com
- CORE_PEER_ADDRESS=peer0.org2.example.com:7051
- CORE_PEER_LISTENADDRESS=0.0.0.0:7051
- CORE_PEER_CHAINCODEADDRESS=peer0.org2.example.com:7052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
- CORE_CHAINCODE_EXECUTETIMEOUT=300s
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0.org2.example.com:5984
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=adminpw
depends_on:
- couchdb0.org2.example.com
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 7051:7051
- 7052:7052
- 7053:7053
extra_hosts:
- "orderer.example.com:192.168.0.209"
- "peer0.org1.example.com:192.168.0.237"
- "peer0.org2.example.com:192.168.0.35"
- "peer0.org3.example.com:192.168.0.148"
cli:
container_name: cli
image: hyperledger/fabric-tools:2.2
tty: true
stdin_open: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric-cluster/chaincode/go
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
extra_hosts:
- "orderer.example.com:192.168.0.209"
- "peer0.org1.example.com:192.168.0.237"
- "peer0.org2.example.com:192.168.0.35"
- "peer0.org3.example.com:192.168.0.148"
root@org3:~/hyperledger/multinodes # vi docker-compose.yaml
version: '2'
services:
couchdb0.org3.example.com:
container_name: couchdb0.org3.example.com
image: couchdb:3.1
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=adminpw
ports:
- 5984:5984
peer0.org3.example.com:
container_name: peer0.org3.example.com
image: hyperledger/fabric-peer:2.2
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.org3.example.com
- CORE_PEER_ADDRESS=peer0.org3.example.com:7051
- CORE_PEER_LISTENADDRESS=0.0.0.0:7051
- CORE_PEER_CHAINCODEADDRESS=peer0.org3.example.com:7052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org3.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.example.com:7051
- CORE_PEER_LOCALMSPID=Org3MSP
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
- CORE_CHAINCODE_EXECUTETIMEOUT=300s
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0.org3.example.com:5984
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=adminpw
depends_on:
- couchdb0.org3.example.com
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/msp:/etc/hyperledger/fabric/msp
- ./crypto-config/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 7051:7051
- 7052:7052
- 7053:7053
extra_hosts:
- "orderer.example.com:192.168.0.209"
- "peer0.org1.example.com:192.168.0.237"
- "peer0.org2.example.com:192.168.0.35"
- "peer0.org3.example.com:192.168.0.148"
cli:
container_name: cli
image: hyperledger/fabric-tools:2.2
tty: true
stdin_open: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.org3.example.com:7051
- CORE_PEER_LOCALMSPID=Org3MSP
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/users/[email protected]/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric-cluster/chaincode/go
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
extra_hosts:
- "orderer.example.com:192.168.0.209"
- "peer0.org1.example.com:192.168.0.237"
- "peer0.org2.example.com:192.168.0.35"
- "peer0.org3.example.com:192.168.0.148"
root@orderer:~/hyperledger/multinodes # docker-compose up -d
Creating network "multinodes_default" with the default driver
Creating orderer.example.com ... done
root@org1:~/hyperledger/multinodes # docker-compose up -d
Creating network "multinodes_default" with the default driver
Creating couchdb0.org1.example.com ... done
Creating cli ... done
Creating peer0.org1.example.com ... done
root@org2:~/hyperledger/multinodes # docker-compose up -d
Creating network "multinodes_default" with the default driver
Creating cli ... done
Creating couchdb0.org2.example.com ... done
Creating peer0.org2.example.com ... done
root@org3:~/hyperledger/multinodes # docker-compose up -d
Creating network "multinodes_default" with the default driver
Creating cli ... done
Creating couchdb0.org3.example.com ... done
Creating peer0.org3.example.com ... done
root@org1:~/hyperledger/multinodes # docker exec -it cli bash
bash-5.1 # peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2023-01-07 16:09:00.580 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-01-07 16:09:00.625 UTC [cli.common] readBlock -> INFO 002 Received block: 0
bash-5.1 # ls
channel-artifacts crypto mychannel.block
将通道文件 mychannel.block 拷贝到宿主机及其他节点的容器
root@org1:~/hyperledger/multinodes # docker cp cli:/opt/gopath/src/github.com/hyperledger/fabric/peer/mychannel.block ./
root@org1:~/hyperledger/multinodes # scp mychannel.block [email protected]:~/hyperledger/multinodes/
root@org1:~/hyperledger/multinodes # scp mychannel.block [email protected]:~/hyperledger/multinodes/
root@org2:~/hyperledger/multinodes # docker cp mychannel.block cli:/opt/gopath/src/github.com/hyperledger/fabric/peer/
root@org3:~/hyperledger/multinodes # docker cp mychannel.block cli:/opt/gopath/src/github.com/hyperledger/fabric/peer/
org1
root@org1:~/hyperledger/multinodes # docker exec -it cli bash
bash-5.1 # peer channel join -b mychannel.block
2023-01-07 16:10:38.773 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-01-07 16:10:39.131 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
org2
root@org2:~/hyperledger/multinodes # docker exec -it cli bash
bash-5.1 # peer channel join -b mychannel.block
2023-01-07 16:11:02.265 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-01-07 16:11:02.539 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
org3
root@org3:~/hyperledger/multinodes # docker exec -it cli bash
bash-5.1 # peer channel join -b mychannel.block
2023-01-07 16:11:23.195 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-01-07 16:11:23.480 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
org1
bash-5.1 # peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org1MSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2023-01-07 16:11:45.984 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-01-07 16:11:45.996 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
org2
bash-5.1 # peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org2MSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2023-01-07 16:12:17.781 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-01-07 16:12:17.794 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
org3
bash-5.1 # peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org3MSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2023-01-07 16:12:47.808 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-01-07 16:12:47.822 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
root@orderer:~/hyperledger/multinodes # cp -r ~/fabric-samples/chaincode/sacc chaincode/go/
root@orderer:~/hyperledger/multinodes # scp -r /chaincode/go/sacc [email protected]:~/hyperledger/multinodes/chaincode/go
bash-5.1 # cd /opt/gopath/src/github.com/hyperledger/fabric-cluster/chaincode/go/sacc
bash-5.1 # ls
go.mod go.sum sacc.go sacc_test.go vendor
bash-5.1 # go env -w GOPROXY=https://goproxy.cn,direct
bash-5.1 # go env -w GO111MODULE=auto
bash-5.1 # go mod init
go: /opt/gopath/src/github.com/hyperledger/fabric-cluster/chaincode/go/sacc/go.mod already exists
bash-5.1 # go mod vendor
go: downloading github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85
go: downloading github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022
go: downloading github.com/golang/protobuf v1.3.2
go: downloading google.golang.org/grpc v1.23.0
go: downloading golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7
go: downloading google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55
go: downloading golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a
go: downloading golang.org/x/text v0.3.2
bash-5.1 # cd /opt/gopath/src/github.com/hyperledger/fabric/peer
bash-5.1 # peer lifecycle chaincode package sacc.tar.gz \
--path github.com/hyperledger/fabric-cluster/chaincode/go/sacc/ \
--label sacc_1
bash-5.1 # ls
channel-artifacts crypto mychannel.block sacc.tar.gz
root@org1:~/hyperledger/multinodes # docker cp cli:/opt/gopath/src/github.com/hyperledger/fabric/peer/sacc.tar.gz ./
root@org1:~/hyperledger/multinodes # scp sacc.tar.gz [email protected]:~/hyperledger/multinodes
root@org1:~/hyperledger/multinodes # scp sacc.tar.gz [email protected]:~/hyperledger/multinodes
root@org2:~/hyperledger/multinodes # docker cp ~/hyperledger/multinodes/sacc.tar.gz cli:/opt/gopath/src/github.com/hyperledger/fabric/peer
root@org3:~/hyperledger/multinodes # docker cp ~/hyperledger/multinodes/sacc.tar.gz cli:/opt/gopath/src/github.com/hyperledger/fabric/peer
org1
root@org1:~/hyperledger/multinodes# docker exec -it cli bash
bash-5.1# peer lifecycle chaincode install sacc.tar.gz
2021-11-04 05:44:44.537 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:<status:200 payload:"\nGsacc_1:2791ff83074c654ab40b864ba03f6bb2710439d720adc883c26438212de8d259\022\006sacc_1" >
2021-11-04 05:44:44.537 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: sacc_1:2791ff83074c654ab40b864ba03f6bb2710439d720adc883c26438212de8d259
org2
root@org2:~/hyperledger/multinodes# docker exec -it cli bash
bash-5.1# peer lifecycle chaincode install sacc.tar.gz
2021-11-04 05:44:44.537 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:<status:200 payload:"\nGsacc_1:2791ff83074c654ab40b864ba03f6bb2710439d720adc883c26438212de8d259\022\006sacc_1" >
2021-11-04 05:44:44.537 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: sacc_1:2791ff83074c654ab40b864ba03f6bb2710439d720adc883c26438212de8d259
org3
root@org3:~/hyperledger/multinodes# docker exec -it cli bash
bash-5.1# peer lifecycle chaincode install sacc.tar.gz
2021-11-04 05:44:44.537 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:<status:200 payload:"\nGsacc_1:2791ff83074c654ab40b864ba03f6bb2710439d720adc883c26438212de8d259\022\006sacc_1" >
2021-11-04 05:44:44.537 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: sacc_1:2791ff83074c654ab40b864ba03f6bb2710439d720adc883c26438212de8d259
org1
bash-5.1 # peer lifecycle chaincode approveformyorg --channelID mychannel --name sacc --version 1.0 --init-required --package-id sacc_1:2791ff83074c654ab40b864ba03f6bb2710439d720adc883c26438212de8d259 --sequence 1 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2023-01-07 16:24:16.758 UTC [cli.lifecycle.chaincode] setOrdererClient -> INFO 001 Retrieved channel (mychannel) orderer endpoint: orderer.example.com:7050
2023-01-07 16:24:19.069 UTC [chaincodeCmd] ClientWait -> INFO 002 txid [b51ade68f0945dae49450e2de531a9355b9e95aaeb799fdb822f8165aca406c9] committed with status (VALID) at peer0.org1.example.com:7051
org2
bash-5.1 # peer lifecycle chaincode approveformyorg --channelID mychannel --name sacc --version 1.0 --init-required --package-id sacc_1:2791ff83074c654ab40b864ba03f6bb2710439d720adc883c26438212de8d259 --sequence 1 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2023-01-07 16:24:51.265 UTC [cli.lifecycle.chaincode] setOrdererClient -> INFO 001 Retrieved channel (mychannel) orderer endpoint: orderer.example.com:7050
2023-01-07 16:24:53.486 UTC [chaincodeCmd] ClientWait -> INFO 002 txid [3600b0e40643fb695572fd862c18e15fad7ae5441d6db22ade44c41fb296dc52] committed with status (VALID) at peer0.org2.example.com:7051
org3
bash-5.1 # peer lifecycle chaincode approveformyorg --channelID mychannel --name sacc --version 1.0 --init-required --package-id sacc_1:2791ff83074c654ab40b864ba03f6bb2710439d720adc883c26438212de8d259 --sequence 1 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2023-01-07 16:25:10.224 UTC [cli.lifecycle.chaincode] setOrdererClient -> INFO 001 Retrieved channel (mychannel) orderer endpoint: orderer.example.com:7050
2023-01-07 16:25:12.448 UTC [chaincodeCmd] ClientWait -> INFO 002 txid [f62488656bb49be52068f63f83ea428cfc601036d5f304abe425678325f8f82f] committed with status (VALID) at peer0.org3.example.com:7051
org1
bash-5.1 # peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name sacc --version 1.0 --init-required --sequence 1 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --output json
{
"approvals": {
"Org1MSP": true,
"Org2MSP": true,
"Org3MSP": true
}
}
org1
bash-5.1 # peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name sacc --version 1.0 --init-required --sequence 1 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --output json
{
"approvals": {
"Org1MSP": true,
"Org2MSP": true,
"Org3MSP": true
}
}
org2
bash-5.1 # peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name sacc --version 1.0 --init-required --sequence 1 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --output json
{
"approvals": {
"Org1MSP": true,
"Org2MSP": true,
"Org3MSP": true
}
}
org3
bash-5.1 # peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name sacc --version 1.0 --init-required --sequence 1 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --output json
{
"approvals": {
"Org1MSP": true,
"Org2MSP": true,
"Org3MSP": true
}
}
org1
bash-5.1# peer lifecycle chaincode commit -o orderer.example.com:7050 --channelID mychannel --name sacc --version 1.0 --sequence 1 --init-required --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt --peerAddresses peer0.org3.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt
2023-01-07 16:26:19.167 UTC [chaincodeCmd] ClientWait -> INFO 001 txid [db855b6edceb89a67e7e4a5f6415da773c20c1d9e926820be3cd2716b11ecc97] committed with status (VALID) at peer0.org2.example.com:7051
2023-01-07 16:26:19.169 UTC [chaincodeCmd] ClientWait -> INFO 002 txid [db855b6edceb89a67e7e4a5f6415da773c20c1d9e926820be3cd2716b11ecc97] committed with status (VALID) at peer0.org3.example.com:7051
2023-01-07 16:26:19.243 UTC [chaincodeCmd] ClientWait -> INFO 003 txid [db855b6edceb89a67e7e4a5f6415da773c20c1d9e926820be3cd2716b11ecc97] committed with status (VALID) at peer0.org1.example.com:7051
bash-5.1# peer chaincode invoke -o orderer.example.com:7050 --isInit --ordererTLSHostnameOverride orderer.example.com --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n sacc --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt --peerAddresses peer0.org3.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt -c '{"Args":["a","bb"]}'
2023-01-07 16:27:12.548 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200
bash-5.1# peer chaincode query -C mychannel -n sacc -c '{"Args":["query","a"]}'
bb
bash-5.1# peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n sacc --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt --peerAddresses peer0.org3.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt -c '{"Args":["set","a","cc"]}'
2023-01-07 16:27:38.085 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 payload:"cc"
bash-5.1# peer chaincode query -C mychannel -n sacc -c '{"Args":["query","a"]}'
cc