【问题标题】:hyperledger, error code 500, could not launch chaincode fabcar:1.0: chaincode超级账本,错误代码 500,无法启动链代码 fabcar:1.0:链代码
【发布时间】:2021-08-29 21:47:54
【问题描述】:

对于我的项目,我尝试从 https://github.com/delerak/bbids 部署超级账本

在克隆这个 git 之后,我已经设置了所有先决条件。我用这个 git 中的 /fabcar 替换了 /fabric-sample/fabcar。 我试图运行 Fabric,但我出错了: 错误:无法组装交易,err 提案响应不成功,错误代码 500,模拟中的 msg 错误:无法启动链代码 fabcar:1.0:链代码注册失败:容器以 1 退出

您能帮我解决这个错误吗?我应该从哪里开始? 我曾尝试在 Internet 上查找信息并重新安装 VM,但无法解决我的问题。非常感谢。

user@node-1:~/go/src/github.com/hyperledger/fabric-samples/bbids/fabcar$ ./startFabric.sh javascript

# don't rewrite paths for Windows Git Bash users
export MSYS_NO_PATHCONV=1

docker-compose -f docker-compose.yml down
Stopping ca.example.com ... done
Stopping couchdb        ... done
Removing ca.example.com ... done
Removing couchdb        ... done
Removing network net_basic

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

# 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
2021-08-29 17:08:55.381 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2021-08-29 17:08:55.403 UTC [cli.common] readBlock -> INFO 002 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
2021-08-29 17:08:55.648 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2021-08-29 17:08:55.776 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
Creating cli ... done
CONTAINER ID   IMAGE                        COMMAND                  CREATED                  STATUS                   PORTS                                                                                  NAMES
7feb28aba9fc   hyperledger/fabric-tools     "/bin/bash"              Less than a second ago   Up Less than a second                                                                                           cli
a624b77dedbe   hyperledger/fabric-peer      "peer node start"        12 seconds ago           Up 11 seconds            0.0.0.0:7051->7051/tcp, :::7051->7051/tcp, 0.0.0.0:7053->7053/tcp, :::7053->7053/tcp   peer0.org1.example.com
6dfab2cdd99c   hyperledger/fabric-orderer   "orderer"                14 seconds ago           Up 12 seconds            0.0.0.0:7050->7050/tcp, :::7050->7050/tcp                                              orderer.example.com
bf94e094dca6   hyperledger/fabric-ca        "sh -c 'fabric-ca-se…"   14 seconds ago           Up 13 seconds            0.0.0.0:7054->7054/tcp, :::7054->7054/tcp                                              ca.example.com
1c456d2dc86b   hyperledger/fabric-couchdb   "tini -- /docker-ent…"   14 seconds ago           Up 12 seconds            4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp, :::5984->5984/tcp                          couchdb
4d62c621f0d7   hello-world                  "/hello"                 2 hours ago              Exited (0) 2 hours ago                                                                                          elated_grothendieck
2021-08-29 17:08:56.961 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2021-08-29 17:08:56.962 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2021-08-29 17:09:16.847 UTC [chaincodeCmd] submitInstallProposal -> INFO 003 Installed remotely: response:<status:200 payload:"OK" >
2021-08-29 17:09:17.154 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2021-08-29 17:09:17.155 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
**Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error in simulation: could not launch chaincode fabcar:1.0: chaincode registration failed: container exited with 1**

关于版本: Linux node-1 5.11.0-27-generic #29~20.04.1-Ubuntu

Docker 版本 20.10.8,构建 3967b7d

docker-compose 版本 1.29.2,构建未知

go 版本 go1.17 linux/amd64

user@node-1:~/go/src/github.com/hyperledger/fabric-samples/test-network$ node -v v12.22.5

user@node-1:~/go/src/github.com/hyperledger/fabric-samples/test-network$ docker images
REPOSITORY                   TAG       IMAGE ID       CREATED         SIZE
busybox                      latest    42b97d3c2ae9   9 days ago      1.24MB
hyperledger/fabric-ca        1.5       c6803b1828da   12 days ago     70.8MB
hyperledger/fabric-ca        1.5.1     c6803b1828da   12 days ago     70.8MB
hyperledger/fabric-ca        latest    c6803b1828da   12 days ago     70.8MB
hyperledger/fabric-nodeenv   2.3       1bbb2e701fa2   2 weeks ago     295MB
hyperledger/fabric-tools     2.3       a206a1593b4c   4 months ago    448MB
hyperledger/fabric-tools     2.3.2     a206a1593b4c   4 months ago    448MB
hyperledger/fabric-tools     latest    a206a1593b4c   4 months ago    448MB
hyperledger/fabric-peer      2.3       85c825d4769f   4 months ago    54.2MB
hyperledger/fabric-peer      2.3.2     85c825d4769f   4 months ago    54.2MB
hyperledger/fabric-peer      latest    85c825d4769f   4 months ago    54.2MB
hyperledger/fabric-orderer   2.3       7cad713cbfea   4 months ago    37.8MB
hyperledger/fabric-orderer   2.3.2     7cad713cbfea   4 months ago    37.8MB
hyperledger/fabric-orderer   latest    7cad713cbfea   4 months ago    37.8MB
hyperledger/fabric-ccenv     2.3       627c556b15ca   4 months ago    514MB
hyperledger/fabric-ccenv     2.3.2     627c556b15ca   4 months ago    514MB
hyperledger/fabric-ccenv     latest    627c556b15ca   4 months ago    514MB
hyperledger/fabric-baseos    2.3       e50ea411d694   4 months ago    6.86MB
hyperledger/fabric-baseos    2.3.2     e50ea411d694   4 months ago    6.86MB
hyperledger/fabric-baseos    latest    e50ea411d694   4 months ago    6.86MB
hello-world                  latest    d1165f221234   5 months ago    13.3kB
hyperledger/fabric-couchdb   latest    b967e8b98b6b   14 months ago   261MB




Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error in simulation: could not launch chaincode fabcar:1.0: chaincode regist
ekaterina@node-1:~/go/src/github.com/hyperledger/fabric-samples/bbids/fabcar$ docker ps -a
CONTAINER ID   IMAGE                                                                                                    COMMAND                  CREATED          STATUS                                                 NAMES
50002900be25   dev-peer0.org1.example.com-fabcar-1.0-5c906e402ed29f20260ae42283216aa75549c571e2e380f3615826365d8269ba   "docker-entrypoint.s…"   21 seconds ago   Exited (1) 19 s                                        dev-peer0.org1.example.com-fabcar-1.0
2c0789a1daa5   hyperledger/fabric-tools                                                                                 "/bin/bash"              22 seconds ago   Up 21 seconds                                          cli
684b35d2689a   hyperledger/fabric-peer                                                                                  "peer node start"        35 seconds ago   Up 33 seconds  0.0:7053->7053/tcp, :::7053->7053/tcp   peer0.org1.example.com
39d060bdf59b   hyperledger/fabric-couchdb                                                                               "tini -- /docker-ent…"   37 seconds ago   Up 34 seconds  5984->5984/tcp                          couchdb
e1902404188f   hyperledger/fabric-ca                                                                                    "sh -c 'fabric-ca-se…"   37 seconds ago   Up 34 seconds                                          ca.example.com
e8563d51b253   hyperledger/fabric-orderer                                                                               "orderer"                37 seconds ago   Up 34 seconds                                          orderer.example.com
ekaterina@node-1:~/go/src/github.com/hyperledger/fabric-samples/bbids/fabcar$ docker lo
load    login   logout  logs
ekaterina@node-1:~/go/src/github.com/hyperledger/fabric-samples/bbids/fabcar$ docker logs 50002900be25
+ CHAINCODE_DIR=/usr/local/src
+ cd /usr/local/src
+ npm start -- --peer.address peer0.org1.example.com:7052

> fabcar@1.0.0 start /usr/local/src
> fabric-chaincode-node start "--peer.address" "peer0.org1.example.com:7052"

internal/modules/cjs/loader.js:985
  throw err;
  ^

Error: Cannot find module 'winston'
Require stack:
- /usr/local/src/node_modules/fabric-shim/lib/logger.js
- /usr/local/src/node_modules/fabric-shim/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/usr/local/src/node_modules/fabric-shim/lib/logger.js:8:17)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/src/node_modules/fabric-shim/lib/logger.js',
    '/usr/local/src/node_modules/fabric-shim/cli.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fabcar@1.0.0 start: `fabric-chaincode-node start "--peer.address" "peer0.org1.example.com:7052"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fabcar@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-08-30T20_12_43_738Z-debug.log
ekaterina@node-1:~/go/src/github.com/hyperledger/fabric-samples/bbids/fabcar$

【问题讨论】:

  • 请提供链码容器日志。
  • 我添加了一个日志。看起来是winston的问题,但是安装了npm
  • 确保在打包链码时安装所有依赖项。
  • 我在 package.json 中检查了 fabric-shim,winston 已安装
  • 嗨。我似乎已经解决了依赖问题,但是我有同样的错误错误:无法组装事务,错误建议响应不成功,错误代码500,味精链码注册失败:容器以1退出但现在容器之一 docker ps -一分钟 0.0.0.0:7054->7054/tcp, :::7054->7054/tcp ca.example.com b1daa86dc626 hyperledger/fabric-orderer "orderer" 10 小时前 Created orderer 你能帮忙告诉我应该去哪里寻找问题?我尝试执行 npm init 并指定链码,但这不是问题,或者我做错了什么。

标签: hyperledger-fabric hyperledger


【解决方案1】:

查找带有docker ps -a 的“死”链代码容器并查看日志 (docker logs chaincodecontainername)。

您还可以使用CORE_VM_DOCKER_ATTACHSTDOUT=true 环境变量修改您的对等点,然后查看对等点日志。如果链码在初始化期间出现错误,这通常会更有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-05
    • 1970-01-01
    • 1970-01-01
    • 2012-06-15
    • 2011-03-09
    • 1970-01-01
    相关资源
    最近更新 更多