提问者:小点点

尝试在Hyperledger结构上实例化链代码时出错


我试图根据这里描述的规范创建一个定制的商业网络:https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#using-沙发床

我为 org1.example.com 创建了 5 个对等节点,为 org2.example.com 创建了 1 个对等节点。

我能够启动网络并在 peer0.org1.example.com上使用docker cli安装链代码,但当我尝试实例化它时,我得到以下错误:

错误:背书链码时出错:rpc 错误:代码 = 未知 desc = 启动容器时出错:API 错误 (404):{“消息”:“找不到网络_byfn”}

以下是业务网络记录器的输出:

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

另外,我发现了这个JIRA日志,直到我收到上述错误为止:https://jira.hyperledger.org/secure/attachment/12212/peer0.org1.example.com.log。

谢谢你的帮忙!

编辑 2:.env 文件格式 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

编辑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)

共3个答案

匿名用户

通过检查您提供的日志文件中的错误:

peer0.org1.example.com | 2017-10-16 15:59:46.745 UTC[dockercontroller]开始-

网络名称似乎无意中带有空格字符network_byfn,因此我想您需要在docker-compose.yaml文件中修复它:

检查< code > CORE _ VM _ DOCKER _ host config _ network mode 环境变量的值,您可以在< code>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

您也可以检查.env文件内容,通常应该是:

COMPOSE_PROJECT_NAME=net

匿名用户

因此,这里的问题在于COMPOSE_PROJECT_NAME环境。当我尝试从具有网络规范的文件夹启动我的网络时,由于某种原因,该 env 仍然为空,并且我收到上述错误。当我将我的网络规范复制到 /fabric-samples/firtst-network 文件夹并尝试再次启动它时,COMPOSE_PROJECT_NAME设置为“net”值,一切正常。此外,当我尝试将此值硬编码为 /base/peer-base.yaml 中的“net”并尝试从默认文件夹再次启动网络时,我在对等点上获得超时 ERR。

编辑1:

最终答案是:我没有为上述环境设置. env文件。文件夹中的变量。

匿名用户

在我的例子中是<代码>。我定义的env文件

COMPOSE_PROJECT_NAME=xxx

在docker-compose.yml文件中

version: '2'

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

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

在某个时候,我遇到了同样的问题

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

列出docker网络(docker network ls)表明,已创建名为xxx_yyy的网络,因此将CORE_VM_docker_HOSTCONFIG_NETWORKMODE更改为xxx_yyy基本上解决了我的问题。

 CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=xxx_yyy