首页 > 解决方案 > Hyperledger Fabric:从文档修改示例应用程序时出错

问题描述

我得到了“编写你的第一个应用程序”的东西,效果很好。

所以我复制了文件并重命名了东西以支持不同的链代码应用程序。

当我运行时startFabric.sh node(因为我的源代码是 javascript),我最终得到:

# 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
WARNING: Network net_basic not found.

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 couchdb
Creating orderer.example.com
Creating ca.example.com
Creating peer0.org1.example.com

# 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
2018-08-18 06:23:14.962 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-08-18 06:23:14.983 UTC [cli/common] readBlock -> INFO 002 Got status: &{NOT_FOUND}
2018-08-18 06:23:14.984 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-08-18 06:23:15.187 UTC [cli/common] readBlock -> INFO 004 Received block: 0
# 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
2018-08-18 06:23:15.407 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-08-18 06:23:15.481 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
Creating cli
2018-08-18 06:23:16.314 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-08-18 06:23:16.314 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2018-08-18 06:23:16.316 UTC [container] WriteFolderToTarPackage -> INFO 003 rootDirectory = /opt/gopath/src/github.com/permissioned-jpgs/node
2018-08-18 06:23:16.353 UTC [chaincodeCmd] install -> INFO 004 Installed remotely response:<status:200 payload:"OK" >
2018-08-18 06:23:16.590 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-08-18 06:23:16.590 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: endorsement failure during invoke. chaincode result: <nil>

通知背书失败。有任何想法吗?我已经检查了我能想到的一切,我完全被难住了。谢谢!

标签: hyperledger-fabrichyperledger

解决方案


我对 Docker 的无知正在显现。

我只需要通过以下方式查看与我交互的对等节点的日志:sudo docker logs -f dev-peer0.org1.example.com-fabcar-1.0

这些日志告诉我这是我在自定义链码时编写的 Javascript 的问题,而不是我之前认为的 Fabric 网络配置问题。


推荐阅读