How to nicely format ("pretty print") Fabric chaincode query output? - hyperledger-fabric

I'm trying to generate a nicely formatted view of a specific ledger entry (or range of entries) with all related values.
When I run a chaincode query, I get an output like the following:
user#server:~/fabric-samples/test-network$ peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA -C mychannel -n myFirstChaincode --peerAddresses localhost:7051 --tlsRootCertFiles $PEER1_TLS -c '{"function":"queryOrder","Args":["004"]}'
2020-11-08 16:01:05.166 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 payload:"{\"actualDimensions\":{\"DIM1\":{},\"DIM2\":{},\"DIM3\":{},\"DIM4\":{}},\"customer\":\"GM\",\"dueDate\":\"tomorrow\",\"manufacturer\":\"undefined\",\"manufacturingData\":{},\"numOfDims\":\"5\",\"orderStatus\":\"new\",\"partID\":\"004\",\"partName\":\"Test Part\",\"requiredDimensions\":{\"DIM1\":{},\"DIM2\":{},\"DIM3\":{},\"DIM4\":{}}}"
This output looks like a long JSON string that has newlines replaced with \.
I'm looking for a human readable output. While I can read this above entry, the associated data structure is very simple. If I query another entry with several nested objects, it quickly becomes too messy to easily read.
I've tried adding something like JSON.stringify(value,null,4) to the chaincode query function, but that doesn't help:
2020-11-07 23:40:41.964 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 payload:"{\n \"actualDimensions\": {\n \"DIM1\": {},\n \"DIM2\": {},\n \"DIM3\": {},\n \"DIM4\": {}\n },\n \"customer\": \"GM\",\n \"dueDate\": \"tomorrow\",\n \"manufacturer\": \"undefined\",\n \"manufacturingData\": {},\n \"numOfDims\": \"5\",\n \"orderStatus\": \"new\",\n \"partID\": \"004\",\n \"partName\": \"Test Part\",\n \"requiredDimensions\": {\n \"DIM1\": {},\n \"DIM2\": {},\n \"DIM3\": {},\n \"DIM4\": {}\n }\n}"
It seems that the peer command may be formatting the output after JSON.stringify...
This page suggests that you can modify the logging format used for the peer command with an environmental variable, though I didn't find any examples or details of this beyond that one webpage.
When I tried adding an environmental variable to my cli:
export FABRIC_LOGGING_FORMAT=json, it didn't much help (it added more '/' instead of newlines):
student#hlfmc:~/fabric-samples/test-network$ peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles $PEER1_TLS --peerAddresses localhost:9051 --tlsRootCertFiles $PEER2_TLS -c '{"function":"GetAllAssets","Args":[]}'
{"level":"info","ts":1605042675.2069416,"name":"chaincodeCmd","caller":"chaincode/common.go:160","msg":"Chaincode invoke successful. result: status:200 payload:\"[{\\\"Key\\\":\\\"asset1\\\",\\\"Record\\\":{\\\"ID\\\":\\\"asset1\\\",\\\"Color\\\":\\\"blue\\\",\\\"Size\\\":5,\\\"Owner\\\":\\\"Tomoko\\\",\\\"AppraisedValue\\\":300,\\\"docType\\\":\\\"asset\\\"}},{\\\"Key\\\":\\\"asset2\\\",\\\"Record\\\":{\\\"ID\\\":\\\"asset2\\\",\\\"Color\\\":\\\"red\\\",\\\"Size\\\":5,\\\"Owner\\\":\\\"Brad\\\",\\\"AppraisedValue\\\":400,\\\"docType\\\":\\\"asset\\\"}},{\\\"Key\\\":\\\"asset3\\\",\\\"Record\\\":{\\\"ID\\\":\\\"asset3\\\",\\\"Color\\\":\\\"green\\\",\\\"Size\\\":10,\\\"Owner\\\":\\\"Jin Soo\\\",\\\"AppraisedValue\\\":500,\\\"docType\\\":\\\"asset\\\"}},{\\\"Key\\\":\\\"asset4\\\",\\\"Record\\\":{\\\"ID\\\":\\\"asset4\\\",\\\"Color\\\":\\\"yellow\\\",\\\"Size\\\":10,\\\"Owner\\\":\\\"Max\\\",\\\"AppraisedValue\\\":600,\\\"docType\\\":\\\"asset\\\"}},{\\\"Key\\\":\\\"asset5\\\",\\\"Record\\\":{\\\"ID\\\":\\\"asset5\\\",\\\"Color\\\":\\\"black\\\",\\\"Size\\\":15,\\\"Owner\\\":\\\"Adriana\\\",\\\"AppraisedValue\\\":700,\\\"docType\\\":\\\"asset\\\"}},{\\\"Key\\\":\\\"asset6\\\",\\\"Record\\\":{\\\"ID\\\":\\\"asset6\\\",\\\"Color\\\":\\\"white\\\",\\\"Size\\\":15,\\\"Owner\\\":\\\"Michel\\\",\\\"AppraisedValue\\\":800,\\\"docType\\\":\\\"asset\\\"}}]\" "}
(The above test was run on a separate server using the stock "asset-transfer-basic" sample chaincode.)
Note: I also tried updating the fabric-samples/config/core.yaml file with "format: json" and then re-running the chaincode (after properly bringing everything down and freshly starting the network). This gave the same output as before (no change from original output). I also tried editing the peer docker container's internal core.yaml file at /etc/hyperledger/fabric/core.yaml, which also did not appear to affect the output.
I've also tried calling the chaincode from an application (as opposed to directly from the CLI). The resulting output string no longer has '/' (but still no newlines/indentation):
user#server$ node query2.js
Wallet path: /home/user/Project/application/wallet
Transaction has been evaluated, result is: {"actualDimensions":{"DIM1":{},"DIM2":{},"DIM3":{},"DIM4":{}},"customer":"GM","dueDate":"tomorrow","manufacturer":"undefined","manufacturingData":{},"numOfDims":"5","orderStatus":"new","partID":"004","partName":"Test Part","requiredDimensions":{"DIM1":{},"DIM2":{},"DIM3":{},"DIM4":{}}}
If I try to use JSON.stringify on the output string, I get the '/' again:
user#server$ node query2.js
Wallet path: /home/user/Project/application/wallet
Transaction has been evaluated, result is: "{\"actualDimensions\":{\"DIM1\":{},\"DIM2\":{},\"DIM3\":{},\"DIM4\":{}},\"customer\":\"GM\",\"dueDate\":\"tomorrow\",\"manufacturer\":\"undefined\",\"manufacturingData\":{},\"numOfDims\":\"5\",\"orderStatus\":\"new\",\"partID\":\"004\",\"partName\":\"Test Part\",\"requiredDimensions\":{\"DIM1\":{},\"DIM2\":{},\"DIM3\":{},\"DIM4\":{}}}"
Here's the application code: (line 48 is original; 46-47 is second version)
45 ¦ ¦ ¦ const result = await contract.evaluateTransaction('queryOrder','004');
46 ¦ ¦ ¦ const stringResult=result.toString();
47 ¦ ¦ ¦ console.log(`Transaction has been evaluated, result is: ${JSON.stringify(stringResult,null,4)}`);
48 ¦ ¦ ¦ //console.log(`Transaction has been evaluated, result is: ${result.toString()}`);
I saw this post with a similar question, but it did not provide any solution for pretty formatting.
Are there any current solutions/suggestions for this?
I'd be happy with JSON formatting or anything else that has spacing/newlines and makes the current output more human-readable.

You can update core.yaml or you can use "FABRIC_LOGGING_FORMAT" in your docker compose file.
An example with core.yaml is given below:
# Logging section for the chaincode container
logging:
# Default level for all loggers within the chaincode container
level: info
# Override default level for the 'shim' logger
shim: warning
# Format for the chaincode container logs
format: json
You can find core.yaml into "fabric-samples/config" directory.
Link: https://github.com/hyperledger/fabric/blob/master/sampleconfig/core.yaml
If you download latest fabric samples, you can find sample core.yaml at "fabric-samples/config" directory.
An example with "FABRIC_LOGGING_FORMAT" in your docker compose file is given below:
You have to edit the environment of cli container with "- FABRIC_LOGGING_FORMAT=json"
cli:
container_name: cli
image: hyperledger/fabric-tools:$IMAGE_TAG
tty: true
stdin_open: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
#- FABRIC_LOGGING_SPEC=DEBUG
- FABRIC_LOGGING_FORMAT=json
- 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/Admin#org1.example.com/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- orderer.example.com
- peer0.org1.example.com
- peer1.org1.example.com
- peer0.org2.example.com
- peer1.org2.example.com
networks:
- byfn

Related

Hyperledger Fabric: "err: bad proposal response 500: access denied" when trying to join peer to channel

Built a network, added orderers to the channel here referenced as: channelname
The following folders are mounted on the container
# docker-compose.yaml
volumes:
- "~/container-volumes/$docker_peer0/production:/var/hyperledger/production"
- "~/organizations/peerOrganizations/$company/peers/$docker_peer0/msp:/etc/hyperledger/fabric/msp"
- "~/organizations/peerOrganizations/$company/peers/$docker_peer0/tls:/etc/hyperledger/fabric/tls"
Trying to join a peer to a channel, but gives bad proposal response 500: access denied.
Build the channel configuration block with the following command:
./configtxgen -profile SampleAppChannelEtcdRaft -outputBlock genesis_block.pb -channelID channelname
Next joined the orderers to the channel using the following command with an identity enrolled with role admin
./osnadmin channel join --channel-id channelname --config-block ~/Downloads/bin/genesis_block.pb -o localhost:9440 --ca-file $OSN_TLS_CA_ROOT_CERT --client-cert $ADMIN_TLS_SIGN_CERT --client-key $ADMIN_TLS_PRIVATE_KEY
Next I copy the generated genesis_block.pb to a mounted folder on the container so it is reachable for the following command which we use to join the peer to the channel:
docker exec -it peer0 peer channel join -b /var/hyperledger/production/genesis_block.pb -o vm01:9440 --clientauth --cafile /etc/hyperledger/fabric/msp/tls/tls-ca-cert.pem --certfile /etc/hyperledger/fabric/msp/user/peer-admin/tls/cert.pem --keyfile /etc/hyperledger/fabric/msp/user/peer-admin/tls/key.pem
This results in the following error
[channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: proposal failed (err: bad proposal response 500: access denied for [JoinChain][channelname]: [Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [The identity is not an admin under this MSP [org1msp]: The identity does not contain OU [ADMIN], MSP: [org1msp]]])
The admin used for this command is peer-admin that was enrolled with the TLS-CA and the organizational CA. Also the config.yaml for OU's is present in peer-admin msp.
I also tried to set the CORE_PEER_MSPCONFIGPATH to the msp dir of peer-admin (peer0/msp/user/peer-admin/msp), but this results on a hard exit of the container on startup. fabric-chaincode-500-access-errors
I can't seem to figure out where it goes wrong, has it something to do with the --cafile, --certfile or --keyfile that you have to set within the peer channel join command or something else?
Edit:
This is the config file.
$docker_peer1_service_name:
image: hyperledger/fabric-peer:2.3
container_name: $docker_peer1_container_name
environment:
- FABRIC_CFG_PATH=/etc/hyperledger/fabric
- CORE_PEER_ID=$docker_peer1
- CORE_PEER_NETWORKID=test
- CORE_PEER_LISTENADDRESS=0.0.0.0:7081
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7082
- CORE_PEER_CHAINCODEADDRESS=localhost:7082
- CORE_PEER_ADDRESS=localhost:7081
- CORE_PEER_MSPCONFIGPATH=msp
- CORE_PEER_LOCALMSPID=$company
- CORE_PEER_FILESYSTEMPATH=/var/hyperledger/production
- CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7091
- CORE_PEER_GOSSIP_ENDPOINT=localhost:7081
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=localhost:7081
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CLIENTAUTHREQUIRED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/cert.pem
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/key.pem
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/tls-ca-cert.pem
- CORE_PEER_TLS_CLIENTROOTCAS_FILES=tls/tls-ca-cert.pem
- CORE_PEER_TLS_CLIENTCERT_FILE=/etc/hyperledger/fabric/tls/cert.pem
- CORE_PEER_TLS_CLIENTKEY_FILE=/etc/hyperledger/fabric/tls/key.pem
- CORE_PEER_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_PEER_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=peer1-couchdb:5985
- CORE_PEER_LEDGER_STATE_COUCHDBCONFIG_USERNAME=$docker_peer1_couchdb_username
- CORE_PEER_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=$docker_peer1_couchdb_pass
- CORE_PEER_LEDGER_SNAPSHOTS=var/hyperledger/production/snapshots
#- CORE_PEER_OPERATIONS_LISTENADDRESS=127.0.0.1:9443
#- CORE_PEER_OPERATIONS_TLS_ENABLED=true
#- CORE_PEER_OPERATIONS_TLS_CERT_FILE=
#- CORE_PEER_OPERATIONS_TLS_KEY_FILE=
#- CORE_PEER_OPERATIONS_TLS_CLIENTAUTHREQUIRED=true
- CORE_PEER_METRICS_PROVIDER=disabled
#- CORE_PEER_METRICS_STATSD_ADDRESS=127.0.0.1:8125
#- FABRIC_CA_SERVER_OPERATIONS_LISTENADDRESS=127.0.0.1:9444
ports:
- "7081:7081"
- "7082:7082"
- "7091:7091"
volumes:
- "~/container-volumes/$docker_peer1/production:/var/hyperledger/production"
- "~/organizations/peerOrganizations/$company/peers/$docker_peer1/msp:/etc/hyperledger/fabric/msp"
- "~/organizations/peerOrganizations/$company/peers/$docker_peer1/tls:/etc/hyperledger/fabric/tls"
I believe you will need to set the MSPID to use when you are running the peer channel join ... command.
Try setting CORE_PEER_LOCALMSPID to org1msp

Error installing chaincode in several organizations in Hyperledger Fabric network. Could not find config file

I have been adding several organisations to my hyperledger fabric network. I am using fabric 1.4.1 with the following CLI configurations:
container_name: cli-org1
image: hyperledger/fabric-tools:1.4.1
tty: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- FABRIC_LOGGING_SPEC=debug
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/org1.example.com/users/Admin#org1.example.com/msp
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
# Certs
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/org1.example.com/peers/peer0.org1.example.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
# Chaincode
- CORE_CHAINCODE_KEEPALIVE=10
# Orderer
- ORDERER_CA=/etc/hyperledger/msp/orderer/tlscacerts/tlsca.example.com-cert.pem
working_dir: /opt/gopath/src/
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/chaincode/
- ./crypto-config/peerOrganizations:/etc/hyperledger
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/etc/hyperledger/msp/orderer
networks:
- basic
All the Orgs peers, orderes and couchDBs had been up, but when I want to install the chain code inside cli-org1 with:
peer chaincode install \
--lang node \
--name Contract \
--version 0.1.0 \
--path chaincode \
--tls --cafile ${ORDERER_CA}
I get the following error:
ERRO 001 Fatal error when initializing core config : Could not find config file. Please make sure that FABRIC_CFG_PATH is set to a path which contains core.yaml
I think the core.yaml is by default inside the docker container, can you tell me if there is an error in the configuration?
Regards.
You need to use below environment variable in your peer configuration.
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_basic

Connection error when invoking a transaction on the peers

I am trying to execute a chaincode I have written with couchdb and java. I use the first-network example for creating the network and instantiate the code. The network is created and the chaincode got installed without any problem. Then I enter the container and execute the transactions. At first it worked fine but suddenly it started giving me this error and now I can’t find a solution. I don't know if it is related with couchdb connection or not.
Error: error getting endorser client for invoke: endorser client failed to
connect to peer0.org2.example.com:7051: failed to create new connection:
connection error: desc = "transport: error while dialing: dial tcp
172.24.0.9:7051: connect: connection refused"
The comand i use to invocke the chaincode is the next one.
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 $CHANNEL_NAME -n mycc --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 -c '{"Args":["createCustomer","c1","tom"]}'
UPDATE:
Many have asked if the chaincode was installed on peers, I can confirm it is.
#Egoes , it means your port is not open for the peers, check the snippet ports section, your peer docker file should look like this.
peer0.org1.example.com:
container_name: peer0.org1.example.com
image: hyperledger/fabric-peer
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.org1.example.com
- FABRIC_LOGGING_SPEC=info
- CORE_CHAINCODE_LOGGING_LEVEL=info
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
# # the following setting starts chaincode containers on the same
# # bridge network as the peers
# # https://docs.docker.com/compose/networking/
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_basic
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984
# The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
# provide the credentials for ledger to connect to CouchDB. The username and password must
# match the username and password set for the associated CouchDB.
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: peer node start
# command: peer node start --peer-chaincodedev=true
ports:
- 7051:7051
- 7053:7053

Sigsegv when creating channel - possible cert error?

I'm running through the samples to create my own blockchain dev environment - https://ibm-blockchain.github.io/develop/installing/development-tools.html
However, then the startfabric script fails because I get a sigsev when running the command - docker exec peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c composerchannel -f /etc/hyperledger/configtx/composer-channel.tx
There is a fabric bug reported late 2017 that discusses something similar around certificates being out of date.
I think the channel is created but I don't have a genesis file returned/created on my peer (is that what's supposed to happen when I create/join a channel). So, is there a way to join the channel with this bug or what else do i have to do please?
2018-02-28 14:07:11.067 UTC [msp] GetDefaultSigningIdentity -> DEBU 018 Obtaining default signing identity
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7fcd514a1259]
many thanks
john.
I had the same issue and this is how I fixed. Add GODEBUG=netdns=go to the environment variables of peer, orderer, and cli inside the docker compose yaml files. A more detailed explanation can be got from this site. This is how the environemental variable should look like.
peer-base:
image: hyperledger/fabric-peer
environment:
- GODEBUG=netdns=go
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# the following setting starts chaincode containers on the same
# bridge network as the peers
# https://docs.docker.com/compose/networking/
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
#- CORE_LOGGING_LEVEL=ERROR
- CORE_LOGGING_LEVEL=DEBUG
- 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
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start

hyperledger-fabric peer0 environment

I am very new to this subject and I have to go through a fabric-sample.
But at this point I have problem
Environment variables
# Environment variables for PEER0
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/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/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
But my docker-compose-base.yaml file has the following lines
environment:
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
When I run this command
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
I have this error message
INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/config.yaml: no such file or directory]
I am sure this error message cased by the missing/different lines in my docker-compose-base.yaml
What could I do in this case?
Just put these lines in my file?
Or something has gone wrong at some point what I did not realize?
Please bear with me as I just have started.
Thank you
edit: I have this error message
Error: Got unexpected status: BAD_REQUEST
Usage:
peer channel create [flags]
That's not an error message, but an INFO one.
an MSP can be configured to have an OU by having that config file with the following fields in it:
OrganizationalUnitIdentifiers:
- Certificate: "cacerts/cacert.pem"
OrganizationalUnitIdentifier: "COP"
It's perfectly fine not to have this file and to see this INFO message.

Resources