I currently have a running Kafka-based hyperledger running on docker.
The full container list is as such:
2x orderer
2x peer
1x certificate-authority
3x zookeeper
4x kafka nodes
1x cli tools
I have sucessfully created a channel using cli by the following command
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp/users/Admin#company/msp" peer0.company peer channel create -o orderer0.company:7050 -c messagebus -f /etc/hyperledger/configtx/channel.tx
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp/users/Admin#company/msp" peer0.company peer channel join -b messagebus.block
I can see the peer is joined using the following command:
docker exec cli peer channel list
2019-01-07 16:54:41.784 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
Channels peers has joined:
messagebus
I then want to init and instantiate my chaincode as such
#install the chaincode
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/company/users/Admin#company/msp" cli peer chaincode install -n testnet -v 1.0 -p "$CC_SRC_PATH" -l "$LANGUAGE"
2019-01-07 16:46:23.154 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2019-01-07 16:46:23.154 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2019-01-07 16:46:23.615 UTC [chaincodeCmd] install -> INFO 005 Installed remotely response:<status:200 payload:"OK" >
#instantiate the chaincode
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/company/users/Admin#company/msp" cli peer chaincode instantiate -o orderer0.company:7050 -C messagebus -n testnet -l "$LANGUAGE" -v 1.0 -c '{"Args":[""]}' -P "OR ('Org1MSP.member','Org2MSP.member')"
2019-01-07 16:46:24.210 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2019-01-07 16:46:24.210 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
Error: error endorsing chaincode: rpc error: code = Unknown desc = access denied: channel [messagebus] creator org [Org1MSP]
As the final line shows, the access is denied to the channel.
I am also unable to join a Java SDK client to the channel and receive similar access denied errors.
I see the following logs in the peer0 container:
2019-01-07 16:46:23.611 UTC [endorser] callChaincode -> INFO 0f1 [][bfb2e2d4] Entry chaincode: name:"lscc"
2019-01-07 16:46:23.614 UTC [lscc] executeInstall -> INFO 0f2 Installed Chaincode [gmex] Version [1.0] to peer
2019-01-07 16:46:23.614 UTC [endorser] callChaincode -> INFO 0f3 [][bfb2e2d4] Exit chaincode: name:"lscc" (2ms)
2019-01-07 16:46:23.614 UTC [comm.grpc.server] 1 -> INFO 0f4 unary call completed {"grpc.start_time": "2019-01-07T16:46:23.61Z", "grpc.service": "protos.Endorser", "grpc.method": "ProcessProposal", "grpc.peer_address": "XXX.XXX.X.XXX:123", "grpc.code": "OK", "grpc.call_duration": "3.771114ms"}
2019-01-07 16:46:24.214 UTC [protoutils] ValidateProposalMessage -> WARN 0f5 channel [messagebus]: MSP error: the supplied identity is not valid: x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.company")
this leads me to believe the peer is not correctly setup... however it is able to create the channel successfully.
Any pointers would be appreciated
I am trying to apply the packaging method for the chaincode which enables me to enforce signatures from multiple organizations and make sure that chaincode cannot be effectively instantiated if signatures from relevant participants in the channel are not collected.
a) From Org1 context:
# peer chaincode package -n mycc -p github.com/chaincode/chaincode_example02/go/ -v 1 -s -S -i "AND('Org1.admin','Org2.admin')" ccpack.out
2018-12-03 22:49:46.032 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-12-03 22:49:46.032 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
root#bdc554f0a918:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode signpackage ccpack.out signedccpack.out
Wrote signed package to signedccpack.out successfully
root#bdc554f0a918:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode install signedccpack.out
2018-12-03 22:50:21.125 UTC [chaincodeCmd] install -> INFO 001 Installed remotely response:<status:200 payload:"OK" >
b) From Org2 context:
root#bdc554f0a918:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode signpackage ccpack.out signedccpack.out
Wrote signed package to signedccpack.out successfully
root#bdc554f0a918:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode install signedccpack.out
2018-12-03 22:50:32.414 UTC [chaincodeCmd] install -> INFO 001 Installed remotely response:<status:200 payload:"OK" >
c) From either Org context:
root#bdc554f0a918:/opt/gopath/src/github.com/hyperledger/fabric/peer# 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 channel1 -n mycc -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
2018-12-03 22:50:42.946 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-12-03 22:50:42.950 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg cannot get package for chaincode (mycc:1.0)
d) The chaincode is present on Org1 Peer 1:
root#af99b3698322:/var/hyperledger/production/chaincodes# ls
mycc.1
e) The chaincode is present on Org2 Peer 1:
root#2fd1355259a8:/var/hyperledger/production/chaincodes# ls
mycc.1
Any recommendations as to the process or the cli syntax structure would be greatly appreciated.
I got the "Write your First Application" stuff working great.
So I copied the files and renamed stuff to support a different chaincode app.
When I run startFabric.sh node (since my source is javascript), I eventually get:
# don't rewrite paths for Windows Git Bash users
export MSYS_NO_PATHCONV=1
docker-compose -f docker-compose.yml down
Removing network net_basic
WARNING: Network net_basic not found.
docker-compose -f docker-compose.yml up -d ca.example.com orderer.example.com peer0.org1.example.com couchdb
Creating network "net_basic" with the default driver
Creating couchdb
Creating orderer.example.com
Creating ca.example.com
Creating peer0.org1.example.com
# wait for Hyperledger Fabric to start
# incase of errors when running later commands, issue export FABRIC_START_TIMEOUT=<larger number>
export FABRIC_START_TIMEOUT=10
#echo ${FABRIC_START_TIMEOUT}
sleep ${FABRIC_START_TIMEOUT}
# Create 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 create -o orderer.example.com:7050 -c mychannel -f /etc/hyperledger/configtx/channel.tx
2018-08-18 06:23:14.962 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-08-18 06:23:14.983 UTC [cli/common] readBlock -> INFO 002 Got status: &{NOT_FOUND}
2018-08-18 06:23:14.984 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-08-18 06:23:15.187 UTC [cli/common] readBlock -> INFO 004 Received block: 0
# 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
2018-08-18 06:23:15.407 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-08-18 06:23:15.481 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
Creating cli
2018-08-18 06:23:16.314 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-08-18 06:23:16.314 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2018-08-18 06:23:16.316 UTC [container] WriteFolderToTarPackage -> INFO 003 rootDirectory = /opt/gopath/src/github.com/permissioned-jpgs/node
2018-08-18 06:23:16.353 UTC [chaincodeCmd] install -> INFO 004 Installed remotely response:<status:200 payload:"OK" >
2018-08-18 06:23:16.590 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-08-18 06:23:16.590 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: endorsement failure during invoke. chaincode result: <nil>
Notice endorsement fails. Any ideas? I've checked everything I can think of and I'm completely stumped. Thanks!
My Docker ignorance is showing.
I just needed to view the logs for the peer node I was interacting with by doing: sudo docker logs -f dev-peer0.org1.example.com-fabcar-1.0
These logs showed me it was a problem with the Javascript I had written when customizing the chaincode, not a Fabric network config issue like I previously thought.
I have set up data persistence in the peer and the couchdb containers and have run through the commands with the marbles02 chaincode manually on peer0 Org1 in the cli container (with the command line commented in docker-compose-cli.yaml) without problem. The marbles are created and I can query them from both peer0 Org1 and peer0 Org2. However, when I create marbles on peer0 Org2, it seems that the initMarble function works but the marble is not really created. It does not exist in the couchdb and I cannot read it using the chaincode on peer0 Org1 or peer0 Org2.
How can I create marbles with the marbles02 chaincode on peer0 Org2? Thank You!
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 marbles -v 1.0 -p github.com/chaincode/marbles02/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 marbles -v 1.0 -p github.com/chaincode/marbles02/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 marbles -v 1.0 -c '{"Args":["init"]}' -P "OR ('Org0MSP.member','Org1MSP.member')"
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 marbles -c '{"Args":["initMarble","marble1","blue","35","tom"]}'
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 marbles -c '{"Args":["initMarble","marble2","red","50","tom"]}'
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 marbles -c '{"Args":["initMarble","marble3","blue","70","tom"]}'
# The output of the 2 following commands on peer0 Org1 is at the bottom
peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["readMarble","marble1"]}'
peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["getMarblesByRange","marble","marble9"]}'
# The output of the 2 following commands on peer0 Org2 is at the bottom
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 marbles -c '{"Args":["readMarble","marble1"]}'
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 marbles -c '{"Args":["getMarblesByRange","marble","marble9"]}'
# The output of the following initMarble command is at the bottom
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 marbles -c '{"Args":["initMarble","marble4","red","40","john"]}'
# The output of the 2 following commands on peer0 Org1 is at the bottom
peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["readMarble","marble1"]}'
peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["getMarblesByRange","marble","marble9"]}'
# The output of the 2 following commands on peer0 Org2 is at the bottom
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 marbles -c '{"Args":["readMarble","marble1"]}'
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 marbles -c '{"Args":["getMarblesByRange","marble","marble9"]}'
Output of the first two queries on peer0 Org1:
root#370bc984a456:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["readMarble","marble1"]}'
2018-01-26 17:51:22.809 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-01-26 17:51:22.809 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-01-26 17:51:22.809 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-01-26 17:51:22.809 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-01-26 17:51:22.809 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-01-26 17:51:22.810 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 0AAE070A6A08031A0C089AD5ADD30510...644D6172626C650A076D6172626C6531
2018-01-26 17:51:22.810 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: 4F366060889A2856285FC243DC170DE5EF24C3215156DAAA0CF61EDDE7177988
Query Result: {"color":"blue","docType":"marble","name":"marble1","owner":"tom","size":35}
2018-01-26 17:51:22.834 UTC [main] main -> INFO 008 Exiting.....
root#370bc984a456:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["getMarblesByRange","marble","marble9"]}'
2018-01-26 17:52:21.753 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-01-26 17:52:21.753 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-01-26 17:52:21.753 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-01-26 17:52:21.753 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-01-26 17:52:21.753 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-01-26 17:52:21.754 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 0AAE070A6A08031A0C08D5D5ADD30510...066D6172626C650A076D6172626C6539
2018-01-26 17:52:21.754 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: E03478475574EE33CA10C951A3D4CBC7B5F8FEF2F4C2EDC34C039CF4EFC614AD
Query Result: [{"Key":"marble1", "Record":{"color":"blue","docType":"marble","name":"marble1","owner":"tom","size":35}},{"Key":"marble2", "Record":{"color":"red","docType":"marble","name":"marble2","owner":"tom","size":50}},{"Key":"marble3", "Record":{"color":"blue","docType":"marble","name":"marble3","owner":"tom","size":70}}]
2018-01-26 17:52:21.782 UTC [main] main -> INFO 008 Exiting.....
Output of the first two queries on peer0 Org2:
root#370bc984a456:/opt/gopath/src/github.com/hyperledger/fabric/peer# 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 marbles -c '{"Args":["readMarble","marble1"]}'
2018-01-26 17:53:01.507 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-01-26 17:53:01.507 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-01-26 17:53:01.508 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-01-26 17:53:01.508 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-01-26 17:53:01.509 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-01-26 17:53:01.509 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 0AAE070A6A08031A0C08FDD5ADD30510...644D6172626C650A076D6172626C6531
2018-01-26 17:53:01.510 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: 1D08C870FDC0BE2CC2BE293ABF18BF1EBB73EDEC47425A132DD303DD222B557E
Query Result: {"color":"blue","docType":"marble","name":"marble1","owner":"tom","size":35}
2018-01-26 17:53:25.592 UTC [main] main -> INFO 008 Exiting.....
root#370bc984a456:/opt/gopath/src/github.com/hyperledger/fabric/peer# 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 marbles -c '{"Args":["getMarblesByRange","marble","marble9"]}'
2018-01-26 17:53:39.818 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-01-26 17:53:39.818 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-01-26 17:53:39.818 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-01-26 17:53:39.818 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-01-26 17:53:39.818 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-01-26 17:53:39.818 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 0AAE070A6A08031A0C08A3D6ADD30510...066D6172626C650A076D6172626C6539
2018-01-26 17:53:39.818 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: ACB6855D69BB8609BF5D07997193AC456BE2AACB0E9B9833FEEEA3E1FA944B34
Query Result: [{"Key":"marble1", "Record":{"color":"blue","docType":"marble","name":"marble1","owner":"tom","size":35}},{"Key":"marble2", "Record":{"color":"red","docType":"marble","name":"marble2","owner":"tom","size":50}},{"Key":"marble3", "Record":{"color":"blue","docType":"marble","name":"marble3","owner":"tom","size":70}}]
2018-01-26 17:53:39.859 UTC [main] main -> INFO 008 Exiting.....
Output of the initMarble (marble4) on peer0 Org2. No error is reported and everything looks good:
root#370bc984a456:/opt/gopath/src/github.com/hyperledger/fabric/peer# 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 marbles -c '{"Args":["initMarble","marble4","red","40","john"]}'
2018-01-26 17:53:57.895 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-01-26 17:53:57.895 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-01-26 17:53:57.913 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-01-26 17:53:57.913 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-01-26 17:53:57.913 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-01-26 17:53:57.914 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 0AAE070A6A08031A0C08B5D6ADD30510...340A037265640A0234300A046A6F686E
2018-01-26 17:53:57.914 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: 22F1EBED19D01BB926BC8333D8E6C20D7CEA98D67E3FBDB32A97C052034A42E0
2018-01-26 17:53:57.946 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0AAE070A6A08031A0C08B5D6ADD30510...963DE13101C543F98E6EB1DAD7504648
2018-01-26 17:53:57.947 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: EE16EB383E3F43FFC29004E899F20D2639463A9F13B592454EB202441112B42A
2018-01-26 17:53:57.979 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> DEBU 00a ESCC invoke result: version:1 response:<status:200 message:"OK" > payload:"\n \035\356\245\202T~!g\217H\243\371\265\212\016t\365|&\032\206\367\352\2240\246\3003\247\236G,\022\303\001\n\253\001\022\027\n\004lscc\022\017\n\r\n\007marbles\022\002\010\003\022\217\001\n\007marbles\022\203\001\n\t\n\007marble4\032\035\n\030\000color~name\000red\000marble4\000\032\001\000\032W\n\007marble4\032L{\"docType\":\"marble\",\"name\":\"marble4\",\"color\":\"red\",\"size\":40,\"owner\":\"john\"}\032\003\010\310\001\"\016\022\007marbles\032\0031.0" endorsement:<endorser:"\n\007Org2MSP\022\222\006-----BEGIN CERTIFICATE-----\nMIICGDCCAb+gAwIBAgIQYknfKWIh8KsyyPE57tFenjAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMi5leGFtcGxlLmNvbTAeFw0xODAxMjYxNzQxMzJaFw0yODAxMjQxNzQxMzJa\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcyLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7SAoZn22uMkwfrDItRK47xRRfkBIZLtN\n2vk1qdTt8IA53g3MjXMkAYeONaJE2BUyfYjhU+ghaZyv153Kzs8EDaNNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgQrkMYeoaoiK6\nnRCVankLQpgURiWVC9Av/sxHBo9gBuAwCgYIKoZIzj0EAwIDRwAwRAIgJy2H0bV2\nYh788eAEdSu8qxLTO9wZrXDrjjw7HiOIikoCIE1lP0P1Y18W0HWYQ8iva6CyEQd2\noQIsD5MBLlSjMCEP\n-----END CERTIFICATE-----\n" signature:"0E\002!\000\255\313\361\004=A&\277\270\222\330s\227\014\251\207\324\372\323\321\317\204\026\240\276\312\231\372(\306\367~\002 }\207\333z\0049!WnE\032\2346K\027\364\226=\3411\001\305C\371\216n\261\332\327PFH" >
2018-01-26 17:53:57.979 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 00b Chaincode invoke successful. result: status:200
2018-01-26 17:53:57.979 UTC [main] main -> INFO 00c Exiting.....
Output of the second two queries on peer0 Org1. The new marble4 is not found. It does not exist in any couchdb either:
root#370bc984a456:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["readMarble","marble1"]}'
2018-01-26 17:54:32.695 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-01-26 17:54:32.695 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-01-26 17:54:32.695 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-01-26 17:54:32.695 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-01-26 17:54:32.696 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-01-26 17:54:32.696 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 0AAE070A6A08031A0C08D8D6ADD30510...644D6172626C650A076D6172626C6531
2018-01-26 17:54:32.696 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: A057F20C69546CB01ED6E9F858E1CD066BC5FC3476F92BC5A5902E44DEA9E68E
Query Result: {"color":"blue","docType":"marble","name":"marble1","owner":"tom","size":35}
2018-01-26 17:54:32.799 UTC [main] main -> INFO 008 Exiting.....
root#370bc984a456:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["getMarblesByRange","marble","marble9"]}'
2018-01-26 17:54:44.238 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-01-26 17:54:44.238 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-01-26 17:54:44.239 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-01-26 17:54:44.239 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-01-26 17:54:44.239 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-01-26 17:54:44.239 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 0AAD070A6908031A0B08E4D6ADD30510...066D6172626C650A076D6172626C6539
2018-01-26 17:54:44.239 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: C2A0ADD3589727D58B7DB1320980CD9F21416B7352E1BFAE8AF35603FB45BE1A
Query Result: [{"Key":"marble1", "Record":{"color":"blue","docType":"marble","name":"marble1","owner":"tom","size":35}},{"Key":"marble2", "Record":{"color":"red","docType":"marble","name":"marble2","owner":"tom","size":50}},{"Key":"marble3", "Record":{"color":"blue","docType":"marble","name":"marble3","owner":"tom","size":70}}]
2018-01-26 17:54:44.278 UTC [main] main -> INFO 008 Exiting.....
Output of the second two queries on peer0 Org2. The new marble4 is not found. It does not exist in any couchdb either:
root#370bc984a456:/opt/gopath/src/github.com/hyperledger/fabric/peer# 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 marbles -c '{"Args":["readMarble","marble1"]}'
2018-01-26 17:54:55.967 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-01-26 17:54:55.967 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-01-26 17:54:55.968 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-01-26 17:54:55.968 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-01-26 17:54:55.968 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-01-26 17:54:55.968 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 0AAE070A6A08031A0C08EFD6ADD30510...644D6172626C650A076D6172626C6531
2018-01-26 17:54:55.968 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: BE24E989B610A67B9ABE249142AA8E986B0BF65F722F850E26E095038529664D
Query Result: {"color":"blue","docType":"marble","name":"marble1","owner":"tom","size":35}
2018-01-26 17:54:56.001 UTC [main] main -> INFO 008 Exiting.....
root#370bc984a456:/opt/gopath/src/github.com/hyperledger/fabric/peer# 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 marbles -c '{"Args":["getMarblesByRange","marble","marble9"]}'
2018-01-26 17:55:05.856 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-01-26 17:55:05.856 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-01-26 17:55:05.856 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-01-26 17:55:05.856 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-01-26 17:55:05.856 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java chaincode disabled
2018-01-26 17:55:05.857 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 0AAE070A6A08031A0C08F9D6ADD30510...066D6172626C650A076D6172626C6539
2018-01-26 17:55:05.857 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: B1916904CFD8D2908F9BE2A88986D4B93D299F0647D816A2849A9984F688F81F
Query Result: [{"Key":"marble1", "Record":{"color":"blue","docType":"marble","name":"marble1","owner":"tom","size":35}},{"Key":"marble2", "Record":{"color":"red","docType":"marble","name":"marble2","owner":"tom","size":50}},{"Key":"marble3", "Record":{"color":"blue","docType":"marble","name":"marble3","owner":"tom","size":70}}]
2018-01-26 17:55:05.893 UTC [main] main -> INFO 008 Exiting.....
This is caused by my own mistake. When I instantiate the chaincode, I have specified the wrong endorsement policy:
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 marbles -v 1.0 -c '{"Args":["init"]}' -P "OR ('Org0MSP.member','Org1MSP.member')"
Org0MSP does not exist and Org2MSP for Org2 is not on the policy. So, the transaction does not really go through.
The correct policy should be
-P "OR ('Org1MSP.member','Org2MSP.member')"
After fixing the instantiate command, everything works as expected in both peer0 Org1 and peer0 Org2.
However, why is there no error or exception reported? If you know how the fabric internal works in this case of mistake, please advise and I will very much appreciate your input. Thank You!
I have downloaded and setup the hyperledger fabric network in my CentOs system. I am able to start the first network with default two organization (Org1 and Org2). Also each organization is having two peers(peer0, peer1). Now I am trying add one more Organization with one peer.
I have made changes in below files
first-network/crypto-config.yaml
first-network/configtx.yaml
first-network/docker-compose-cli.yaml
first-network/base/docker-compose-base.yaml
first-network/script/script.sh
now while trying to up the network. Below exception is coming
Having all peers join the channel...
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_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_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
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_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2017-09-06 06:40:53.134 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2017-09-06 06:40:53.134 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-09-06 06:40:53.136 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2017-09-06 06:40:53.136 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A89070A5B08011A0B08F5B0BECD0510...742FDE921B171A080A000A000A000A00
2017-09-06 06:40:53.136 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 152A1C5D481840FB755E98925E0D346271894F15AB69E694C03BEC962E523A50
Error: proposal failed (err: rpc error: code = Unknown desc = Failed to deserialize creator identity, err Expected MSP ID org1MSP, received Org1MSP)
Usage:
peer channel join [flags]
Flags:
-b, --blockpath string Path to file containing genesis block
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
-v, --version Display current version of fabric peer server
PEER0 failed to join the channel, Retry after 2 seconds