我正在尝试使用结构工具实例化代码。对等点在 Google Cloud 中的容器优化操作系统上运行。安装工程(抱歉,有些参数可能不是必需的):
docker exec -e \"CORE_PEER_LOCALMSPID=${ORGANIZATION^}MSP\" ^
-e \"CORE_PEER_MSPCONFIGPATH=/home/crypto/peerOrganizations/${ORGANIZATION}/users/Admin@${ORGANIZATION}/msp\" ^
-e \"CORE_PEER_TLS_CERT_FILE=/home/crypto/peerOrganizations/${ORGANIZATION}/peers/${PEER_NAME}.${ORGANIZATION}/tls/server.crt\" ^
-e \"CORE_PEER_TLS_KEY_FILE=/home/crypto/peerOrganizations/${ORGANIZATION}/peers/${PEER_NAME}.${ORGANIZATION}/tls/server.key\" ^
-e \"CORE_PEER_TLS_ROOTCERT_FILE=/home/crypto/peerOrganizations/${ORGANIZATION}/peers/${PEER_NAME}.${ORGANIZATION}/tls/ca.crt\" ^
-e \"CORE_PEER_ADDRESS=${PEER_NAME}:7051\" ^
-e \"CORE_PEER_CHAINCODEADDRESS=${PEER_NAME}:7052\" ^
$CLI peer chaincode install -n my-blockchain -v 0.0.3 -p //home//github.com//my-blockchain -l node
实例化失败:
docker exec -e \"CORE_PEER_LOCALMSPID=${ORGANIZATION^}MSP\" ^
-e \"CORE_PEER_MSPCONFIGPATH=/home/crypto/peerOrganizations/${ORGANIZATION}/users/Admin@${ORGANIZATION}/msp\" ^
-e \"CORE_PEER_TLS_CERT_FILE=/home/crypto/peerOrganizations/${ORGANIZATION}/peers/${PEER_NAME}.${ORGANIZATION}/tls/server.crt\" ^
-e \"CORE_PEER_TLS_KEY_FILE=/home/crypto/peerOrganizations/${ORGANIZATION}/peers/${PEER_NAME}.${ORGANIZATION}/tls/server.key\" ^
-e \"CORE_PEER_TLS_ROOTCERT_FILE=/home/crypto/peerOrganizations/${ORGANIZATION}/peers/${PEER_NAME}.${ORGANIZATION}/tls/ca.crt\" ^
-e \"CORE_PEER_ADDRESS=${PEER_NAME}:7051\" ^
-e \"CORE_PEER_CHAINCODEADDRESS=${PEER_NAME}:7052\" ^
$CLI peer chaincode instantiate -o orderer1:7050 -C my-channel -n my-blockchain ^
-l node -v 0.0.3 -c \"{\\\"Args\\\":[]}\" ^
-P \"OR ('Org1MSP.member')\" ^
--tls --cafile $TLS_CERT --keyfile $KEY_FILE --cafile $ORDERER_TLS_CERT -o orderer1:7050
和
2020-03-19 22:09:03.562 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-03-19 22:09:03.562 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "cp: cannot stat '/chaincode/input/src/.': No such file or directory
我的 CLI docker-compose 文件看起来像这样(/var/run 的东西看起来很奇怪,因为我试图让它在系统部分不可变的 Google COS 上工作):
version: '3'
networks:
my_net:
services:
cli-org1:
hostname: cli-org1
image: hyperledger/fabric-tools:1.4
tty: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- FABRIC_LOGGING_SPEC=info
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=hyperledger_my_net
- CORE_PEER_ID=peer0
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_MSPCONFIGPATH=/home/crypto/peerOrganizations/org1/users/Admin@org1/msp
- CORE_PEER_LOCALMSPID=Org1MSP
#peerOrganizations/org1/peers/peer0.org1/tls/server.crt
- CORE_PEER_TLS_CERT_FILE=/home/crypto/peerOrganizations/org1/peers/peer0.org1/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/home/crypto/peerOrganizations/org1/peers/peer0.org1/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/home/crypto/peerOrganizations/org1/peers/peer0.org1/tls/ca.crt
- CORE_PEER_ADDRESS=peer0:7051
- CORE_PEER_CHAINCODEADDRESS=peer0:7052
- CORE_CHAINCODE_KEEPALIVE=10
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- ./var/cli_run/:/host/var/run/
- /var/run/docker.sock:/var/run/docker.sock
- /var/run/docker.sock:/host/run/var/docker.sock
- ./chaincode/:/home/github.com/
- ./crypto-config:/home/crypto/
extra_hosts:
- "orderer1:111.111.111.111"
- "peer0:111.111.111.111"
networks:
my_net:
aliases:
- cli-org1
这是 orderer 日志的样子:
2020-03-19 21:57:50.723 UTC [orderer.common.server] replicateDisabledChains -> DEBU 87d No inactive chains to try to replicate
2020-03-19 22:02:50.724 UTC [orderer.common.server] replicateDisabledChains -> DEBU 87e No inactive chains to try to replicate
2020-03-19 22:07:50.724 UTC [orderer.common.server] replicateDisabledChains -> DEBU 87f No inactive chains to try to replicate
2020-03-19 22:12:50.724 UTC [orderer.common.server] replicateDisabledChains -> DEBU 880 No inactive chains to try to replicate
2020-03-19 22:16:00.250 UTC [orderer.common.server] Broadcast -> DEBU 881 Starting new Broadcast handler
2020-03-19 22:16:00.250 UTC [orderer.common.broadcast] Handle -> DEBU 882 Starting new broadcast loop for 178.4.35.173:52041
2020-03-19 22:16:01.131 UTC [orderer.common.broadcast] Handle -> WARN 883 Error reading from 178.4.35.173:52041: rpc error: code = Canceled desc = context canceled
2020-03-19 22:16:01.131 UTC [orderer.common.server] func1 -> DEBU 884 Closing Broadcast stream
2020-03-19 22:16:01.131 UTC [comm.grpc.server] 1 -> INFO 885 streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=178.4.35.173:52041 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=881.822921ms
2020-03-19 22:16:01.131 UTC [grpc] infof -> DEBU 886 transport: loopyWriter.run returning. connection error: desc = "transport is closing"
2020-03-19 22:17:50.724 UTC [orderer.common.server] replicateDisabledChains -> DEBU 887 No inactive chains to try to replicate
2020-03-19 22:19:26.918 UTC [orderer.common.server] Broadcast -> DEBU 888 Starting new Broadcast handler
2020-03-19 22:19:26.918 UTC [orderer.common.broadcast] Handle -> DEBU 889 Starting new broadcast loop for 178.4.35.173:52073
2020-03-19 22:19:27.780 UTC [grpc] infof -> DEBU 88a transport: loopyWriter.run returning. connection error: desc = "transport is closing"
2020-03-19 22:19:27.780 UTC [orderer.common.broadcast] Handle -> DEBU 88b Received EOF from 178.4.35.173:52073, hangup
2020-03-19 22:19:27.780 UTC [orderer.common.server] func1 -> DEBU 88c Closing Broadcast stream
2020-03-19 22:19:27.780 UTC [comm.grpc.server] 1 -> INFO 88d streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=178.4.35.173:52073 grpc.code=OK grpc.call_duration=861.76369ms
可能是什么问题呢?例如,这个文件夹 /chaincode/input/src/ 在哪里。不见了?在主机系统上?但是因为根目录是不可变的,所以我不能在那里创建 /chaincode。