I have a cloud VM that runs my Hyperledger Fabric network (i.e., inside the VM are docker containers that run the peers, orderer, CAs, couchdbs). I also have a node.js application on Kubernetes (in the same VPC) that connects to the VM. However, whenever the application tries to connect to the blockchain via org1's connection profile, I get this error:
2021-03-16T02:28:46.320Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpcs://orderer.example.com:7050, connected:false, connectAttempted:true
2021-03-16T02:28:46.320Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer.example.com:7050 url:grpcs://orderer.example.com:7050 timeout:3000
2021-03-16T02:28:46.320Z - error: [DiscoveryService]: _buildOrderer[mychannel] - Unable to connect to the discovered orderer orderer.example.com:7050 due to Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpcs://orderer.example.com:7050, connected:false, connectAttempted:true
More details:
In the application, I use this to connect:
await gateway.connect(connectionProfile, {discovery: { enabled: true, asLocalhost: false}});
Before I changed CORE_PEER_GOSSIP_BOOTSTRAP and CORE_PEER_GOSSIP_EXTERNALENDPOINT from peer.org.example.com to the VM's internal IP address, it also produced the same errors for all discovered peers in the network (please see docker-compose-test-net.yaml below).
When I changed ORDERER_GENERAL_LISTENADDRESS from 0.0.0.0 to the VM's IP address, I couldn't build the network successfully.
docker-compose-test-net.yaml:
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
volumes:
orderer.example.com:
peer0.org1.example.com:
peer1.org1.example.com:
peer0.org2.example.com:
peer1.org2.example.com:
networks:
test:
services:
orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer:$IMAGE_TAG
environment:
- FABRIC_LOGGING_SPEC=DEBUG
- 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
# enabled TLS
- 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:
- ../system-genesis-block/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
- ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
- orderer.example.com:/var/hyperledger/production/orderer
ports:
- 7050:7050
networks:
- test
peer0.org1.example.com:
container_name: peer0.org1.example.com
image: hyperledger/fabric-peer:$IMAGE_TAG
environment:
#Generic peer variables
- 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}_test
- FABRIC_LOGGING_SPEC=INFO
# - FABRIC_LOGGING_SPEC=DEBUG
- CORE_PEER_TLS_ENABLED=true
- 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
# Peer specific variabes
- CORE_PEER_ID=peer0.org1.example.com
# - CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_ADDRESS=<VM's IP Address>: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_BOOTSTRAP=<VM's IP Address>:7051
# - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=<VM's IP Address>:7051
- CORE_PEER_LOCALMSPID=Org1MSP
volumes:
- /var/run/:/host/var/run/
- ../organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ../organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
- peer0.org1.example.com:/var/hyperledger/production
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
ports:
- 7051:7051
networks:
- test
peer1.org1.example.com:
container_name: peer1.org1.example.com
image: hyperledger/fabric-peer:$IMAGE_TAG
environment:
#Generic peer variables
- 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}_test
- FABRIC_LOGGING_SPEC=INFO
# - FABRIC_LOGGING_SPEC=DEBUG
- CORE_PEER_TLS_ENABLED=true
- 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
# Peer specific variabes
- CORE_PEER_ID=peer1.org1.example.com
# - CORE_PEER_ADDRESS=peer1.org1.example.com:7055
- CORE_PEER_ADDRESS=<VM's IP Address>:7055
- CORE_PEER_LISTENADDRESS=0.0.0.0:7055
- CORE_PEER_CHAINCODEADDRESS=peer1.org1.example.com:7056
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7056
# - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.example.com:7055
- CORE_PEER_GOSSIP_BOOTSTRAP=<VM's IP Address>:7055
# - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7055
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=<VM's IP Address>:7055
- CORE_PEER_LOCALMSPID=Org1MSP
volumes:
- /var/run/:/host/var/run/
- ../organizations/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ../organizations/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls
- peer1.org1.example.com:/var/hyperledger/production
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
ports:
- 7055:7055
networks:
- test
... same goes for peer0.org2.example.com and peer1.org2.example.com ...
What should my configuration be so that the discovery service can successfully locate the orderer in my VM?
Have you tried to change the asLocalhost: false to asLocalhost: true ? If your network and application are running on the same VPS you have to set asLocalhost var to true
Related
i need help i am using HLF 2.0 and developing fabric network which contain 2-ORG(1 peer each) ,raft(1 orderer) ,ca for both ORG (but till now there is only 1 ca-ORG1),2 couchdb container ,and last cli container container.
The network is up successfully ,but when i run the cmd to create channel(having name "onechannel") it show error. you can see here.Even All the crypto materials and certificates exists .And the code/script which i am running for creating channel is mentioned below
some Environmental variables & cmd for creating channel
enter code echo "########### Creating Channel One as Org1 Peer ##################"
export FABRIC_CFG_PATH=${PWD}
export CHANNEL_NAME=onecannel
export CORE_PEER_TLS_ENABLED=true
export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/cryptoconfig/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
export PEER0_OGR1_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto-/config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export PEER0_OGR2_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/cryptoconfig/peerOrganizations /org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_ADDRESS=peer0.org1.example.com:7051" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp" -e "CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_OGR1_CA" cli peer channel create -o localhost:7050 -c $CHANNEL_NAME --ordererTLSHostnameOverride orderer.example.com -f ./channel-artifacts/$CHANNEL_NAME.tx --outputBlock ./channel-artifacts/$CHANNEL_ONE_NAME.block --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
NoW The docker compose is here which i am using : the docker compose file is runing up successfully . i thing the error may be in PATH OR RELATIVE_PATH
version: "2"
networks:
test:
services:
ca_org1:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=org1.example.com
- FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/ca-server-config/ca.org1.example.com-cert.pem
- FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/ca-server-config/priv_sk
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlsca.org1.example.com-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-tls/priv_sk
- FABRIC_CA_SERVER_PORT=7054
ports:
- "7054:7054"
command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
- ./crypto-config/peerOrganizations/org1.example.com/tlsca/:/etc/hyperledger/fabric-ca-server-tls
container_name: ca_org1
networks:
- test
orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer
environment:
- ORDERER_GENERAL_LOGLEVEL=debug
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
# TLS ENABLAE
- 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
networks:
- test
couchdb0:
container_name: couchdb0
image: hyperledger/fabric-couchdb
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
# for example map it to utilize Fauxton User Interface in dev environments.
ports:
- "5984:5984"
networks:
- test
peer0.org1.example.com:
container_name: peer0.org1.example.com
image: hyperledger/fabric-peer
environment:
- 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:8051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
- FABRIC_LOGGING_SPEC=INFO
- FABRIC_LOGGING_SPEC=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
- CORE_CHAINCODE_EXECUTETIMEOUT=300s
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
depends_on:
- couchdb0
networks:
- test
couchdb1:
container_name: couchdb1
image: hyperledger/fabric-couchdb
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
# for example map it to utilize Fauxton User Interface in dev environments.
ports:
- "6984:5984"
networks:
- test
peer0.org2.example.com:
container_name: peer0.org2.example.com
image: hyperledger/fabric-peer
environment:
- CORE_PEER_ID=peer0.org2.example.com
- CORE_PEER_ADDRESS=peer0.org2.example.com:9051
- CORE_PEER_LISTENADDRESS=0.0.0.0:9051
- CORE_PEER_CHAINCODEADDRESS=peer0.org2.example.com:9052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:9052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:9051
#- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:10051
- CORE_PEER_LOCALMSPID=Org2MSP
- 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
- FABRIC_LOGGING_SPEC=INFO
#- FABRIC_LOGGING_SPEC=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
# Allow more time for chaincode container to build on install.
- CORE_CHAINCODE_EXECUTETIMEOUT=300s
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:
- 8051:8051
depends_on:
- couchdb1
networks:
- test
cli:
container_name: cli
image: hyperledger/fabric-tools
tty: true
stdin_open: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
#- FABRIC_LOGGING_SPEC=DEBUG
- 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/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- orderer.example.com
- peer0.org1.example.com
- peer0.org2.example.com
networks:
- test
code here
i hope you expert can help me to get out of this problem and provide the good suggestions and solution . Thank you in advance .
The problem resides between the crypto-material folder and CLI service definition
In your docker-compose file under cli there is a volume between a folder named crypto-config and the repository /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
This crypto-config folder is supposed to have your network identities nested as follow :
/crypto-config
/peerOrganizations
other cryptomaterials
/users
/Admin#org1.example.com
/msp
/tls
The content of this folder is supposed to be generated by cryptogen tool and crypto-config.yaml file and folder will be named according to how you write it
And this content should be available to CLI environment variable like
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp
You should verify that your crypto-material are generated inside the crypto-config file and their paths are consistent with what is defined under CLI volumes and the environment variables
I am trying to setup a hyperledger network with 2 orgs running on 2 different physical machine. So machine 1 has orderer, peer0.org1, peer1.org1, ca-org1, couchdb1, couchdb2 and cli containers. Machine 2 has peer0.org2, peer1.org2, ca-org2, couchdb3, couchdb4 and cli container.
Below is the docker-compose-org1.yaml file -
version: '2'
volumes:
orderer.example.com:
peer0.org1.example.com:
peer1.org1.example.com:
networks:
byfn:
services:
ca0.example.com:
image: hyperledger/fabric-ca:$IMAGE_TAG
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org1
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/65cc7012f64e12926807f9b731d3f4dbbda27dc577cb5a6afdb3730fcf53c48c_sk
ports:
- '7054:7054'
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/65cc7012f64e12926807f9b731d3f4dbbda27dc577cb5a6afdb3730fcf53c48c_sk -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca0.example.com
extra_hosts:
- "peer0.org2.example.com:10.160.151.114"
- "peer1.org2.example.com:10.160.151.114"
- "ca1.example.com:10.160.151.114"
networks:
- byfn
orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer:$IMAGE_TAG
environment:
- ORDERER_GENERAL_LOGLEVEL=INFO
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
# enabled TLS
- 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]
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
- orderer.example.com:/var/hyperledger/production/orderer
extra_hosts:
- "peer0.org2.example.com:10.160.151.114"
- "peer1.org2.example.com:10.160.151.114"
- "ca1.example.com:10.160.151.114"
ports:
- 7050:7050
networks:
- byfn
peer0.org1.example.com:
container_name: peer0.org1.example.com
image: hyperledger/fabric-peer:$IMAGE_TAG
environment:
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
- CORE_LOGGING_LEVEL=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_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
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
- peer0.org1.example.com:/var/hyperledger/production
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
extra_hosts:
- "peer0.org2.example.com:10.160.151.114"
- "peer1.org2.example.com:10.160.151.114"
- "ca1.example.com:10.160.151.114"
command: peer node start
ports:
- 7051:7051
- 7053:7053
depends_on:
- couchdb0
networks:
- byfn
couchdb0:
container_name: couchdb0
image: hyperledger/fabric-couchdb
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
ports:
- '5984:5984'
networks:
- byfn
peer1.org1.example.com:
container_name: peer1.org1.example.com
image: hyperledger/fabric-peer:$IMAGE_TAG
environment:
- CORE_PEER_ID=peer1.org1.example.com
- CORE_PEER_ADDRESS=peer1.org1.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
- CORE_LOGGING_LEVEL=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_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls
- peer1.org1.example.com:/var/hyperledger/production
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
extra_hosts:
- "peer0.org2.example.com:10.160.151.114"
- "peer1.org2.example.com:10.160.151.114"
- "ca1.example.com:10.160.151.114"
command: peer node start
ports:
- 8051:7051
- 8053:7053
depends_on:
- couchdb1
networks:
- byfn
couchdb1:
container_name: couchdb1
image: hyperledger/fabric-couchdb
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
ports:
- '6984:5984'
networks:
- byfn
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
#- CORE_LOGGING_LEVEL=DEBUG
- CORE_LOGGING_LEVEL=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
extra_hosts:
- "peer0.org2.example.com:10.160.151.114"
- "peer1.org2.example.com:10.160.151.114"
- "ca1.example.com:10.160.151.114"
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/github.com/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
networks:
- byfn
docker-compose-org2.yaml file -
version: '2'
volumes:
peer0.org2.example.com:
peer1.org2.example.com:
networks:
byfn:
services:
ca1.example.com:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org2
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/16acd23be9bbaf215828ddb410074828ce2b87ab68dff5976725b36f439f8c47_sk
ports:
- '7054:7054'
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/16acd23be9bbaf215828ddb410074828ce2b87ab68dff5976725b36f439f8c47_sk -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca0.example.com
extra_hosts:
- 'peer0.org1.example.com:10.160.151.121'
- 'peer1.org1.example.com:10.160.151.121'
- 'ca0.example.com:10.160.151.121'
- 'orderer.example.com:10.160.151.121'
networks:
- byfn
peer0.org2.example.com:
container_name: peer0.org2.example.com
image: hyperledger/fabric-peer:latest
environment:
- CORE_PEER_ID=peer0.org2.example.com
- CORE_PEER_ADDRESS=peer0.org2.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
- CORE_LOGGING_LEVEL=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_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
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
- peer0.org2.example.com:/var/hyperledger/production
extra_hosts:
- 'peer0.org1.example.com:10.160.151.121'
- 'peer1.org1.example.com:10.160.151.121'
- 'ca0.example.com:10.160.151.121'
- 'orderer.example.com:10.160.151.121'
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
ports:
- 9051:7051
- 9053:7053
depends_on:
- couchdb2
networks:
- byfn
couchdb2:
container_name: couchdb2
image: hyperledger/fabric-couchdb
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
ports:
- '7984:5984'
networks:
- byfn
peer1.org2.example.com:
container_name: peer1.org2.example.com
image: hyperledger/fabric-peer:latest
environment:
- CORE_PEER_ID=peer1.org2.example.com
- CORE_PEER_ADDRESS=peer1.org2.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
- CORE_LOGGING_LEVEL=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_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ./crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls
- peer1.org2.example.com:/var/hyperledger/production
extra_hosts:
- 'peer0.org1.example.com:10.160.151.121'
- 'peer1.org1.example.com:10.160.151.121'
- 'ca0.example.com:10.160.151.121'
- 'orderer.example.com:10.160.151.121'
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
ports:
- 10051:7051
- 10053:7053
depends_on:
- couchdb3
networks:
- byfn
couchdb3:
container_name: couchdb3
image: hyperledger/fabric-couchdb
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
ports:
- '8984:5984'
networks:
- byfn
cli:
container_name: cli
image: hyperledger/fabric-tools:latest
tty: true
stdin_open: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
#- CORE_LOGGING_LEVEL=DEBUG
- CORE_LOGGING_LEVEL=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/Admin#org2.example.com/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
extra_hosts:
- 'peer0.org1.example.com:10.160.151.121'
- 'peer1.org1.example.com:10.160.151.121'
- 'ca0.example.com:10.160.151.121'
- 'orderer.example.com:10.160.151.121'
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./chaincode/:/opt/gopath/src/github.com/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:
- peer0.org2.example.com
- peer1.org2.example.com
networks:
- byfn
As you can see I am using "extra_hosts" to connect to the docker container in other machine.
This way I am able to create channel from one machine and join the channel for both peers from that machine. In the other machine I fetched the same channel config and join the same channel for both peers.
I checked that all 4 peers in both machines have joined the same channel by below command -
peer channel list
peer channel getinfo -c mychannel
Now from machine 1 I have installed and instantiated chaincode. This is working fine. Used below commands to install and instantiate -
peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
peer chaincode instantiate -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 mycc -l golang -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
If I query the chaincode from the same machine it is working fine and I am getting proper result.
peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
But when I am executing the same chaincode query command from different machine it is giving below error -
Error: endorsement failure during query. response: status:500 message:"failed to execute transaction 2444b829db1485ad097b2e11442d65cb36f02de1c6a3f3372ad53594af4d1a4d: [channel mychannel] failed to get chaincode container info for mycc:1.0: could not get chaincode code: chaincode fingerprint mismatch: data mismatch"
I can see the hyperledger fabric is syncing all peers properly in both machines. Because when I run peer channel getinfo -c mychannel I can match the currentBlockHash, previousBlockHash and height value for all 4 peers. I am just not able to execute the peer chaincode query command from the other machine.
When I run peer chaincode instantiate command I can see a new docker container is created in machine 1 which is for running chaincode. But there is no such container in machine 2.
Am I missing any configuration here so that the chaincode container created on machine 1 can be accessed from machine 2?
New findings:
I have installed chaincode on all 4 peers in both machines by running peer chaincode install command from the CLI container. I have two CLI container running in two machines.
When I run the command peer chaincode list --installed. In machine 1 I get result like below
Name: mycc, Version: 1.0, Path: github.com/chaincode/chaincode_example02/go/, Id: 333a19b11063d0ade7be691f9f22c04ad369baba15660f7ae9511fd1a6488209
When I run the same command in machine 2. The result is same except the Id value is different. But I also found that the Id value is same for both peers on same machine. Probably that's why I am able to execute the chaincode query from both peers on same machine. But not able to run it from other machine. Looks like that's the root cause of this problem.
I was able to figure out the problem ultimately so posting an answer here. The problem was that when I was installed the chaincode from two different machine the chaincode Id was different. Previously I was using the command peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/ to install the chaincode seperately on two machines. So when I do peer chaincode list --installed it was showing the Id value as different.
I was able to solve it using slightly a different approach. First created chaincode package using the command peer chaincode package ccpack.out -n mycc -l golang -p github.com/chaincode/chaincode_example02/go/ -v 1.0. It will generate a file ccpack.out. Moved this file physically from one machine to another. Then installed the same package file in both machines using the command peer chaincode install ccpack.out. In that way the chaincode Id remains same and it works perfectly.
Did you install the ChainCode on your other peer as well?
When I run peer chaincode instantiate command I can see a new docker container is created in machine 1 which is for running chaincode. But there is no such container in machine 2. Am I missing any configuration here so that the chaincode container created on machine 1 can be accessed from machine 2?
This is as intended. Taken from the docs: "chaincode container is not started for a peer until an init or traditional transaction - read/write - is performed against that chaincode"
So simply identify as your other peer, install the chaincode the same way you did for the first one and then you can make a call (query or invoke doesnt matter) with that peer and you see that the chaincode-container will come up.
I got the same error. For me the chaincode file was different. Copying the whole chaincode folder to another machine at the same location worked for me.
Take a look at this:
https://stackoverflow.com/a/57628211/3750798
I'm building Multi-org fabric but when I run command docker-compose up -d
it gives below error
ERROR: yaml.parser.ParserError: while parsing a block mapping
in "./docker-compose.yml", line 6, column 1
expected <block end>, but found '<block mapping start>'
in "./docker-compose.yml", line 130, column 3
Below is the docker-compose.yaml.
version: '2'
networks:
basic:
services:
ca.main.tcloud.kpn.org:
image: hyperledger/fabric-ca: x86_64-1.0.6
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca.main.tcloud.kpn.org
- FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.crm.main.tcloud.kpn.org-cert.pem
- FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/c59a4aad4207795c6ccaf6301425732c287b976bcc291e3e398c9d74f0eb4774_sk
ports:
- "7054:7054"
command: sh -c 'fabric-ca-server start -b admin:adminpw'
volumes:
- ./crypto-config/peerOrganizations/crm.main.tcloud.kpn.org/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca.main.tcloud.kpn.org
networks:
- basic
orderer.main.tcloud.kpn.org:
container_name: orderer.main.tcloud.kpn.org
image: hyperledger/fabric-orderer: x86_64-1.0.6
environment:
- ORDERER_GENERAL_LOGLEVEL=info
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/orderer
command: orderer
ports:
- 7050:7050
volumes:
- ./config/:/etc/hyperledger/configtx
- ./crypto-config/ordererOrganizations/main.tcloud.kpn.org/orderers/orderer.main.tcloud.kpn.org/:/etc/hyperledger/msp/orderer
- ./crypto-config/peerOrganizations/crm.main.tcloud.kpn.org/peers/peer0.crm.main.tcloud.kpn.org/:/etc/hyperledger/msp/peerCrm
- ./crypto-config/peerOrganizations/ebs.main.tcloud.kpn.org/peers/peer0.ebs.main.tcloud.kpn.org/:/etc/hyperledger/msp/peerEbs
- ./crypto-config/peerOrganizations/lsp.main.tcloud.kpn.org/peers/peer0.lsp.main.tcloud.kpn.org/:/etc/hyperledger/msp/peerLsp
- ./crypto-config/peerOrganizations/delivery.main.tcloud.kpn.org/peers/peer0.delivery.main.tcloud.kpn.org/:/etc/hyperledger/msp/peerDelivery
- ./channel-artifacts/genesis.block:/etc/hyperledger/configtx/genesis.block
networks:
- basic
peer0.crm.main.tcloud.kpn.org:
container_name: peer0.crm.main.tcloud.kpn.org
image: hyperledger/fabric-peer: x86_64-1.0.6
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.crm.main.tcloud.kpn.org
- CORE_LOGGING_PEER=info
- CORE_CHAINCODE_LOGGING_LEVEL=info
- CORE_PEER_LOCALMSPID=crmMSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
- CORE_PEER_ADDRESS=peer0.crm.main.tcloud.kpn.org: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=couchdbcrm: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
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/crm.main.tcloud.kpn.org/peers/peer0.crm.main.tcloud.kpn.org/msp:/etc/hyperledger/msp/peer
- ./crypto-config/peerOrganizations/crm.main.tcloud.kpn.org/users:/etc/hyperledger/msp/users
- ./config:/etc/hyperledger/configtx
depends_on:
- orderer.main.tcloud.kpn.org
- couchdbcrm
networks:
- basic
peer0.ebs.main.tcloud.kpn.org:
container_name: peer0.ebs.main.tcloud.kpn.org
image: hyperledger/fabric-peer: x86_64-1.0.6
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.ebs.main.tcloud.kpn.org
- CORE_LOGGING_PEER=info
- CORE_CHAINCODE_LOGGING_LEVEL=info
- CORE_PEER_LOCALMSPID=ebsMSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
- CORE_PEER_ADDRESS=peer0.ebs.main.tcloud.kpn.org: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=kpn_basic
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdbebs: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:
- 8051:7051
- 8053:7053
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/ebs.main.tcloud.kpn.org/peers/peer0.ebs.main.tcloud.kpn.org/msp:/etc/hyperledger/msp/peer
- ./crypto-config/peerOrganizations/ebs.main.tcloud.kpn.org/users:/etc/hyperledger/msp/users
- ./config:/etc/hyperledger/configtx
depends_on:
- orderer.main.tcloud.kpn.org
- couchdbebs
networks:
- basic
peer0.lsp.main.tcloud.kpn.org:
container_name: peer0.lsp.main.tcloud.kpn.org
image: hyperledger/fabric-peer: x86_64-1.0.6
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.lsp.main.tcloud.kpn.org
- CORE_LOGGING_PEER=info
- CORE_CHAINCODE_LOGGING_LEVEL=info
- CORE_PEER_LOCALMSPID=lspMSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
- CORE_PEER_ADDRESS=peer0.lsp.main.tcloud.kpn.org: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=kpn_basic
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdblsp: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:
- 9051:7051
- 9053:7053
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/lsp.main.tcloud.kpn.org/peers/peer0.lsp.main.tcloud.kpn.org/msp:/etc/hyperledger/msp/peer
- ./crypto-config/peerOrganizations/lsp.main.tcloud.kpn.org/users:/etc/hyperledger/msp/users
- ./config:/etc/hyperledger/configtx
depends_on:
- orderer.main.tcloud.kpn.org
- couchdblsp
networks:
- basic
peer0.delivery.main.tcloud.kpn.org:
container_name: peer0.delivery.main.tcloud.kpn.org
image: hyperledger/fabric-peer: x86_64-1.0.6
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.delivery.main.tcloud.kpn.org
- CORE_LOGGING_PEER=info
- CORE_CHAINCODE_LOGGING_LEVEL=info
- CORE_PEER_LOCALMSPID=deliveryMSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
- CORE_PEER_ADDRESS=peer0.delivery.main.tcloud.kpn.org: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=net_basic
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdbdelivery: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:
- 10051:7051
- 10053:7053
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/delivery.main.tcloud.kpn.org/peers/peer0.delivery.main.tcloud.kpn.org/msp:/etc/hyperledger/msp/peer
- ./crypto-config/peerOrganizations/delivery.main.tcloud.kpn.org/users:/etc/hyperledger/msp/users
- ./config:/etc/hyperledger/configtx
depends_on:
- orderer.main.tcloud.kpn.org
- couchdbdelivery
networks:
- basic
couchdbcrm:
container_name: couchdbcrm
image: hyperledger/fabric-couchdb: x86_64-1.0.6
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
ports:
- 5984:5984
networks:
- basic
couchdbebs:
container_name: couchdbebs
image: hyperledger/fabric-couchdb: x86_64-1.0.6
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
ports:
- 5985:5984
networks:
- basic
couchdblsp:
container_name: couchdblsp
image: hyperledger/fabric-couchdb: x86_64-1.0.6
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
ports:
- 5986:5984
networks:
- basic
couchdbdelivery:
container_name: couchdbdelivery
image: hyperledger/fabric-couchdb: x86_64-1.0.6
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
ports:
- 5987:5984
networks:
- basic
cli:
container_name: cli
image: hyperledger/fabric-tools: x86_64-1.0.6
tty: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_LOGGING_LEVEL=info
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.crm.main.tcloud.kpn.org:7051
- CORE_PEER_LOCALMSPID=crmMSP
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/crm.main.tcloud.kpn.org/users/Admin#crm.main.tcloud.kpn.org/msp
- CORE_CHAINCODE_KEEPALIVE=10
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/
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
networks:
- basic
depends_on:
- orderer.main.tcloud.kpn.org
- peer0.crm.main.tcloud.kpn.org
- peer0.ebs.main.tcloud.kpn.org
- peer0.lsp.main.tcloud.kpn.org
- peer0.delivery.main.tcloud.kpn.org
I have also validated online with YAML validator but it's showing correct YAML so I'm not sure where its going wrong. I have checked if there are any tabs present or not but there is not tab.
Your image declarations contain invalid spaces:
image: hyperledger/fabric-ca: x86_64-1.0.6
---------------------here----^
Delete it!
On instantiation of chaincode using fabric-java-sdk I am obtaining the below error. I am running the peers using docker-compose.yaml file.
INFO: fabcarss- Chain code instantiation response {
status: 500
message: "failed to execute transaction 17e4e74664013463ed52355e380f43a85f1aa5ef44e04ac375342ec4f90d9c72: error starting container: error starting container: Post http://unix.sock/containers/create?name=dev-peer1.org1.example.com-fabcarss-5: dial unix /host/var/run/docker.sock: connect: no such file or directory"
}
My peer docker compose is as follows:
peer0org1:
container_name: peer0.org1.example.com
image: hyperledger/fabric-peer:1.2.0
deploy:
placement:
constraints:
- node.role == manager
- node.id == vbka1smkqlqflno3hfp69rbr7
environment:
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=artifacts_default
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/crypto/peer/msp
- CORE_PEER_TLS_ENABLED=false
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/crypto/peer/tls/server.key
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/crypto/peer/tls/server.crt
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/crypto/peer/tls/ca.crt
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
volumes:
- /var/run/:/host/var/run/
ports:
- 7051:7051
- 7053:7053
volumes:
- ./channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/crypto/peer
depends_on:
- orderer.example.com
You run peers with docker-compose (or just docker) ?
Have you try to modify
- CORE_VM_ENDPOINT=unix:/{PATH-TO-YOUR-DOCKER.SOCK}
I have a Hyperledger fabric (v0.6) network setup on remote machines. I want to enable pbft consensus for commitment of blocks. I can see the pbft consensus enabled in the logs and the peers are able to connect to the root node. I deployed my chaincode on all the 4 peers and invoked a transaction on one. I don't see any commits in any of the peers even after a long time, though the peers propagate state change a lot.
Following is my docker-compose.yml file at the root node:
membersrvc:
image: hyperledger/fabric-membersrvc
restart: unless-stopped
ports:
- "7054:7054"
expose:
- "7054"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- MEMBERSRVC_CA_ACA_ENABLED=true
command: membersrvc
vp0:
image: hyperledger/fabric-peer:latest
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- CORE_PEER_ID=vp0
- CORE_SECURITY_ENABLED=false
- CORE_SECURITY_ENROLLID=test_vp0
- CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
- CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_PEER_NETWORKID=dev
- CORE_LOGGING_LEVEL=debug #critical, error, warning, notice, info, debug
# The following section enables pbft consensus
- CORE_PBFT_GENERAL_BATCHSIZE=1
- CORE_PBFT_GENERAL_K=2
- CORE_PBFT_GENERAL_MODE=classic
- CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft # noops, pbft
- CORE_PBFT_GENERAL_TIMEOUT_REQUEST=10s
# - CORE_NOOPS_BLOCK_TIMEOUT=2s
# - CORE_NOOPS_BLOCK_WAIT=2s
ports:
- "7050:7050"
- "7051:7051"
expose:
- "7051"
- "7052"
- "7053"
links:
- membersrvc
command: sh -c "sleep 20; peer node start"
And this is the docker-compose.yml file at each of the peer nodes:
vp1:
image: hyperledger/fabric-peer:latest
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- CORE_PEER_DISCOVERY_ROOTNODE=root-node-ip:7051
- CORE_PEER_ID=vp1
- CORE_SECURITY_ENABLED=false
- CORE_SECURITY_ENROLLID=test_vp1
- CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
- CORE_PEER_PKI_ECA_PADDR=http://root-node-ip:7054
- CORE_PEER_PKI_TCA_PADDR=http://root-node-ip:7054
- CORE_PEER_PKI_TLSCA_PADDR=http://root-node-ip:7054
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_PEER_NETWORKID=dev
- CORE_LOGGING_LEVEL=debug #critical, error, warning, notice, info, debug
# The following section enables pbft consensus
- CORE_PBFT_GENERAL_BATCHSIZE=1
- CORE_PBFT_GENERAL_K=2
- CORE_PBFT_GENERAL_MODE=classic
- CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft # noops, pbft
- CORE_PBFT_GENERAL_TIMEOUT_REQUEST=10s
#- CORE_NOOPS_BLOCK_TIMEOUT=2s
#- CORE_NOOPS_BLOCK_WAIT=2s
ports:
- "7050:7050"
- "7051:7051"
expose:
- "7051"
- "7052"
- "7053"
command: sh -c "sleep 20; peer node start"
Can anybody please help. Thanks.
I figured that the peers were unable to perform handshake using their docker-published ip addresses . I turned off the auto detection by setting the CORE_PEER_ADDRESSAUTODETECT to false and let the peers discover each other by setting the CORE_PEER_ADDRESS to the instance's public ip and the CORE_PEER_DISCOVERY_ROOTNODE to the ip address of the validator with which the peer would sync its ledger.