Tools, FAQ, Tutorials:
BYFN CLI "peer" Command Prefix
How to use BYFN CLI "peer" Command Prefix?
✍: FYIcenter.com
By default, when you run the "peer" command on the BYFN CLI container, it will be executed again the default peer node specified by 4 environment variables:
CORE_PEER_MSPCONFIGPATH=/opt/gopath/.../org1.example.com/users/Admin@org1.example.com/msp CORE_PEER_ADDRESS=peer0.org1.example.com:7051 CORE_PEER_LOCALMSPID=Org1MSP CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/.../org2.example.com/peers/peer0.org1.example.com/tls/ca.crt
If you want to switch to different peer node, you have to re-define those 4 variables, which takes 4 commands to do.
Another quick solution is to prefix the "peer" command to override those variables. For example, the following command list installed chaincodes on peer0.org2 peer node, not the default peer node.
1. Connect to the BYFN CLI container and check the default peer:
$ docker exec -it cli bash bash-4.4# echo $CORE_PEER_ADDRESS peer0.org2.example.com:7051
2. Run "peer" command on default peer, peer0.org1:
bash-4.4# peer node status status:STARTED
1. Run "peer" command on peer0.org2:
bash-4.4# CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger\ /fabric/peer/crypto/peerOrganizations/org2.example.com/users\ /Admin@org2.example.com/msp CORE_PEER_ADDRESS=peer0.org2.example.com:7051 \ CORE_PEER_LOCALMSPID=Org2MSP 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 \ peer node status status:STARTED
2. Run "peer" command on pee0.org2:
bash-4.4# CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger\ /fabric/peer/crypto/peerOrganizations/org2.example.com/users\ /Admin@org2.example.com/msp CORE_PEER_ADDRESS=peer0.org2.example.com:7051 \ CORE_PEER_LOCALMSPID=Org2MSP 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 \ peer node status status:STARTED
⇒ Incompatible Chaincode on BYFN Peers
⇐ Invoke Chaincode Transaction on BYFN Channel
2020-09-15, 955🔥, 0💬
Popular Posts:
How to use the Atom Online Validator at w3.org? w3.org feed validation service is provided at http:/...
Why I am getting "The Windows SDK version 8.1 was not found" error, when building my C++ application...
How to use "xml-to-json" Azure API Policy Statement? The "xml-to-json" Policy Statement allows you t...
How to pull NVIDIA CUDA Docker Image with the "docker image pull nvidia/cuda" command? If you are ru...
How to Instantiate Chaincode on BYFN Channel? You can follow this tutorial to Instantiate Chaincode ...