We are using Tuna-App to setup basicnetwork along with tuna-app, and trying to add additional peer. Here is the source code of tuna-app
https://github.com/hyperledger/education/tree/master/LFS171x/fabric-material
We are able to add the Peer to the basicnetwork. We verified docker containers, all peer0, peer1, cli, ca, orderer, coughdb, coughdb2, and tuna-app-1.0 are running.
Peer0 sucessfully got added to channel with following command:
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.example.com/msp" peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c mychannel -f /etc/hyperledger/configtx/channel.tx
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.example.com/msp" peer0.org1.example.com peer channel join -b mychannel.block
We are trying to add Peer1 to the same channel with command:
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.example.com/msp" peer1.org1.example.com peer channel join -b mychannel.block
it throws an error:
genesis block file not found open mychannel.block: no such file or directory
Please help me. How can we resolve this issue?
Enter the cli container:
docker exec -it cli bash
In that terminal, export the required variables:
export CHANNEL_NAME=mychannel
CORE_PEER_LOCALMSPID="Org1MSP"
CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.example.com/msp
CORE_PEER_ADDRESS=peer1.org1.example.com:7051
Add the peer to the channel:
peer channel join -b mychannel.block
Try the below commands:
docker exec peer1.org1.example.com peer channel fetch 0 mychannel.block -o orderer.example.com:7050 -c mychannel
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#$org1.example.com/msp" peer1.org1.example-swarm.com peer channel join -b mychannel.block
Create channel from the CLI container. As in firstnetwork.
Because mychannel.block is available only in peer0.
You can't join the channel from peer1 since no mychannel.block file is available.
Related
We are getting an error while trying a peer node to join a channel. Both members have separate peer nodes and separate EC2 machines acting as clients for the network. Member1 has created a channel and joined its peer node to the channel. Member2 has pulled the genesis block from their client but when trying to join the channel, we get the error:
Error: genesis block file not found open ourchannel.block: no such file or directory
despite seeing ourchannel.block in the directory we run the command. The command we're using to join the channel is:
docker exec -e "CORE_PEER_TLS_ENABLED=true" \
-e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/home/managedblockchain-tls-chain.pem" \
-e "CORE_PEER_ADDRESS=$PEER" \
-e "CORE_PEER_LOCALMSPID=$MSP" \
-e "CORE_PEER_MSPCONFIGPATH=$MSP_PATH" \
cli peer channel join -b ourchannel.block \
-o $ORDERER --cafile /opt/home/managedblockchain-tls-chain.pem --tls
You only have the genesis block (the file with .block extension) if you create a channel in a separate container, which is cli container in your case. Please check by using ls command inside the cli container.
A simple command to jump into cli container:
docker exec -it cli bash
Just in case you can't find genesis block, you can get it from the orderer (remember to modify the path to the cafile fit your project):
peer channel fetch 0 ourchannel.block -o orderer.example.com:7050 -c ourchannel --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
After this, you can join the channel with peer channel join command.
Simple issue, we had to specify the absolute path to the block file.
Instead of
cli peer channel join -b ourchannel.block
we used
cli peer channel join -b /opt/home/ourchannel.block \
and it worked.
I have a multiple peer, one org Org1MSP network where I want the transactions to be endorsed by multiple peers.
Is there a way to specify endorsement policy using CLI for e.g. during instantiate chaincode
For e.g.
peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n
mycc -v 1.0 -c '{"Args":[]}' -P "OutOf(2, 'Org1MSP.peer')"
Just specify the same org twice with an AND:
AND('Org1MSP.peer', 'Org1MSP.peer')
I am trying to run fab car sample application from http://hyperledger-fabric.readthedocs.io/en/release-1.1/write_first_app.html
when ./startFabric.sh node trying to create channel with below command
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.example.com/msp" peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c mychannel -f /etc/hyperledger/configtx/channel.tx
It gives error as
flag provided but not defined: -e
What am I doing wrong here?
The Fabric samples require Docker 17.06.2-ce or later
I have set up data persistence in the peer and the couchdb containers and have run through the commands with the chaincode_example02 chaincode manually on both peers in the cli container (with the command line commented in docker-compose-cli.yaml). The last things I did is to shutdown the containers and then restart them. After the restart, I can query the "query" function of the chaincode without any problem and all the data are still there (balances of a and b) and the same as before I perform the shutdown. However, I get the following error when I invoke the "invoke" function on both peer containers.
Error: Error sending transaction invoke: got unexpected status: NOT_FOUND -- channel does not exist
How to restart the fabric containers (x86_64-1.1.0-preview) with data persistence so that I can perform chaincode invoke functions normally after the restart?
Ubuntu version:
Distributor ID: Ubuntu
Description: Ubuntu 17.10
Release: 17.10
Codename: artful
Hyperledger Fabric version:
x86_64-1.1.0-preview
All actions below are done with the "first-network" (byfn.sh) example:
Configuration Changes:
added the following lines in the volumes sections in docker-compose-base.yaml for peer container data persistence
for peer0.org1.example.com:
- ../persist-data/peer0org1:/var/hyperledger/production
for peer1.org1.example.com:
- ../persist-data/peer1org1:/var/hyperledger/production
for peer0.org2.example.com:
- ../persist-data/peer0org2:/var/hyperledger/production
for peer1.org2.example.com:
- ../persist-data/peer1org2:/var/hyperledger/production
added the following lines in the volumes sections in docker-compose-couch.yaml for couchdb container data persistence
for couchdb0:
- ./persist-data/couchdb0:/opt/couchdb/data
for couchdb1:
- ./persist-data/couchdb1:/opt/couchdb/data
for couchdb2:
- ./persist-data/couchdb2:/opt/couchdb/data
for couchdb3:
- ./persist-data/couchdb3:/opt/couchdb/data
I have also changed to couchdb port numbers as follow to avoid conflicts with the couchdb installed on my computer:
for couchdb0:
- "6984:5984"
for couchdb1:
- "7984:5984"
for couchdb2:
- "8984:5984"
for couchdb3:
- "9984:5984"
Actions and commands:
cd to the first-network directory
../../bin/cryptogen generate --config=./crypto-config.yaml
export FABRIC_CFG_PATH=$PWD
../../bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
export CHANNEL_NAME=mychannel && ../../bin/configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME
../../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP
../../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP
docker-compose -f docker-compose-cli.yaml -f docker-compose-couch.yaml up -d
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
# enter the cli container and execute the commands in the cli container manually
docker exec -it cli bash
export CHANNEL_NAME=mychannel
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
peer channel join -b mychannel.block
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 channel join -b mychannel.block
peer channel update -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/Org1MSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
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 channel update -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/Org2MSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
peer chaincode install -n mycc -v 1.0 -p github.com/chaincode/chaincode_example02/go/
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 chaincode install -n mycc -v 1.0 -p github.com/chaincode/chaincode_example02/go/
peer chaincode instantiate -o orderer.example.com:7050 --tls --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 -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "OR ('Org1MSP.member','Org2MSP.member')"
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","b"]}'
peer chaincode invoke -o orderer.example.com:7050 --tls --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 -c '{"Args":["invoke","a","b","10"]}'
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","b"]}'
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 chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
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 chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","b"]}'
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 chaincode invoke -o orderer.example.com:7050 --tls --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 -c '{"Args":["invoke","a","b","5"]}'
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 chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
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 chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","b"]}'
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","b"]}'
exit
#get out of the cli container
docker-compose -f docker-compose-cli.yaml -f docker-compose-couch.yaml down
docker container ls
docker network ls
docker-compose -f docker-compose-cli.yaml -f docker-compose-couch.yaml up -d
docker container ls
docker network ls
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
# enter the cli container and execute the commands in the cli container manually
docker exec -it cli bash
export CHANNEL_NAME=mychannel
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","b"]}'
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 chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
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 chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","b"]}'
# get error in the next two commands invoking the "invoke" function in the chaincode. The full error text is at the bottom.
peer chaincode invoke -o orderer.example.com:7050 --tls --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 -c '{"Args":["invoke","b","a","10"]}'
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 chaincode invoke -o orderer.example.com:7050 --tls --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 -c '{"Args":["invoke","b","a","5"]}'
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","b"]}'
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 chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
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 chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","b"]}'
This is the full error text from peer0 org1:
2018-01-26 17:04:00.046 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-01-26 17:04:00.046 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-01-26 17:04:00.052 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-01-26 17:04:00.052 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-01-26 17:04:00.052 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-01-26 17:04:00.052 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 0AAA070A6608031A0B0880BFADD30510...696E766F6B650A01620A01610A023130
2018-01-26 17:04:00.052 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: 20D7EB048A7E3F59A74A3F7C1757E7CCCFFBFD2F5D5FC8A4BFF949051F22F99E
2018-01-26 17:04:00.094 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0AAA070A6608031A0B0880BFADD30510...21ED65F3952B1FE09A8E14D906B69E7C
2018-01-26 17:04:00.094 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 285F91523D88D5D88CFCF7CDA89E6C81025D58116F2F33C1BE59DAEB9AA304D6
Error: Error sending transaction invoke: got unexpected status: NOT_FOUND -- channel does not exist - version:1 response:<status:200 message:"OK" > payload:"\n &\2175\217\025\227\216Q\373a\020G\010\022{\3179\352\243\352\006\\\254\265\013\336\3070\002\237\353\315\022Y\nE\022\024\n\004lscc\022\014\n\n\n\004mycc\022\002\010\003\022-\n\004mycc\022%\n\007\n\001a\022\002\010\005\n\007\n\001b\022\002\010\005\032\007\n\001a\032\00295\032\010\n\001b\032\003205\032\003\010\310\001\"\013\022\004mycc\032\0031.0" endorsement:<endorser:"\n\007Org1MSP\022\226\006-----BEGIN CERTIFICATE-----\nMIICGjCCAcCgAwIBAgIRAIgZ0tCVwxfC3MNajGO3DKgwCgYIKoZIzj0EAwIwczEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh\nLm9yZzEuZXhhbXBsZS5jb20wHhcNMTgwMTI2MTY0NTE0WhcNMjgwMTI0MTY0NTE0\nWjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN\nU2FuIEZyYW5jaXNjbzEfMB0GA1UEAxMWcGVlcjAub3JnMS5leGFtcGxlLmNvbTBZ\nMBMGByqGSM49AgEGCCqGSM49AwEHA0IABK3PyoXXOwdkwGL5hkXpxNUxF0f5+2p8\nE2jMD6xCascnLlbDs4dqcsdU5pGs/xJKJukEv+YYZabhQMOZN0ZqR+yjTTBLMA4G\nA1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAILgbSt2V1f0R\nGHsGkSuIPvwktllKaUBtWskwCwjGFc+BMAoGCCqGSM49BAMCA0gAMEUCIQCZoO0k\nIoaDOdyJc5B9L4uTE8lHYMLpHZyJ0TLg5ipK/wIgPrW0LZvkrQik8/38UpfOfF/F\ndGQS8yRG2kpOv1HKH0k=\n-----END CERTIFICATE-----\n" signature:"0E\002!\000\340\347\345\036\356\020\352\216\200\037\220$rk\320\243\025\006p\315\376\340C\\YG\030P\341\022i\262\002 \031\357M\2274\t\263\263\313\002=\206\224\321\255\r!\355e\363\225+\037\340\232\216\024\331\006\266\236|" >
Usage:
peer chaincode invoke [flags]
Flags:
-C, --channelID string The channel on which this command should be executed (default "testchainid")
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
-n, --name string Name of the chaincode
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--test.coverprofile string Done (default "coverage.cov")
--tls Use TLS when communicating with the orderer endpoint
--transient string Transient map of arguments in JSON encoding
-v, --version Display current version of fabric peer server
This is the full error text from peer0 org2:
2018-01-26 17:05:22.201 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-01-26 17:05:22.201 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-01-26 17:05:22.205 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-01-26 17:05:22.206 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-01-26 17:05:22.206 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-01-26 17:05:22.206 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 0AA6070A6608031A0B08D2BFADD30510...06696E766F6B650A01620A01610A0135
2018-01-26 17:05:22.206 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: 26976CF7AC5443DB2390C53818E2C4B64A7278DBB874101FD4B335189333294A
2018-01-26 17:05:22.267 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0AA6070A6608031A0B08D2BFADD30510...CC920EBFDA7DA672DC8EA94465B459B2
2018-01-26 17:05:22.267 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: B6965F71B9DBCC7CB4788BF260A477275C4FFB9393D8176FCBAD75333F566055
Error: Error sending transaction invoke: got unexpected status: NOT_FOUND -- channel does not exist - version:1 response:<status:200 message:"OK" > payload:"\n \271\353p\303\250\000m\366dy\021(!\2043\002\305>]&u_\364o\250\335\305\026\3310\354T\022Y\nE\022\024\n\004lscc\022\014\n\n\n\004mycc\022\002\010\003\022-\n\004mycc\022%\n\007\n\001a\022\002\010\005\n\007\n\001b\022\002\010\005\032\007\n\001a\032\00290\032\010\n\001b\032\003210\032\003\010\310\001\"\013\022\004mycc\032\0031.0" endorsement:<endorser:"\n\007Org2MSP\022\226\006-----BEGIN CERTIFICATE-----\nMIICGTCCAb+gAwIBAgIQJj1f7E3ibi/1ttw70Rh8sTAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMi5leGFtcGxlLmNvbTAeFw0xODAxMjYxNjQ1MTRaFw0yODAxMjQxNjQ1MTRa\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcyLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHZ/3QCOmqgh/z3tnhepv4YSlvF3m8jXG\n4xDAs1xycyBiecGRbnWX93vdqDbKJvF/f3/JsBPoHPl663tJcrqQ96NNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgwrQVLq1wpKed\nwmIVDWSrClqEts8LWOTDlO7ncgx3a5wwCgYIKoZIzj0EAwIDSAAwRQIhALOzxd2C\nMAYj+EBYCnwbkxixSNlZI3YxA5tBnshN4oS0AiBeHWebdXsg7lMzaJtwa+r9JcRt\nUVAM4j/ydnSQsfyfRA==\n-----END CERTIFICATE-----\n" signature:"0E\002!\000\240q\3370\307Iwi\036\022\305\035}!E\234\220\213\336`o\323\344\375\311\211j\361\t\343p\023\002 \177\026\351\234s\216\276=\207(\325\223i\264\303)\314\222\016\277\332}\246r\334\216\251De\264Y\262" >
Usage:
peer chaincode invoke [flags]
Flags:
-C, --channelID string The channel on which this command should be executed (default "testchainid")
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
-n, --name string Name of the chaincode
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--test.coverprofile string Done (default "coverage.cov")
--tls Use TLS when communicating with the orderer endpoint
--transient string Transient map of arguments in JSON encoding
-v, --version Display current version of fabric peer server
By following Gari Singh's help, I have added the following line in the volumes sections in docker-compose-base.yaml for orderer container data persistence and the problem is solved.
for orderer:
- ../persist-data/orderer:/var/hyperledger/production
I am trying to build a fabric network with two channels. One peer is able to join the channel but while trying to join the second peer to channel getting following error:
Error: genesis block file not found open mychannel.block: no such file or directory
this is my code used for channel creation and joining peers:
Creating channel:
docker exec -e "CORE_PEER_LOCALMSPID=Org2MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org2.example.com/msp" peer0.org2.example.com peer channel create -o orderer.example.com:7050 -c mychannel -f /etc/hyperledger/configtx/channel.tx
Joining peers:
docker exec -e "CORE_PEER_LOCALMSPID=Org2MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org2.example.com/msp" peer0.org2.example.com peer channel join -b mychannel.block
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.example.com/msp" peer0.org1.example.com peer channel join -b mychannel.block
Please correct if something is wrong.
i run in the same situation and find a solution.
Since the mychannel.block is known only to peer0.org2.example.com container, all the joins have to be done from there.
For the second peer you can issue:
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.example.com/msp" -e "peer0.org1.example.com:7051" peer0.org2.example.com peer channel join -b mychannel.block
M
The issue is that mychannel.block is only available within the peer0.org2.example.com container (since that is the container where you ran the channel create command). The peer0.org1.example.com container does not have access to mychannel.block and that's why you get the error.
What you will need to do is to actually have to do is mount a shared volume for both containers and make sure that you when you run channel create that mychannel.block is output in the shared volume
I had the same problem, but the scenario was slightly different: I had two peers (peer0 and peer1) in one org (org1). I used the following commands to join them to the same channel, and it works:
//Join peer0.org1.example.com to the channel
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e
"CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.example.com/msp"
peer0.org1.example.com peer channel join -b mychannel.block
//Join peer1.org1.example.com to the channel.
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e
"CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.example.com/msp" -e "CORE_PEER_ADDRESS=peer1.org1.example.com:7051" peer0.org1.example.com peer
channel join -b mychannel.block
you need to check your docker-compose.yaml file to see how you're mapping volumes in there
in the definitions of the two peers, ensure there is a common mapped volume, for example in peer0 you may have something like this;
volumes:
- /var/run/:/host/var/run/
- ./:/etc/hyperledger/configtx
- ./crypto-config/peers/peer0/msp:/etc/hyperledger/peer/msp
- ./crypto-config/users/user0/msp:/etc/hyperledger/msp/users
and in your peer1 you may have;
volumes:
- /var/run/:/host/var/run/
- ./:/etc/hyperledger/configtx
- ./crypto-config/peers/peer1/msp:/etc/hyperledger/peer/msp
- ./crypto-config/users/user1/msp:/etc/hyperledger/msp/users
You can see here there are two shared volume mappings, the first two in each definition point to the sample place.
So to be clear, the volume mapping is defined as follows:
[path on local machine]:[path to map in docker image]
This issue is due to mychannel.block was not found in peer0.org1.example.com
You can copy mychannel.block from peer0.org2.example.com to peer0.org1.example.com
try these commands
docker cp peer0.org2.example.com:/opt/gopath/src/github.com/hyperledger/fabric/mychannel.block mychannel.block
docker cp mychannel.block peer0.org1.example.com:/opt/gopath/src/github.com/hyperledger/fabric/
sudo rm mychannel.block
Now try rejoining peer0.org1.example.com to mychannel.