Error when try to instantiate chain-code on Hyperledger Fabric
Asked Answered
A

6

10

I was trying to create a custom business network based on the specification described here: https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#using-couchdb

I have created 5 peers for org1.example.com and one peer for org2.example.com.

I am able to start the network and to install chain-code using docker cli on peer0.org1.example.com, but when I try to instantiate it, I get he following error:

Error: Error endorsing chaincode: rpc error: code = Unknown desc = Error starting container: API error (404): {"message":"network _byfn not found"}

Here is the output for the businees network logger:

peer0.org1.example.com    | 2017-10-16 15:59:20.826 UTC [ccprovider] NewCCContext -> DEBU 3c1 NewCCCC (chain=c1,chaincode=mycc,version=1.0,txid=cc0e1367388a59a5186343adc6d4e526004728c73d53070e794d9f663e704795,syscc=false,proposal=0xc421b9fea0,canname=mycc:1.0
peer0.org1.example.com    | 2017-10-16 15:59:20.826 UTC [chaincode] Launch -> DEBU 3c2 launchAndWaitForRegister fetched 2411 bytes from file system
peer0.org1.example.com    | 2017-10-16 15:59:20.826 UTC [chaincode] launchAndWaitForRegister -> DEBU 3c3 chaincode mycc:1.0 is being launched
peer0.org1.example.com    | 2017-10-16 15:59:20.826 UTC [chaincode] getArgsAndEnv -> DEBU 3c4 Executable is chaincode
peer0.org1.example.com    | 2017-10-16 15:59:20.826 UTC [chaincode] getArgsAndEnv -> DEBU 3c5 Args [chaincode -peer.address=peer0.org1.example.com:7051]
peer0.org1.example.com    | 2017-10-16 15:59:20.827 UTC [chaincode] launchAndWaitForRegister -> DEBU 3c6 start container: mycc:1.0(networkid:dev,peerid:peer0.org1.example.com)
peer0.org1.example.com    | 2017-10-16 15:59:20.827 UTC [chaincode] launchAndWaitForRegister -> DEBU 3c7 start container with args: chaincode -peer.address=peer0.org1.example.com:7051
peer0.org1.example.com    | 2017-10-16 15:59:20.827 UTC [chaincode] launchAndWaitForRegister -> DEBU 3c8 start container with env:
peer0.org1.example.com    |     CORE_CHAINCODE_ID_NAME=mycc:1.0
peer0.org1.example.com    |     CORE_PEER_TLS_ENABLED=true
peer0.org1.example.com    |     CORE_CHAINCODE_LOGGING_LEVEL=info
peer0.org1.example.com    |     CORE_CHAINCODE_LOGGING_SHIM=warning
peer0.org1.example.com    |     CORE_CHAINCODE_LOGGING_FORMAT=%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}
peer0.org1.example.com    | 2017-10-16 15:59:20.827 UTC [container] lockContainer -> DEBU 3c9 waiting for container(dev-peer0.org1.example.com-mycc-1.0) lock
peer0.org1.example.com    | 2017-10-16 15:59:20.827 UTC [container] lockContainer -> DEBU 3ca got container (dev-peer0.org1.example.com-mycc-1.0) lock
peer0.org1.example.com    | 2017-10-16 15:59:20.827 UTC [dockercontroller] Start -> DEBU 3cb Cleanup container dev-peer0.org1.example.com-mycc-1.0
peer0.org1.example.com    | 2017-10-16 15:59:20.832 UTC [dockercontroller] stopInternal -> DEBU 3cc Stop container dev-peer0.org1.example.com-mycc-1.0(No such container: dev-peer0.org1.example.com-mycc-1.0)
peer0.org1.example.com    | 2017-10-16 15:59:20.834 UTC [dockercontroller] stopInternal -> DEBU 3cd Kill container dev-peer0.org1.example.com-mycc-1.0 (No such container: dev-peer0.org1.example.com-mycc-1.0)
peer0.org1.example.com    | 2017-10-16 15:59:20.835 UTC [dockercontroller] stopInternal -> DEBU 3ce Remove container dev-peer0.org1.example.com-mycc-1.0 (No such container: dev-peer0.org1.example.com-mycc-1.0)
peer0.org1.example.com    | 2017-10-16 15:59:20.836 UTC [dockercontroller] Start -> DEBU 3cf Start container dev-peer0.org1.example.com-mycc-1.0
peer0.org1.example.com    | 2017-10-16 15:59:20.836 UTC [dockercontroller] getDockerHostConfig -> DEBU 3d0 docker container hostconfig NetworkMode: _byfn
peer0.org1.example.com    | 2017-10-16 15:59:20.836 UTC [dockercontroller] createContainer -> DEBU 3d1 Create container: dev-peer0.org1.example.com-mycc-1.0
peer0.org1.example.com    | 2017-10-16 15:59:20.844 UTC [dockercontroller] Start -> DEBU 3d2 start-could not find image <dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9> (container id <dev-peer0.org1.example.com-mycc-1.0>), because of <no such image>...attempt to recreate image
peer0.org1.example.com    | 2017-10-16 15:59:20.844 UTC [chaincode-platform] generateDockerfile -> DEBU 3d3 
peer0.org1.example.com    | FROM hyperledger/fabric-baseos:x86_64-0.3.2
peer0.org1.example.com    | ADD binpackage.tar /usr/local/bin
peer0.org1.example.com    | LABEL org.hyperledger.fabric.chaincode.id.name="mycc" \
peer0.org1.example.com    |       org.hyperledger.fabric.chaincode.id.version="1.0" \
peer0.org1.example.com    |       org.hyperledger.fabric.chaincode.type="GOLANG" \
peer0.org1.example.com    |       org.hyperledger.fabric.version="1.0.2" \
peer0.org1.example.com    |       org.hyperledger.fabric.base.version="0.3.2"
peer0.org1.example.com    | ENV CORE_CHAINCODE_BUILDLEVEL=1.0.2
peer0.org1.example.com    | ENV CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt
peer0.org1.example.com    | COPY peer.crt /etc/hyperledger/fabric/peer.crt
peer0.org1.example.com    | 2017-10-16 15:59:20.846 UTC [util] DockerBuild -> DEBU 3d4 Attempting build with image hyperledger/fabric-ccenv:x86_64-1.0.2
peer0.org1.example.com    | 2017-10-16 15:59:46.596 UTC [dockercontroller] deployImage -> DEBU 3d5 Created image: dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9
peer0.org1.example.com    | 2017-10-16 15:59:46.596 UTC [dockercontroller] Start -> DEBU 3d6 start-recreated image successfully
peer0.org1.example.com    | 2017-10-16 15:59:46.596 UTC [dockercontroller] createContainer -> DEBU 3d7 Create container: dev-peer0.org1.example.com-mycc-1.0
peer0.org1.example.com    | 2017-10-16 15:59:46.664 UTC [dockercontroller] createContainer -> DEBU 3d8 Created container: dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9
peer0.org1.example.com    | 2017-10-16 15:59:46.745 UTC [dockercontroller] Start -> ERRO 3d9 start-could not start container: API error (404): {"message":"network _byfn not found"}
peer0.org1.example.com    | 2017-10-16 15:59:46.745 UTC [container] unlockContainer -> DEBU 3da container lock deleted(dev-peer0.org1.example.com-mycc-1.0)
peer0.org1.example.com    | 2017-10-16 15:59:46.745 UTC [chaincode] func1 -> DEBU 3db chaincode mycc:1.0 launch seq completed
peer0.org1.example.com    | 2017-10-16 15:59:46.745 UTC [chaincode] **Launch -> ERRO 3dc launchAndWaitForRegister failed Error starting container: API error (404): {"message":"network _byfn not found"}**
peer0.org1.example.com    | 2017-10-16 15:59:46.745 UTC [endorser] callChaincode -> DEBU 3dd Exit
peer0.org1.example.com    | 2017-10-16 15:59:46.745 UTC [endorser] simulateProposal -> ERRO 3de failed to invoke chaincode name:"lscc"  on transaction cc0e1367388a59a5186343adc6d4e526004728c73d53070e794d9f663e704795, error: Error starting container: API error (404): {"message":"network _byfn not found"}
peer0.org1.example.com    | 2017-10-16 15:59:46.745 UTC [endorser] simulateProposal -> DEBU 3df Exit
peer0.org1.example.com    | 2017-10-16 15:59:46.745 UTC [lockbasedtxmgr] Done -> DEBU 3e0 Done with transaction simulation / query execution [1a086ccc-1882-413a-a679-047b8478fae0]
peer0.org1.example.com    | 2017-10-16 15:59:46.745 UTC [endorser] ProcessProposal -> DEBU 3e1 Exit
orderer.example.com       | 2017-10-16 15:59:46.748 UTC [orderer/common/broadcast] Handle -> WARN 8de Error reading from stream: rpc error: code = Canceled desc = context canceled
orderer.example.com       | 2017-10-16 15:59:46.748 UTC [orderer/main] func1 -> DEBU 8df Closing Broadcast stream
^Fpeer0.org1.example.com    | 2017-10-16 16:04:03.628 UTC [endorser] ProcessProposal -> DEBU 3e2 Entry
peer0.org1.example.com    | 2017-10-16 16:04:03.628 UTC [protoutils] ValidateProposalMessage -> DEBU 3e3 ValidateProposalMessage starts for signed proposal 0xc4218fa060
peer0.org1.example.com    | 2017-10-16 16:04:03.628 UTC [protoutils] validateChannelHeader -> DEBU 3e4 validateChannelHeader info: header type 3
peer0.org1.example.com    | 2017-10-16 16:04:03.628 UTC [protoutils] checkSignatureFromCreator -> DEBU 3e5 checkSignatureFromCreator starts
peer0.org1.example.com    | 2017-10-16 16:04:03.629 UTC [protoutils] checkSignatureFromCreator -> DEBU 3e6 checkSignatureFromCreator info: creator is &{Org1MSP 3cd83aa899c76517d9acd559d130c87e9c8bc4ca893f4116d7dbc85b14b734d3}
peer0.org1.example.com    | 2017-10-16 16:04:03.629 UTC [protoutils] checkSignatureFromCreator -> DEBU 3e7 checkSignatureFromCreator info: creator is valid
peer0.org1.example.com    | 2017-10-16 16:04:03.629 UTC [protoutils] checkSignatureFromCreator -> DEBU 3e8 checkSignatureFromCreator exists successfully
peer0.org1.example.com    | 2017-10-16 16:04:03.629 UTC [protoutils] validateChaincodeProposalMessage -> DEBU 3e9 validateChaincodeProposalMessage starts for proposal 0xc421d14aa0, header 0xc4218fa090
peer0.org1.example.com    | 2017-10-16 16:04:03.629 UTC [protoutils] validateChaincodeProposalMessage -> DEBU 3ea validateChaincodeProposalMessage info: header extension references chaincode name:"mycc" 
peer0.org1.example.com    | 2017-10-16 16:04:03.629 UTC [endorser] ProcessProposal -> DEBU 3eb processing txid: 854682493d27b8613c504f0780f750520367f328a63526516191727f33a355eb
peer0.org1.example.com    | 2017-10-16 16:04:03.629 UTC [fsblkstorage] retrieveTransactionByID -> DEBU 3ec retrieveTransactionByID() - txId = [854682493d27b8613c504f0780f750520367f328a63526516191727f33a355eb]
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [lockbasedtxmgr] NewTxSimulator -> DEBU 3ed constructing new tx simulator
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [lockbasedtxmgr] newLockBasedTxSimulator -> DEBU 3ee constructing new tx simulator [18598d15-803e-4ca0-87dd-6da03d90c9a8]
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [endorser] simulateProposal -> DEBU 3ef Entry - txid: 854682493d27b8613c504f0780f750520367f328a63526516191727f33a355eb channel id: c1
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [ccprovider] NewCCContext -> DEBU 3f0 NewCCCC (chain=c1,chaincode=lscc,version=1.0.2,txid=854682493d27b8613c504f0780f750520367f328a63526516191727f33a355eb,syscc=true,proposal=0xc421d14aa0,canname=lscc:1.0.2
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [chaincode] Launch -> DEBU 3f1 chaincode is running(no need to launch) : lscc:1.0.2
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [chaincode] Execute -> DEBU 3f2 Entry
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [chaincode] Execute -> DEBU 3f3 chaincode canonical name: lscc:1.0.2
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [chaincode] sendExecuteMessage -> DEBU 3f4 [85468249]Inside sendExecuteMessage. Message TRANSACTION
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [chaincode] setChaincodeProposal -> DEBU 3f5 Setting chaincode proposal context...
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [chaincode] setChaincodeProposal -> DEBU 3f6 Proposal different from nil. Creating chaincode proposal context...
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [chaincode] sendExecuteMessage -> DEBU 3f7 [85468249]sendExecuteMsg trigger event TRANSACTION
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [chaincode] processStream -> DEBU 3f8 [85468249]Move state message TRANSACTION
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [chaincode] HandleMessage -> DEBU 3f9 [85468249]Fabric side Handling ChaincodeMessage of type: TRANSACTION in state ready
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [chaincode] filterError -> DEBU 3fa Ignoring NoTransitionError: no transition
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [chaincode] processStream -> DEBU 3fb [85468249]sending state message TRANSACTION
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [shim] func1 -> DEBU 3fc [85468249]Received message TRANSACTION from shim
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [shim] handleMessage -> DEBU 3fd [85468249]Handling ChaincodeMessage of type: TRANSACTION(state:ready)
peer0.org1.example.com    | 2017-10-16 16:04:03.630 UTC [shim] beforeTransaction -> DEBU 3fe [85468249]Received TRANSACTION, invoking transaction on chaincode(Src:ready, Dst:ready)
peer0.org1.example.com    | 2017-10-16 16:04:03.631 UTC [shim] handleGetState -> DEBU 3ff [85468249]Sending GET_STATE
peer0.org1.example.com    | 2017-10-16 16:04:03.631 UTC [chaincode] processStream -> DEBU 400 [85468249]Received message GET_STATE from shim
peer0.org1.example.com    | 2017-10-16 16:04:03.631 UTC [chaincode] HandleMessage -> DEBU 401 [85468249]Fabric side Handling ChaincodeMessage of type: GET_STATE in state ready
peer0.org1.example.com    | 2017-10-16 16:04:03.631 UTC [chaincode] afterGetState -> DEBU 402 [85468249]Received GET_STATE, invoking get state from ledger
peer0.org1.example.com    | 2017-10-16 16:04:03.631 UTC [chaincode] filterError -> DEBU 403 Ignoring NoTransitionError: no transition
peer0.org1.example.com    | 2017-10-16 16:04:03.631 UTC [chaincode] func1 -> DEBU 404 [85468249] getting state for chaincode lscc, key mycc, channel c1
peer0.org1.example.com    | 2017-10-16 16:04:03.631 UTC [statecouchdb] GetState -> DEBU 405 GetState(). ns=lscc, key=mycc
peer0.org1.example.com    | 2017-10-16 16:04:03.631 UTC [couchdb] ReadDoc -> DEBU 406 Entering ReadDoc()  id=[lsccmycc]
peer0.org1.example.com    | 2017-10-16 16:04:03.631 UTC [couchdb] handleRequest -> DEBU 407 Entering handleRequest()  method=GET  url=http://couchdb0:5984/c1/lscc%00mycc?attachments=true
peer0.org1.example.com    | 2017-10-16 16:04:03.632 UTC [couchdb] handleRequest -> DEBU 408 HTTP Request: GET /c1/lscc%00mycc?attachments=true HTTP/1.1 | Host: couchdb0:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip |  | 
peer0.org1.example.com    | 2017-10-16 16:04:03.634 UTC [couchdb] handleRequest -> DEBU 409 Couch DB Error:not_found,  Status Code:404,  Reason:missing
peer0.org1.example.com    | 2017-10-16 16:04:03.634 UTC [couchdb] ReadDoc -> DEBU 40a Document not found (404), returning nil value instead of 404 error
peer0.org1.example.com    | 2017-10-16 16:04:03.634 UTC [chaincode] func1 -> DEBU 40b [85468249]No state associated with key: mycc. Sending RESPONSE with an empty payload
peer0.org1.example.com    | 2017-10-16 16:04:03.634 UTC [chaincode] 1 -> DEBU 40c [85468249]handleGetState serial send RESPONSE
peer0.org1.example.com    | 2017-10-16 16:04:03.634 UTC [shim] func1 -> DEBU 40d [85468249]Received message RESPONSE from shim
peer0.org1.example.com    | 2017-10-16 16:04:03.634 UTC [shim] handleMessage -> DEBU 40e [85468249]Handling ChaincodeMessage of type: RESPONSE(state:ready)
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [shim] sendChannel -> DEBU 40f [85468249]before send
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [shim] sendChannel -> DEBU 410 [85468249]after send
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [shim] afterResponse -> DEBU 411 [85468249]Received RESPONSE, communicated (state:ready)
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [shim] handleGetState -> DEBU 412 [85468249]GetState received payload RESPONSE
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [lscc] Invoke -> ERRO 413 error getting chaincode mycc on channel: c1(err:could not find chaincode with name 'mycc')
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [shim] func1 -> DEBU 414 [85468249]Transaction completed. Sending COMPLETED
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [shim] func1 -> DEBU 415 [85468249]Move state message COMPLETED
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [shim] handleMessage -> DEBU 416 [85468249]Handling ChaincodeMessage of type: COMPLETED(state:ready)
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [shim] func1 -> DEBU 417 [85468249]send state message COMPLETED
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [chaincode] processStream -> DEBU 418 [85468249]Received message COMPLETED from shim
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [chaincode] HandleMessage -> DEBU 419 [85468249]Fabric side Handling ChaincodeMessage of type: COMPLETED in state ready
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [chaincode] HandleMessage -> DEBU 41a [854682493d27b8613c504f0780f750520367f328a63526516191727f33a355eb]HandleMessage- COMPLETED. Notify
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [chaincode] notify -> DEBU 41b notifying Txid:854682493d27b8613c504f0780f750520367f328a63526516191727f33a355eb
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [chaincode] Execute -> DEBU 41c Exit
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [endorser] simulateProposal -> DEBU 41d Exit
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [lockbasedtxmgr] Done -> DEBU 41e Done with transaction simulation / query execution [18598d15-803e-4ca0-87dd-6da03d90c9a8]
peer0.org1.example.com    | 2017-10-16 16:04:03.635 UTC [endorser] ProcessProposal -> DEBU 41f Exit

Also, I have found this JIRA log which is the same until the point where I get the aforementioned error: https://jira.hyperledger.org/secure/attachment/12212/peer0.org1.example.com.log.

Thank you for your help!

EDIT 2: .env file form peer0.org0.example.com:

HOSTNAME=6998ded553e4
TERM=xterm
CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
CORE_PEER_PROFILE_ENABLED=true
CORE_PEER_GOSSIP_ORGLEADER=false
CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/opt/gopath/src/github.com/hyperledger/fabric/peer
CORE_PEER_TLS_ENABLED=true
CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=_byfn
CORE_PEER_ID=peer0.org1.example.com
SHLVL=1
HOME=/root
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
FABRIC_CFG_PATH=/etc/hyperledger/fabric
CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
CORE_LEDGER_STATE_STATEDATABASE=CouchDB
CORE_PEER_GOSSIP_USELEADERELECTION=true
_=/usr/bin/printenv

EDIT 3:

peer0.org1.example.com    | 2017-10-17 15:37:48.352 UTC [chaincode] Launch -> ERRO 52f launchAndWaitForRegister failed Timeout expired while starting chaincode mycc:1.0(networkid:dev,peerid:peer0.org1.example.com,tx:21de5c78faf2938ec4d64f3c3deb762bd20e56187921dddb895e8f4e1ced220f)
peer0.org1.example.com    | 2017-10-17 15:37:48.352 UTC [endorser] callChaincode -> DEBU 530 Exit
peer0.org1.example.com    | 2017-10-17 15:37:48.352 UTC [endorser] simulateProposal -> ERRO 531 failed to invoke chaincode name:"lscc"  on transaction 21de5c78faf2938ec4d64f3c3deb762bd20e56187921dddb895e8f4e1ced220f, error: Timeout expired while starting chaincode mycc:1.0(networkid:dev,peerid:peer0.org1.example.com,tx:21de5c78faf2938ec4d64f3c3deb762bd20e56187921dddb895e8f4e1ced220f)
Aftertaste answered 16/10, 2017 at 16:34 Comment(4)
you'll need to share more than the logs. Can you please share the docker-compose file you used to create this network? Also, did you modify the scripts/script.sh to adapt it to the configuration you created? If so, please share that as well.Melville
@Melville Tnx for the answer. See my edit please. Also regarding script.sh: I have commented the line which starts it in docker-compse-cli.yaml file. I just generate all the crypto and other artefacts manually, and the use CLI to create the channel, join peer to channel and install chain-code to channel.Aftertaste
@Melville I had added what you suggested, but it seems that we have a problem with the COMPOSE_PROJECT_NAME (as suggested by Artem Barger in the answer below) env which is referenced in peer-base.yaml file. When I echo it in peer0.org0.example.com I get the empty response.Aftertaste
@Melville Any updates to this issue?Aftertaste
A
3

So, the issue here is with the COMPOSE_PROJECT_NAME env. When I try to start my network form the folder with network specification this env remains empty for some reason and I get the aforementioned error. When I copy my network specification to /fabric-samples/firtst-network folder and try to start it again the COMPOSE_PROJECT_NAME got set to "net" value and everything works fine. Also when I try to hardcode this value to "net" in /base/peer-base.yaml and try to start the network again from the default folder, I get the time-out ERR on peer.

EDIT1:

The final answer will be: I have not setup .env file for the aforementioned env. variable within the folder.

Aftertaste answered 23/10, 2017 at 14:22 Comment(0)
L
10

By inspecting the error from the log file you've provided:

peer0.org1.example.com | 2017-10-16 15:59:46.745 UTC [dockercontroller] Start -> ERRO 3d9 start-could not start container: API error (404): {"message":"network _byfn not found"}

It seems that network name has unintentional space character network _byfn, hence I'd guess you need to fix it in docker-compose.yaml file:

Check value of CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE environment variable, you can find it in base/peer-base.yaml:

version: '2'

services:
  peer-base:
    image: hyperledger/fabric-peer
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      # the following setting starts chaincode containers on the same
      # bridge network as the peers
      # https://docs.docker.com/compose/networking/
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
      #- CORE_LOGGING_LEVEL=ERROR
      - CORE_LOGGING_LEVEL=DEBUG
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_GOSSIP_USELEADERELECTION=true
      - CORE_PEER_GOSSIP_ORGLEADER=false
      - CORE_PEER_PROFILE_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start

Also you can check .env file content, usually it suppose to be:

COMPOSE_PROJECT_NAME=net
Lip answered 16/10, 2017 at 21:55 Comment(8)
Tnx for the answer. As far as I see everything is good regarding the things you suggested. Can you please see my update?Aftertaste
can you add content of .env file?Lip
added for peer0.org0.example.com. If you point out for COMPOSE_PROJECT_NAME env, when I echo it, I get the empty response.Aftertaste
can you explicitly set it up to some meaningful value and try again?Lip
You think to set it up in peer-base .yaml spec?Aftertaste
I just wondering where space character in the name of the network came from and I am not sure, but suspect this might be a source of your problem.Lip
See my EDIT 3 please. I have changed the aforementioned env and now getting the error pasted in EDIT 3.Aftertaste
Let us continue this discussion in chat.Aftertaste
A
3

So, the issue here is with the COMPOSE_PROJECT_NAME env. When I try to start my network form the folder with network specification this env remains empty for some reason and I get the aforementioned error. When I copy my network specification to /fabric-samples/firtst-network folder and try to start it again the COMPOSE_PROJECT_NAME got set to "net" value and everything works fine. Also when I try to hardcode this value to "net" in /base/peer-base.yaml and try to start the network again from the default folder, I get the time-out ERR on peer.

EDIT1:

The final answer will be: I have not setup .env file for the aforementioned env. variable within the folder.

Aftertaste answered 23/10, 2017 at 14:22 Comment(0)
H
3

In my case in .env file I had defined

COMPOSE_PROJECT_NAME=xxx

and in docker-compose.yml file I had

version: '2'

networks:
  yyy:   <----------------

services:
 ...
 ...
    - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=zzz
 ...
 ...

At some point I run to same issue

failed to invoke chaincode name:"lscc" , error: API error (404): network zzz not found

Listing docker networks (docker network ls) shows that network with name xxx_yyy is created so basically changing value of CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE to xxx_yyy solve issue in my case.

 CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=xxx_yyy 

Haemostatic answered 18/3, 2019 at 8:16 Comment(0)
S
2

In my case, I can solve this problem by moving the .env file to the same directory with the docker-compose.yaml file(s)

Svelte answered 8/3, 2021 at 7:50 Comment(2)
works for me too. Quick solution. Thanks!Eldoneldora
Yeah, this turned out to be the solution for my case as well. I moved my .env file to the same directory that has docker-compose.yaml files in it. I then had to start over, creating the channel and setting chaincode on that channel. After that everything else worked just fine.Trantrance
D
1

I also run into similar error, when I set COMPOSE_PROJECT_NAME=block_chain:

Error: Error endorsing chaincode: rpc error: code = Unknown desc = error starting container: 
API error (404): {"message":"network block_chain_network not found"}

But network was actually created with the name blockchain_network. Hence, it didn't work in my case.

My observation: COMPOSE_PROJECT_NAME do not accept any special character. After this, I am able to instantiate the chaincode successfully by setting COMPOSE_PROJECT_NAME=blockchain.

Hope this helps for others, who may run into the same issue.

Degroot answered 5/2, 2018 at 17:15 Comment(0)
I
0

one more important thing i realized when I got this working is that, the name you give as network in docker-compose-cli.yaml say "myconsortium"

  myorderer.myril.com:
    container_name: myorderer.myril.com
    extends:
      file:   base/docker-compose-base.yaml
      service: myorderer.myril.com
    networks:
      - myconsortium

has to match the value in peer-base.yaml as CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_myconsortium

what the scrpipts seem to be doing is take the network name we specify in cli.yaml and prepend it with env variable as ${COMPOSE_PROJECT_NAME}_

Indo answered 24/2, 2019 at 9:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.