In the example, when it is invoke or query from CLI, the default environment variable CORE_PEER_MSPCONFIGPATH already set: it is Admin@org1.example.com performing this command. You can try the following command to specify other users:

# default, Admin@org1
docker exec cli peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
# User1@org1 (this is generated per crypto-config
docker exec -e CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp cli peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
# Admin@org2: this fails as org2 not authorized on peer0.org1
docker exec -e CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp cli peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'


I have another article about a notarization example using Hyperledger Fabric (link). I leverage the enrollAdmin.js and registerUser.js and also simple client app for signing and verification. The demonstration is done on Basic Network but again it should be easily adapted into First Network. See whether you can get some idea from this article.

cheers, kc

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store