Unable to install chaincode on hyperledger fabric based peer - hyperledger-fabric

When I tried below command
echo -e "Installing chaincode on peer2 of org2 now....\n"
docker exec -e CORE_PEER_LOCALMSPID=Org2MSP \
-e CORE_PEER_ADDRESS=peer2.org2.example.com:7051 \
-e CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer2.org2.example.com/tls/server.crt \
-e CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer2.org2.example.com/tls/server.key \
-e CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer2.org2.example.com/tls/ca.crt \
-e CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin#org2.example.com/msp \
cli peer lifecycle chaincode install basic.tar.gz
I am getting following error. I could install chaincode on all other peers successfully.
2022-01-27 13:13:33.744 UTC [endorser] ProcessProposal -> WARN 121 Failed to invoke chaincode channel= chaincode=_lifecycle error="error in simulation: failed to execute transaction cfe6ea05af60787c665900fd685a5f037098a3adb3137f3a48db6b0e643ae440: error sending: timeout expired while executing transaction"
2022-01-27 13:13:33.744 UTC [comm.grpc.server] 1 -> INFO 122 unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.18.0.7:59556 grpc.code=OK grpc.call_duration=5m0.004667347s
2022-01-27 13:23:28.627 UTC [gossip.privdata] StoreBlock -> INFO 123 Received block [9] from buffer channel=channelone
2022-01-27 13:23:28.631 UTC [committer.txvalidator] Validate -> INFO 124 [channelone] Validated block [9] in 3ms
2022-01-27 13:23:28.667 UTC [kvledger] CommitLegacy -> INFO 125 [channelone] Committed block [9] with 1 transaction(s) in 29ms (state_validation=0ms block_and_pvtdata_commit=5ms state_commit=1ms) commitHash=[ce41d01661edff937d020d18a8facadd67a94368773f1ab31db92bbd4ff54026]
2022-01-27 13:34:57.933 UTC [endorser] callChaincode -> INFO 126 finished chaincode: _lifecycle duration: 300001ms channel= txID=9d859382
2022-01-27 13:34:57.934 UTC [endorser] SimulateProposal -> ERRO 127 failed to invoke chaincode _lifecycle, error: timeout expired while executing transaction
github.com/hyperledger/fabric/core/chaincode.(*Handler).Execute
/go/src/github.com/hyperledger/fabric/core/chaincode/handler.go:1181
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).execute
/go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:272
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Invoke

Related

Hyperledger Fabric ProcessProposal -> Failed to invoke chaincode channel= chaincode=_lifecycle

I am running Hyperledger Fabric and while trying to install the chaincode on peer0.org1, "peer lifecycle chaincode install basic.tar.gz", I run into some errors and can not install it -- Error: chaincode install failed with status: 500 - error in simulation: failed to execute transaction ee4a6ae0672861fa153e7fd5cd797e59b3eeebf1d2950ccd9e13e8231de484a9: error sending: timeout expired while executing transaction.
Below I will share the logs. Can anyone tell me what should I do? I have tried to reinstall it but with no success.
----logs---
2022-08-28 16:10:46.246 UTC 004a INFO [chaincode.externalbuilder.ccaas_builder] waitForExit -> ::Error: chaincode type not supported: node command=detect
2022-08-28 16:14:33.640 UTC 004b WARN [peer.blocksprovider] func1 -> Encountered an error reading from deliver stream: rpc error: code = Unavailable desc = transport is closing channel=mychannel orderer-address=orderer.example.com:7050
2022-08-28 16:14:33.640 UTC 004c WARN [peer.blocksprovider] DeliverBlocks -> Orderer hung up without sending status channel=mychannel orderer-address=orderer.example.com:7050
2022-08-28 16:15:46.750 UTC 004d INFO [endorser] callChaincode -> finished chaincode: _lifecycle duration: 300000ms channel= txID=ee4a6ae0
2022-08-28 16:15:46.778 UTC 004e ERRO [endorser] simulateProposal -> failed to invoke chaincode _lifecycle, error: timeout expired while executing transaction
github.com/hyperledger/fabric/core/chaincode.(*Handler).Execute
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1571 channel= txID=ee4a6ae0
2022-08-28 16:15:46.778 UTC 004f WARN [endorser] ProcessProposal -> Failed to invoke chaincode channel= chaincode=_lifecycle error="error in simulation: failed to execute transaction ee4a6ae0672861fa153e7fd5cd797e59b3eeebf1d2950ccd9e13e8231de484a9: error sending: timeout expired while executing transaction"
2022-08-28 16:15:46.778 UTC 0050 INFO [comm.grpc.server] 1 -> unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.21.0.1:51150 grpc.code=OK grpc.call_duration=5m0.029919322s
2022-08-28 16:16:03.168 UTC 0051 INFO [lifecycle] InstallChaincode -> Successfully installed chaincode with package ID 'basic_1.0:9821071a953f452bda87fe89637d1e377dac825da4649ba998464a3c85d60c50'
2022-08-28 16:20:33.471 UTC 0052 WARN [peer.blocksprovider] func1 -> Encountered an error reading from deliver stream: rpc error: code = Unavailable desc = transport is closing channel=mychannel orderer-address=orderer.example.com:7050
2022-08-28 16:20:33.471 UTC 0053 WARN [peer.blocksprovider] DeliverBlocks -> Orderer hung up without sending status channel=mychannel orderer-address=orderer.example.com:7050

Hyperledger Fabric 2.4 approve chaincode error

I'm setting up an hyperledger fabric network with docker compose.
All the containers are up and running but i'm having problems with the appprovemyorg command.
These are the logs of the peer after joining the channel:
2022-05-24 07:41:54.316 UTC 0023 INFO [ledgermgmt] CreateLedger -> Creating ledger [mychannel] with genesis block
2022-05-24 07:41:54.319 UTC 0024 INFO [blkstorage] newBlockfileMgr -> Getting block information from block storage
2022-05-24 07:41:54.328 UTC 0025 INFO [kvledger] commit -> [mychannel] Committed block [0] with 1 transaction(s) in 6ms (state_validation=0ms block_and_pvtdata_commit=3ms state_commit=1ms) commitHash=[]
2022-05-24 07:41:54.328 UTC 0026 INFO [kvledger] updateLedgerStatus -> Updating ledger [mychannel] status to [ACTIVE]
2022-05-24 07:41:54.329 UTC 0027 INFO [ledgermgmt] CreateLedger -> Created ledger [mychannel] with genesis block
2022-05-24 07:41:54.332 UTC 0028 INFO [gossip.gossip] JoinChan -> Joining gossip network of channel mychannel with 1 organizations
2022-05-24 07:41:54.332 UTC 0029 INFO [gossip.gossip] learnAnchorPeers -> No configured anchor peers of org1MSP for channel mychannel to learn about
2022-05-24 07:41:54.333 UTC 002a INFO [gateway] configUpdate -> Updating orderer config channel=mychannel
2022-05-24 07:41:54.333 UTC 002b INFO [gossip.state] NewGossipStateProvider -> Updating metadata information for channel mychannel, current ledger sequence is at = 0, next expected block is = 1
2022-05-24 07:41:54.333 UTC 002c INFO [endorser] callChaincode -> finished chaincode: cscc duration: 21ms channel= txID=a704dc84
2022-05-24 07:41:54.333 UTC 002d INFO [comm.grpc.server] 1 -> unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.22.0.9:59204 grpc.code=OK grpc.call_duration=22.209824ms
2022-05-24 07:42:00.335 UTC 002e INFO [gossip.election] beLeader -> 49ad88f230e73d14bb6f9b8a891c0f5bc47a35cd793ff62222e489f762864a33 : Becoming a leader
2022-05-24 07:42:00.335 UTC 002f INFO [gossip.service] func1 -> Elected as a leader, starting delivery service for channel mychannel
2022-05-24 07:42:00.335 UTC 0030 INFO [deliveryClient] StartDeliverForChannel -> This peer will retrieve blocks from ordering service and disseminate to other peers in the organization for channel mychannel
2022-05-24 07:30:08.206 UTC 0031 WARN [peer.blocksprovider] DeliverBlocks -> Could not connect to ordering service: could not dial endpoint 'orderer2:8050': failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 0.0.0.0:8050: connect: connection refused" channel=mychannel
2022-05-24 07:30:08.307 UTC 0032 WARN [peer.blocksprovider] DeliverBlocks -> Could not connect to ordering service: could not dial endpoint 'orderer3:9050': failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 0.0.0.0:9050: connect: connection refused" channel=mychannel
2022-05-24 07:30:08.428 UTC 0033 WARN [peer.blocksprovider] DeliverBlocks -> Could not connect to ordering service: could not dial endpoint 'orderer1:7050': failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 0.0.0.0:7050: connect: connection refused" channel=mychannel
As you can see, i have some warnings but I can safely join the channel and I have no problems at all when i install the chaincode (the warnings disappear too).
These are the logs on the peer after installing the chaincode:
2022-05-24 07:45:17.017 UTC 0052 INFO [chaincode.externalbuilder.ccaas_builder] waitForExit -> ::Detect command=detect
2022-05-24 07:45:17.017 UTC 0053 INFO [chaincode.externalbuilder.ccaas_builder] waitForExit -> ::Error: chaincode type not supported: java command=detect
2022-05-24 07:45:17.023 UTC 0054 INFO [lifecycle] InstallChaincode -> Successfully installed chaincode with package ID 'testchaincode_1:de8cddcb2deda13a7a3c1e9f6e37764e6d2c1bb6f89bac1f0d2c6396587b35f7'
2022-05-24 07:45:17.023 UTC 0055 INFO [endorser] callChaincode -> finished chaincode: _lifecycle duration: 14ms channel= txID=694acf7b
2022-05-24 07:45:17.023 UTC 0056 INFO [comm.grpc.server] 1 -> unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.22.0.9:59206 grpc.code=OK grpc.call_duration=15.8101ms
When i try to approve the chaincode with this command:
peer lifecycle chaincode approveformyorg --tls --cafile /tmp/hyperledger/org1/peer1/tls-msp/tlscacerts/tls-tls-ca-7052.pem -o orderer1:7050 --ordererTLSHostnameOverride orderer1 --channelID mychannel --name mycc --version 1 --sequence 1 --waitForEvent --init-required --package-id testchaincode_1:de8cddcb2deda13a7a3c1e9f6e37764e6d2c1bb6f89bac1f0d2c6396587b35f7
I have this error:
Error: timed out waiting for txid on all peers
With these logs on the peer:
2022-05-24 07:46:54.303 UTC 0059 INFO [lifecycle] ApproveChaincodeDefinitionForOrg -> Successfully endorsed chaincode approval with name 'mycc', package ID 'testchaincode_1:de8cddcb2deda13a7a3c1e9f6e37764e6d2c1bb6f89bac1f0d2c6396587b35f7', on channel 'mychannel' with definition {sequence: 1, endorsement info: (version: '1', plugin: 'escc', init required: true), validation info: (plugin: 'vscc', policy: '12202f4368616e6e656c2f4170706c69636174696f6e2f456e646f7273656d656e74'), collections: ()}
2022-05-24 07:46:54.303 UTC 005a INFO [endorser] callChaincode -> finished chaincode: _lifecycle duration: 0ms channel=mychannel txID=d56b21b6
2022-05-24 07:46:54.308 UTC 005b INFO [comm.grpc.server] 1 -> unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.22.0.9:59210 grpc.code=OK grpc.call_duration=6.78249ms
2022-05-24 07:46:55.194 UTC 005c WARN [peer.blocksprovider] DeliverBlocks -> Could not connect to ordering service: could not dial endpoint 'orderer1:7050': failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 0.0.0.0:7050: connect: connection refused" channel=mychannel
2022-05-24 07:47:24.311 UTC 005d INFO [comm.grpc.server] 1 -> streaming call completed grpc.service=protos.Deliver grpc.method=DeliverFiltered grpc.request_deadline=2022-05-24T07:47:24.31Z grpc.peer_address=172.22.0.9:59212 error="context finished before block retrieved: context deadline exceeded" grpc.code=Unknown grpc.call_duration=30.0006887s
2022-05-24 07:47:54.260 UTC 005e WARN [peer.blocksprovider] DeliverBlocks -> Could not connect to ordering service: could not dial endpoint 'orderer2:8050': failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 0.0.0.0:8050: connect: connection refused" channel=mychannel
So i can't approve the chaincode and advance in the process.
Can anyone help me solve this problem?
Thanks

FabCar Hyperledger Fabric ./startFabric.sh execution is not completely working

Im experimenting Hyperledger Fabric FabCar basic example.
Successfully registered admin and user, using registerAdmin.js and registerUser.js. I am currently facing this error after running node query.js.
~/fabric-samples/fabcar$ node query.js
Store path:/home/****/fabric-samples/fabcar/hfc-key-store
Successfully loaded user1 from persistence
2020-02-21T07:08:00.564Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpc://localhost:7051
Query has completed, checking results
error from query = { Error: Failed to connect before the deadline URL:grpc://localhost:7051
at checkState (/home/****/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/client.js:833:16) connectFailed: true }
That was mentioned similarly in my previous question
While checking docker ps -a , I could find the peer got exited
~/fabric-samples/fabcar$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1619413cd23c hyperledger/fabric-peer "peer node start" 13 minutes ago Exited (2) 12 minutes ago peer0.org1.example.com
de74d2459574 hyperledger/fabric-couchdb "tini -- /docker-ent…" 13 minutes ago Up 13 minutes 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb
356fb281acbe hyperledger/fabric-orderer "orderer" 13 minutes ago Up 13 minutes 0.0.0.0:7050->7050/tcp orderer.example.com
5e52be445c99 hyperledger/fabric-ca "sh -c 'fabric-ca-se…" 13 minutes ago Up 13 minutes 0.0.0.0:7054->7054/tcp ca.example.com
after checking the workflow I found that the ./startFabric.sh execution is not completely running, it got exited after INFO 001 Endorser and orderer connections initialized.
~/fabric-samples/fabcar$ ./startFabric.sh
# 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
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 ca.example.com ... done
Creating couchdb ... done
Creating orderer.example.com ... done
Creating peer0.org1.example.com ... done
# 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
2020-02-21 07:07:06.183 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-21 07:07:06.222 UTC [channelCmd] InitCmdFactory -> INFO 002 Endorser and orderer connections initialized
2020-02-21 07:07:06.432 UTC [main] main -> INFO 003 Exiting.....
# 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
2020-02-21 07:07:06.907 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
:~/fabric-samples/fabcar$
Kindly advise.
*Updated with the Docker logs of the Conatiner:
2020-02-21 08:51:13.123 UTC [nodeCmd] serve -> INFO 001 Starting peer:
Version: 1.1.0
Go version: go1.9.2
OS/Arch: linux/amd64
Experimental features: false
Chaincode:
Base Image Version: 0.4.6
Base Docker Namespace: hyperledger
Base Docker Label: org.hyperledger.fabric
Docker Namespace: hyperledger
2020-02-21 08:51:13.123 UTC [ledgermgmt] initialize -> INFO 002 Initializing ledger mgmt
2020-02-21 08:51:13.123 UTC [kvledger] NewProvider -> INFO 003 Initializing ledger provider
2020-02-21 08:51:13.795 UTC [couchdb] CreateDatabaseIfNotExist -> INFO 004 Created state database _users
2020-02-21 08:51:14.058 UTC [couchdb] CreateDatabaseIfNotExist -> INFO 005 Created state database _replicator
2020-02-21 08:51:14.326 UTC [couchdb] CreateDatabaseIfNotExist -> INFO 006 Created state database _global_changes
2020-02-21 08:51:14.366 UTC [kvledger] NewProvider -> INFO 007 ledger provider Initialized
2020-02-21 08:51:14.366 UTC [ledgermgmt] initialize -> INFO 008 ledger mgmt initialized
2020-02-21 08:51:14.367 UTC [peer] func1 -> INFO 009 Auto-detected peer address: 172.25.0.5:7051
2020-02-21 08:51:14.368 UTC [peer] func1 -> INFO 00a Returning peer0.org1.example.com:7051
2020-02-21 08:51:14.368 UTC [peer] func1 -> INFO 00b Auto-detected peer address: 172.25.0.5:7051
2020-02-21 08:51:14.368 UTC [peer] func1 -> INFO 00c Returning peer0.org1.example.com:7051
2020-02-21 08:51:14.373 UTC [eventhub_producer] start -> INFO 00d Event processor started
2020-02-21 08:51:14.374 UTC [nodeCmd] computeChaincodeEndpoint -> INFO 00e Entering computeChaincodeEndpoint with peerHostname: peer0.org1.example.com
2020-02-21 08:51:14.375 UTC [nodeCmd] computeChaincodeEndpoint -> INFO 00f Exit with ccEndpoint: peer0.org1.example.com:7052
2020-02-21 08:51:14.375 UTC [nodeCmd] createChaincodeServer -> WARN 010 peer.chaincodeListenAddress is not set, using peer0.org1.example.com:7052
2020-02-21 08:51:14.378 UTC [chaincode] NewChaincodeSupport -> INFO 011 Chaincode support using peerAddress: peer0.org1.example.com:7052
2020-02-21 08:51:14.379 UTC [sccapi] registerSysCC -> INFO 012 system chaincode cscc(github.com/hyperledger/fabric/core/scc/cscc) registered
2020-02-21 08:51:14.380 UTC [sccapi] registerSysCC -> INFO 013 system chaincode lscc(github.com/hyperledger/fabric/core/scc/lscc) registered
2020-02-21 08:51:14.380 UTC [sccapi] registerSysCC -> INFO 014 system chaincode escc(github.com/hyperledger/fabric/core/scc/escc) registered
2020-02-21 08:51:14.380 UTC [sccapi] registerSysCC -> INFO 015 system chaincode vscc(github.com/hyperledger/fabric/core/scc/vscc) registered
2020-02-21 08:51:14.380 UTC [sccapi] registerSysCC -> INFO 016 system chaincode qscc(github.com/hyperledger/fabric/core/chaincode/qscc) registered
2020-02-21 08:51:14.382 UTC [gossip/service] func1 -> INFO 017 Initialize gossip with endpoint peer0.org1.example.com:7051 and bootstrap set [127.0.0.1:7051]
2020-02-21 08:51:14.386 UTC [msp] DeserializeIdentity -> INFO 018 Obtaining identity
2020-02-21 08:51:14.389 UTC [gossip/discovery] NewDiscoveryService -> INFO 019 Started { [] [61 97 241 125 96 173 40 203 239 81 147 191 102 161 39 23 0 117 69 217 56 120 139 152 120 223 29 9 23 115 238 6] peer0.org1.example.com:7051 <nil>} incTime is 1582275074389049506
2020-02-21 08:51:14.389 UTC [gossip/gossip] NewGossipService -> INFO 01a Creating gossip service with self membership of { [] [61 97 241 125 96 173 40 203 239 81 147 191 102 161 39 23 0 117 69 217 56 120 139 152 120 223 29 9 23 115 238 6] peer0.org1.example.com:7051 <nil>}
2020-02-21 08:51:14.392 UTC [gossip/gossip] NewGossipService -> WARN 01b External endpoint is empty, peer will not be accessible outside of its organization
2020-02-21 08:51:14.392 UTC [gossip/gossip] start -> INFO 01c Gossip instance peer0.org1.example.com:7051 started
2020-02-21 08:51:14.393 UTC [cscc] Init -> INFO 01d Init CSCC
2020-02-21 08:51:14.393 UTC [sccapi] deploySysCC -> INFO 01e system chaincode cscc/(github.com/hyperledger/fabric/core/scc/cscc) deployed
2020-02-21 08:51:14.394 UTC [sccapi] deploySysCC -> INFO 01f system chaincode lscc/(github.com/hyperledger/fabric/core/scc/lscc) deployed
2020-02-21 08:51:14.395 UTC [escc] Init -> INFO 020 Successfully initialized ESCC
2020-02-21 08:51:14.395 UTC [sccapi] deploySysCC -> INFO 021 system chaincode escc/(github.com/hyperledger/fabric/core/scc/escc) deployed
2020-02-21 08:51:14.395 UTC [sccapi] deploySysCC -> INFO 022 system chaincode vscc/(github.com/hyperledger/fabric/core/scc/vscc) deployed
2020-02-21 08:51:14.396 UTC [qscc] Init -> INFO 023 Init QSCC
2020-02-21 08:51:14.396 UTC [sccapi] deploySysCC -> INFO 024 system chaincode qscc/(github.com/hyperledger/fabric/core/chaincode/qscc) deployed
2020-02-21 08:51:14.396 UTC [nodeCmd] initSysCCs -> INFO 025 Deployed system chaincodes
2020-02-21 08:51:14.397 UTC [nodeCmd] serve -> INFO 026 Starting peer with ID=[name:"peer0.org1.example.com" ], network ID=[dev], address=[peer0.org1.example.com:7051]
2020-02-21 08:51:14.398 UTC [nodeCmd] serve -> INFO 027 Started peer with ID=[name:"peer0.org1.example.com" ], network ID=[dev], address=[peer0.org1.example.com:7051]
2020-02-21 08:51:24.451 UTC [ledgermgmt] CreateLedger -> INFO 028 Creating ledger [mychannel] with genesis block
2020-02-21 08:51:24.488 UTC [fsblkstorage] newBlockfileMgr -> INFO 029 Getting block information from block storage
2020-02-21 08:51:25.005 UTC [couchdb] CreateDatabaseIfNotExist -> INFO 02a Created state database mychannel_
2020-02-21 08:51:25.145 UTC [kvledger] CommitWithPvtData -> INFO 02b Channel [mychannel]: Committed block [0] with 1 transaction(s)
2020-02-21 08:51:25.151 UTC [couchdb] CreateCouchDatabase -> ERRO 02c Error during CouchDB CreateDatabaseIfNotExist() for dbName: mychannel_ error: json: cannot unmarshal string into Go struct field DBInfo.purge_seq of type int
panic: Error during commit to txmgr:json: cannot unmarshal string into Go struct field DBInfo.purge_seq of type int
goroutine 87 [running]:
github.com/hyperledger/fabric/core/ledger/kvledger.(*kvLedger).CommitWithPvtData(0xc420058180, 0xc4215a7200, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/kv_ledger.go:251 +0x921
github.com/hyperledger/fabric/core/ledger/kvledger.(*Provider).Create(0xc4201aa200, 0xc4216da360, 0x27, 0xc421708250, 0x1, 0x1)
/opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/kv_ledger_provider.go:107 +0x37f
github.com/hyperledger/fabric/core/ledger/ledgermgmt.CreateLedger(0xc4216da360, 0x0, 0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/core/ledger/ledgermgmt/ledger_mgmt.go:88 +0x1ac
github.com/hyperledger/fabric/core/peer.CreateChainFromBlock(0xc4216da360, 0x40000000000, 0x10)
/opt/gopath/src/github.com/hyperledger/fabric/core/peer/peer.go:433 +0x64
github.com/hyperledger/fabric/core/scc/cscc.joinChain(0xc42165d360, 0x9, 0xc4216da360, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/core/scc/cscc/configure.go:212 +0x65
github.com/hyperledger/fabric/core/scc/cscc.(*PeerConfiger).Invoke(0x169e160, 0x166f740, 0xc42032d220, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/core/scc/cscc/configure.go:140 +0xa1e
github.com/hyperledger/fabric/core/chaincode/shim.(*Handler).handleTransaction.func1(0xc4202419d0, 0xc4216bed80)
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/handler.go:329 +0x4f3
created by github.com/hyperledger/fabric/core/chaincode/shim.(*Handler).handleTransaction
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/handler.go:295 +0x49
I solved the above issues, by editing the file start.sh from the path fabric-samples/basic-network with the below,
# wait for Hyperledger Fabric to start
# incase of errors when running later commands, issue export FABRIC_START_TIMEOUT=<larger number>
#FABRIC_START_TIMEOUT changed to 90 instead of 10
export FABRIC_START_TIMEOUT=90 #default=10
#echo ${FABRIC_START_TIMEOUT}
sleep ${FABRIC_START_TIMEOUT}
along with that I followed the answer,
I included
dns_search: .
to the peer containers in the docker-compose.yml file located in fabric-samples/basic-network with the below.
peer0.org1.example.com:
container_name: peer0.org1.example.com
image: hyperledger/fabric-peer
dns_search: .
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.org1.example.com
- CORE_LOGGING_PEER=debug
- CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
# # the following setting starts chaincode containers on the same
# # bridge network as the peers
# # https://docs.docker.com/compose/networking/
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_basic
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984
# The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
# provide the credentials for ledger to connect to CouchDB. The username and password must
# match the username and password set for the associated CouchDB.
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: peer node start
# command: peer node start --peer-chaincodedev=true
ports:
- 7051:7051
- 7053:7053
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/msp/peer
- ./crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/msp/users
- ./config:/etc/hyperledger/configtx
depends_on:
- orderer.example.com
- couchdb # ***i included couchdb***
networks:
- basic
The above edits resolved my issues, and now ./startFabric.sh and node query.js were working properly.
~/fabric-samples/fabcar$ node query.js
Store path:/home/inforios/fabric-samples/fabcar/hfc-key-store
Successfully loaded user1 from persistence
Query has completed, checking results
Response is [{"Key":"CAR0", "Record":{"colour":"blue","make":"Toyota","model":"Prius","owner":"Tomoko"}},{"Key":"CAR1", "Record":{"colour":"red","make":"Ford","model":"Mustang","owner":"Brad"}},{"Key":"CAR2", "Record":{"colour":"green","make":"Hyundai","model":"Tucson","owner":"Jin Soo"}},{"Key":"CAR3", "Record":{"colour":"yellow","make":"Volkswagen","model":"Passat","owner":"Max"}},{"Key":"CAR4", "Record":{"colour":"black","make":"Tesla","model":"S","owner":"Adriana"}},{"Key":"CAR5", "Record":{"colour":"purple","make":"Peugeot","model":"205","owner":"Michel"}},{"Key":"CAR6", "Record":{"colour":"white","make":"Chery","model":"S22L","owner":"Aarav"}},{"Key":"CAR7", "Record":{"colour":"violet","make":"Fiat","model":"Punto","owner":"Pari"}},{"Key":"CAR8", "Record":{"colour":"indigo","make":"Tata","model":"Nano","owner":"Valeria"}},{"Key":"CAR9", "Record":{"colour":"brown","make":"Holden","model":"Barina","owner":"Shotaro"}}]
thanks to Faisal and Aditya Arora for their valuable responses.

Hyperledger - peer unable to instantiate chaincode after joining channel

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

endorser client failed to connect to peer0.org3.example.com:7051

I want to adding an org3 to an lanuched fabric-network based this tutorials:
https://hyperledger-fabric.readthedocs.io/en/release-1.2/channel_update_tutorial.html
but when I execute this command finally
peer channel join -b mychannel.block
it appears this error:
Error: error getting endorser client for channel: endorser client failed to connect to peer0.org3.example.com:7051: failed to create new connection: context deadline exceeded
when I look the logs :
docker logs -f peer0.org1.example.com
it seems right:
2018-10-12 02:18:29.902 UTC [lscc] executeInstall -> INFO 032 Installed Chaincode [mycc] Version [1.0] to peer
2018-10-12 02:18:52.555 UTC [cceventmgmt] HandleStateUpdates -> INFO 033 Channel [mychannel]: Handling LSCC state update for chaincode [mycc]
2018-10-12 02:18:52.571 UTC [kvledger] CommitWithPvtData -> INFO 034 Channel [mychannel]: Committed block [3] with 1 transaction(s)
2018-10-12 02:18:53.785 UTC [golang-platform] GenerateDockerBuild -> INFO 035 building chaincode with ldflagsOpt: '-ldflags "-linkmode external -extldflags '-static'"'
2018-10-12 02:18:53.785 UTC [golang-platform] GenerateDockerBuild -> INFO 036 building chaincode with tags:
2018-10-12 02:19:17.969 UTC [kvledger] CommitWithPvtData -> INFO 037 Channel [mychannel]: Committed block [4] with 1 transaction(s)
2018-10-12 02:21:56.351 UTC [gossip/gossip] learnAnchorPeers -> INFO 038 Anchor peer with same endpoint, skipping connecting to myself
2018-10-12 02:21:56.404 UTC [kvledger] CommitWithPvtData -> INFO 039 Channel [mychannel]: Committed block [5] with 1 transaction(s)
so I want to ask why appears this question and how can I solve this problm? many thanks.
I have had the same problem with Hyperledger Fabric V1.4. I seems like the problem is with GOLANG. Add this 'GODEBUG=netdns=go' to your environment variables. I hope this helps.
peer0.org1.example.com:
container_name: peer0.org1.example.com
image: hyperledger/fabric-peer:latest
environment:
- GODEBUG=netdns=go
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.org1.example.com

Resources