1
votes

I am looking at the fabric-samples.git. There is a folder called fabric-samples/basic-network. I have a few questions about it.

Here is a script called init.sh. What is it intended to do?

After using

./generate.sh , 
./start.sh 

to provison a basic network, I am unable to use the CLI to query chaincode.

This is due to not having permissions. I expected that the peer would automatically have permissions to do this.

docker exec -it peer0.org1.example.com   bash

root@b67973bdc00c:/opt/gopath/src/github.com/hyperledger/fabric# peer chaincode list --installed -C mychannel

Error: Error endorsing chaincode: rpc error: code = Unknown desc = chaincode error (status: 500, message: Authorization for GETINSTALLEDCHAINCODES on channel getinstalledchaincodes has been denied with error Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [This identity is not an admin])

I expected that root user of the container was an admin because of the contents of:

config/Org1MSPanchors.tx

What am I missing here?

1

1 Answers

0
votes

When you query a peer using cli, you need to set certain environment variables first.

# Environment variables for PEER0

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_LOCALMSPID="Org1MSP"
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_ADDRESS=peer0.org1.example.com:7051

After that try querying the peer for chaincode list