所以我在"尝试在我的联盟阶段实例化链码"。 我把它安装在所有同行 - 全面200个。
当我接触到这件作品时,它会稍微挂起并超时
=====================================================================================================
peer chaincode instantiate -o orderer:7050 --tls true --cafile /crypto-config/ordererOrganizations/orderer.com/orderers/orderer.orderer.com/msp/tlscacerts/tlsca.orderer.com-cert.pem -C aac -n mycc -v 1.0
-c '{"Args":["init","a", "100", "b","200"]}' -P "OR ('Org1MSP.member','Org2MSP.member','Org3MSP.member')"
=====================================================================================================
2017-10-28 02:02:56.853 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2017-10-28 02:02:56.853 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-10-28 02:02:56.867 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2017-10-28 02:02:56.868 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2017-10-28 02:02:56.869 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A9D070A7508031A0C08D0CACFCF0510...30300A000A04657363630A0476736363
2017-10-28 02:02:56.869 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: EDDBC0833DC1815A04B56C17D7D7DC6CAE967A8BA1C5082668234325F325F1C1
Error: Error endorsing chaincode: rpc error: code = Unknown desc = Timeout expired while starting chaincode mycc:1.0(networkid:dev,peerid:peer0.org1.com,tx:dcd9c8c334467ee867fdd82fdbbec483532281364b20fda1fcd1298a66a836b3)
对等日志的结尾如下:
peer0.org1.com | 2017-10-28 02:02:56.896 UTC [shim] sendChannel -> DEBU 540 [dcd9c8c3]after send
peer0.org1.com | 2017-10-28 02:02:56.896 UTC [shim] afterResponse -> DEBU 541 [dcd9c8c3]Received RESPONSE, communicated (state:ready)
peer0.org1.com | 2017-10-28 02:02:56.896 UTC [shim] handlePutState -> DEBU 542 [dcd9c8c3]Received RESPONSE. Successfully updated state
peer0.org1.com | 2017-10-28 02:02:56.896 UTC [shim] func1 -> DEBU 543 [dcd9c8c3]Transaction completed. Sending COMPLETED
peer0.org1.com | 2017-10-28 02:02:56.897 UTC [shim] func1 -> DEBU 544 [dcd9c8c3]Move state message COMPLETED
peer0.org1.com | 2017-10-28 02:02:56.897 UTC [shim] handleMessage -> DEBU 545 [dcd9c8c3]Handling ChaincodeMessage of type: COMPLETED(state:ready)
peer0.org1.com | 2017-10-28 02:02:56.897 UTC [shim] func1 -> DEBU 546 [dcd9c8c3]send state message COMPLETED
peer0.org1.com | 2017-10-28 02:02:56.897 UTC [chaincode] processStream -> DEBU 547 [dcd9c8c3]Received message COMPLETED from shim
peer0.org1.com | 2017-10-28 02:02:56.898 UTC [chaincode] HandleMessage -> DEBU 548 [dcd9c8c3]Fabric side Handling ChaincodeMessage of type: COMPLETED in state ready
peer0.org1.com | 2017-10-28 02:02:56.898 UTC [chaincode] HandleMessage -> DEBU 549 [dcd9c8c334467ee867fdd82fdbbec483532281364b20fda1fcd1298a66a836b3]HandleMessage- COMPLETED. Notify
peer0.org1.com | 2017-10-28 02:02:56.898 UTC [chaincode] notify -> DEBU 54a notifying Txid:dcd9c8c334467ee867fdd82fdbbec483532281364b20fda1fcd1298a66a836b3
peer0.org1.com | 2017-10-28 02:02:56.898 UTC [chaincode] Execute -> DEBU 54b Exit
peer0.org1.com | 2017-10-28 02:02:56.898 UTC [ccprovider] NewCCContext -> DEBU 54c NewCCCC (chain=advertiseragencychannel,chaincode=mycc,version=1.0,txid=dcd9c8c334467ee867fdd82fdbbec483532281364b20fda1fcd1298a66a836b3,syscc=false,proposal=0xc421a6b310,canname=mycc:1.0
peer0.org1.com | 2017-10-28 02:02:56.899 UTC [chaincode] Launch -> DEBU 54d launchAndWaitForRegister fetched 1183 bytes from file system
peer0.org1.com | 2017-10-28 02:02:56.899 UTC [chaincode] launchAndWaitForRegister -> DEBU 54e chaincode mycc:1.0 is being launched
peer0.org1.com | 2017-10-28 02:02:56.899 UTC [chaincode] getArgsAndEnv -> DEBU 54f Executable is chaincode
peer0.org1.com | 2017-10-28 02:02:56.899 UTC [chaincode] getArgsAndEnv -> DEBU 550 Args [chaincode -peer.address=peer0.org1:7051]
peer0.org1.com | 2017-10-28 02:02:56.900 UTC [chaincode] launchAndWaitForRegister -> DEBU 551 start container: mycc:1.0(networkid:dev,peerid:peer0.org1.com)
peer0.org1.com | 2017-10-28 02:02:56.900 UTC [chaincode] launchAndWaitForRegister -> DEBU 552 start container with args: chaincode -peer.address=peer0.org1:7051
peer0.org1.com | 2017-10-28 02:02:56.900 UTC [chaincode] launchAndWaitForRegister -> DEBU 553 start container with env:
peer0.org1.com | CORE_CHAINCODE_ID_NAME=mycc:1.0
peer0.org1.com | CORE_PEER_TLS_ENABLED=true
peer0.org1.com | CORE_CHAINCODE_LOGGING_LEVEL=info
peer0.org1.com | CORE_CHAINCODE_LOGGING_SHIM=warning
peer0.org1.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.com | 2017-10-28 02:02:56.901 UTC [container] lockContainer -> DEBU 554 waiting for container(dev-peer0.org1.com-mycc-1.0) lock
peer0.org1.com | 2017-10-28 02:02:56.901 UTC [container] lockContainer -> DEBU 555 got container (dev-peer0.org1.com-mycc-1.0) lock
peer0.org1.com | 2017-10-28 02:02:56.903 UTC [dockercontroller] Start -> DEBU 556 Cleanup container dev-peer0.org1.com-mycc-1.0
peer0.org1.com | 2017-10-28 02:02:56.904 UTC [dockercontroller] stopInternal -> DEBU 557 Stop container dev-peer0.org1.com-mycc-1.0(No such container: dev-peer0.org1.com-mycc-1.0)
peer0.org1.com | 2017-10-28 02:02:56.910 UTC [dockercontroller] stopInternal -> DEBU 558 Kill container dev-peer0.org1.com-mycc-1.0 (No such container: dev-peer0.org1.com-mycc-1.0)
peer0.org1.com | 2017-10-28 02:02:56.912 UTC [dockercontroller] stopInternal -> DEBU 559 Remove container dev-peer0.org1.com-mycc-1.0 (No such container: dev-peer0.org1.com-mycc-1.0)
peer0.org1.com | 2017-10-28 02:02:56.912 UTC [dockercontroller] Start -> DEBU 55a Start container dev-peer0.org1.com-mycc-1.0
peer0.org1.com | 2017-10-28 02:02:56.912 UTC [dockercontroller] createContainer -> DEBU 55b Create container: dev-peer0.org1.com-mycc-1.0
peer0.org1.com | 2017-10-28 02:02:57.043 UTC [dockercontroller] createContainer -> DEBU 55c Created container: dev-peer0.org1.com-mycc-1.0-fb6be780039642ab28b06bc02e8e4cad69b480256333e2b3fc8a7877a9ffdf1d
peer0.org1.com | 2017-10-28 02:02:57.528 UTC [dockercontroller] Start -> DEBU 55d Started container dev-peer0.org1.com-mycc-1.0
peer0.org1.com | 2017-10-28 02:02:57.528 UTC [container] unlockContainer -> DEBU 55e container lock deleted(dev-peer0.org1.com-mycc-1.0)
我唯一能想到的就是我的作曲家网络被称为" consortium_poc"这是使用看起来不同的网络ID - 它似乎是" dev"但我甚至不确定它们是否是同一个东西。我的同伴正在使用CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=consortium_poc
env变量。
我在实例化调用中尝试了任意数量的参数组合。
我几乎一路走来。最后一小步让我疯了。 任何提示或指示?
编辑:谷歌让我把这个参数添加到同行
CORE_PEER_NETWORKID=consortium_poc
现在看起来网络ID值是正确的,但它仍然停留在"解锁容器"消息就像以前一样。
EDIT2:
所以稍微尝试一下,看看它做了什么,它现在使用下面描述的问题中的IP地址:
2017-10-30 15:52:33.553 UTC [chaincode] launchAndWaitForRegister -> DEBU 8cc start container with args: chaincode -peer.address=172.24.0.6:7051
它试图创建的容器说明如下:
Error starting SimpleAsset chaincode: Error trying to connect to local peer: x509: cannot validate certificate for 172.24.0.6 because it doesn't contain any IP SANs
我只改变了两件事:
CORE_PEER_ADDRESSAUTODETECT=true
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
添加回订货人2
答案 0 :(得分:0)
关键似乎是在对等体中设置了另一个参数 - CORE_PEER_CHAINCODELISTENADDRESS
。
对于任何正在努力解决此问题的人,我将提供一套适用于我的用例的配置。请记住,这是4个组织 - 在这里我编辑了Org1.com - Org4.com,每个人都有两个对等人,Orderer.com上有一个订购者。
如果对这些东西更熟悉的人可以对任何重复或多余的属性发表评论,那么我全都听见了。这比我希望的工作花了更长的时间 - 我显然不是面料专家...
的对基
services:
peer-base:
image: hyperledger/fabric-peer
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_poc
- CORE_PEER_NETWORKID=${COMPOSE_PROJECT_NAME}_poc
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_PEER_GOSSIP_ORGLEADER=true
- CORE_PEER_EXTERNALENDPOINT=true
- CORE_PEER_ENDORSER_ENABLED=true
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_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/chaincode
command: peer node start --peer-defaultchain=false
volumes:
- /var/run/:/host/var/run/
- ./chaincode/:/opt/gopath/src/chaincode/
- ./crypto-config:/opt/gopath/src/mofabric/peer/crypto
- ./channel-artifacts:/opt/gopath/src/mofabric/peer/channel-artifacts
订货者
orderer:
container_name: orderer
image: hyperledger/fabric-orderer
networks:
poc:
aliases:
- ${COMPOSE_PROJECT_NAME}
environment:
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_poc
- CORE_PEER_NETWORKID=${COMPOSE_PROJECT_NAME}_poc
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- GRPC_TRACE=all=true,
- GRPC_VERBOSITY=debug
- ORDERER_GENERAL_LOGLEVEL=debug
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_LISTENPORT=7050
- ORDERER_GENERAL_GENESISPROFILE=Genesis
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/orderer/genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/orderer/msp
- ORDERER_GENERAL_TLS_ENABLED=true
- ORDERER_GENERAL_TLS_PRIVATEKEY=/etc/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/etc/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/orderer/tls/ca.crt ]
working_dir: /opt/gopath/src/
command: orderer
volumes:
- /var/run/:/host/var/run/
- ./chaincode/:/opt/gopath/src/
- ./channel-artifacts/genesis.block:/etc/hyperledger/orderer/genesis.block
- ./crypto-config/peerOrganizations/:/etc/hyperledger/peers/
- ./crypto-config/ordererOrganizations/orderer.com/orderers/orderer.orderer.com/msp:/etc/hyperledger/orderer/msp
- ./crypto-config/ordererOrganizations/orderer.com/orderers/orderer.orderer.com/tls:/etc/hyperledger/orderer/tls
ports:
- 7050:7050
CLI
cli:
container_name: cli
image: hyperledger/fabric-tools
tty: true
stdin_open: true
environment:
- CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.com:7052
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_poc
- CORE_PEER_NETWORKID=${COMPOSE_PROJECT_NAME}_poc
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- GRPC_TRACE=all=true,
- GRPC_VERBOSITY=debug
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.org1.com:7051
- CORE_PEER_SERVERHOSTOVERRIDE=peer0.org1.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_TLS_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
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/mofabric/peer/crypto/peerOrganizations/org1.com/users/Admin@mediaocean.com/msp
working_dir: /opt/gopath/src/chaincode
volumes:
- /var/run/:/host/var/run/
- ./chaincode/:/opt/gopath/src/chaincode
- ./crypto-config:/opt/gopath/src/mofabric/peer/crypto
- ./channel-artifacts:/opt/gopath/src/mofabric/peer/channel-artifacts
- ./crypto-config/peerOrganizations/org1.com/users:/etc/hyperledger/fabric/users
- ./crypto-config/peerOrganizations/org1.com/peers/peer0.org1.com/msp:/etc/hyperledger/fabric/msp
- ./crypto-config/peerOrganizations/org1.com/peers/peer0.org1.com/tls:/etc/hyperledger/fabric/tls
- ./crypto-config:/crypto-config
- ./channel-artifacts:/channel-artifacts
- ./scripts:/scripts/
depends_on:
- orderer
- peer0.org1.com
- peer1.org1.com
- peer0.org2.com
- peer1.org2.com
- peer0.org3.com
- peer1.org3.com
- peer0.org4.com
- peer1.org4.com
networks:
poc:
aliases:
- ${COMPOSE_PROJECT_NAME}
就像我做的事情的最终清单一样 - 再次作为一个完整性检查:
generate genesis block
generate channel
generate anchor peers
start fabric
in cli:
create channel
have all peers join channel (the byfn script shows how).
update anchor peers (byfn again).
have org1 in channel package, then orgs 2-4 serially sign chaincode (the chaincode for operators document describes this).
install chaincode on all peers.
instantiate it on peer0.org1.com
这可能并不完美(甚至接近正确),但它终于奏效了。