gpt4 book ai didi

hyperledger-fabric - Chaincode 已实例化但未出现在实例化代码列表中

转载 作者:行者123 更新时间:2023-12-04 17:35:43 24 4
gpt4 key购买 nike

我正在运行 Hyperledger Fabric 1.4.0

我有 1 个组织 (Org1)、2 个节点 (peer0peer1) 和两个排序节点 (ord0 >,ord1)。对等方使用 couchdb 作为存储后端。

我能够成功地安装我的链代码,然后实例化它。

查看 peer0 日志,构建了 docker 镜像并启动了容器。 peer0 还接收并确认由容器内的 chaincode 二进制文件发送的 REGISTER 请求:

2019-06-24 10:15:57.003 UTC [dockercontroller] createContainer -> DEBU b563 created container {"imageID": "nid1-peer0-mynet-mychain-v1-613158e6e99c2c9e7d567e8b57fe2dfb56444f7fdcbc263dd1f61626a374843d", "containerID": "nid1-peer0-mynet-mychain-v1"}
2019-06-24 10:15:57.160 UTC [dockercontroller] Start -> DEBU b564 Started container nid1-peer0-mynet-mychain-v1
2019-06-24 10:15:57.160 UTC [container] unlockContainer -> DEBU b565 container lock deleted(mychain-v1)
2019-06-24 10:15:57.181 UTC [chaincode] handleMessage -> DEBU b566 [] Fabric side handling ChaincodeMessage of type: REGISTER in state created
2019-06-24 10:15:57.181 UTC [chaincode] HandleRegister -> DEBU b567 Received REGISTER in state created
2019-06-24 10:15:57.182 UTC [chaincode] Register -> DEBU b568 registered handler complete for chaincode mychain:v1
2019-06-24 10:15:57.182 UTC [chaincode] HandleRegister -> DEBU b569 Got REGISTER for chaincodeID = name:"mychain:v1" , sending back REGISTERED
2019-06-24 10:15:57.182 UTC [chaincode] HandleRegister -> DEBU b56a Changed state to established for name:"mychain:v1"
2019-06-24 10:15:57.182 UTC [chaincode] sendReady -> DEBU b56b sending READY for chaincode name:"mychain:v1"
2019-06-24 10:15:57.182 UTC [chaincode] sendReady -> DEBU b56c Changed to state ready for chaincode name:"mychain:v1"
2019-06-24 10:15:57.182 UTC [chaincode] Launch -> DEBU b56d launch complete
2019-06-24 10:15:57.182 UTC [chaincode] Execute -> DEBU b56e Entry
2019-06-24 10:15:57.182 UTC [chaincode] handleMessage -> DEBU b56f [1a98f442] Fabric side handling ChaincodeMessage of type: COMPLETED in state ready

尽管如此,链码并未在 couchdb 中注册:

$ peer chaincode list --instantiated -C mychannel
2019-06-24 11:26:29.317 BST [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-06-24 11:26:29.332 BST [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
Get instantiated chaincodes on channel mychannel:

peer0 提交列表命令后立即记录:

2019-06-24 10:26:30.057 UTC [couchdb] ReadDocRange -> DEBU c02e [mychannel_lscc] HTTP/1.1 200 OK
Transfer-Encoding: chunked
Cache-Control: must-revalidate
Content-Type: application/json
Date: Mon, 24 Jun 2019 10:26:30 GMT
Server: CouchDB/2.1.1 (Erlang OTP/18)
X-Couch-Request-Id: 20d0beb9c3
X-Couchdb-Body-Time: 0

2a
{"total_rows":0,"offset":0,"rows":[

]}

0

如果我尝试调用链代码上的方法,我会收到此错误:

Error: endorsement failure during invoke. response: status:500 message:"make sure the chaincode mychain has been successfully instantiated and try again: chaincode mychain not found"

这只是确认链代码尚未在网络中注册。

更新

我意识到我错过了一个重要的细节:peer 日志反复报告连接到 orderer 的错误,例如:

2019-06-24 11:30:35.931 UTC [ConnProducer] NewConnection -> ERRO 100e6 Failed connecting to ord0.mynet.example.com , error: context deadline exceeded

这可能是“chaincode instantiated”消息没有传播的原因......

最佳答案

经过多次调试,发现问题很简单:节点无法与排序节点通信。

在我的特殊情况下,configtx.yaml 中的订购者地址是错误的。修复它们导致链代码实例化过程完全成功。

关于hyperledger-fabric - Chaincode 已实例化但未出现在实例化代码列表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56735065/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com