我尝试使用docker工具箱在我的本地计算机中设置Hyperledger V1.0。 我根据这个文件: http://hyperledger-fabric.readthedocs.io/en/latest/asset_setup.html
但是当我尝试部署链码时。
$node deploy.js
我收到错误消息:
info: Returning a new winston logger with default configurations
info: [Chain.js]: Constructed Chain instance: name - fabric-client1, securityEnabled: true, TCert download batch size: 10, network mode: true
info: [Peer.js]: Peer.const - url: grpc://localhost:8051 options grpc.ssl_target_name_override=tlsca, grpc.default_authority=tlsca
info: [Peer.js]: Peer.const - url: grpc://localhost:8055 options grpc.ssl_target_name_override=tlsca, grpc.default_authority=tlsca
info: [Peer.js]: Peer.const - url: grpc://localhost:8056 options grpc.ssl_target_name_override=tlsca, grpc.default_authority=tlsca
info: [Client.js]: Failed to load user "admin" from local key value store
info: [FabricCAClientImpl.js]: Successfully constructed Fabric COP service client: endpoint - {"protocol":"http","hostname":"localhost","port":8054}
info: [crypto_ecdsa_aes]: This class requires a KeyValueStore to save keys, no store was passed in, using the default store C:\Users\daniel\.hfc-key-store
[2017-04-15 22:14:29.268] [ERROR] Helper - Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 127.0.0.1:8054]
at ClientRequest.<anonymous> (C:\Users\daniel\node_modules\fabric-ca-client\lib\FabricCAClientImpl.js:304:12)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:310:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at emitErrorNT (net.js:1278:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
[2017-04-15 22:14:29.273] [ERROR] DEPLOY - Error: Failed to obtain an enrolled user
at ca_client.enroll.then.then.then.catch (C:\Users\daniel\helper.js:59:12)
at process._tickCallback (internal/process/next_tick.js:103:7)
events.js:160
throw er; // Unhandled 'error' event
^
Error: Connect Failed
at ClientDuplexStream._emitStatusIfDone (C:\Users\daniel\node_modules\grpc\src\node\src\client.js:201:19)
at ClientDuplexStream._readsDone (C:\Users\daniel\node_modules\grpc\src\node\src\client.js:169:8)
at readCallback (C:\Users\daniel\node_modules\grpc\src\node\src\client.js:229:12)
这是一个关于无法连接到ca的问题吗?或其他原因?
编辑:
环境:
OS: Windows 10 Professional Edition
Docker Toolbox: 17.04.0-ce
Go: 1.7.5
Node.js: 6.10.0
我的步骤:
1.打开Docker快速入门终端和关键命令。
$curl -L https://raw.githubusercontent.com/hyperledger/fabric/master/examples/sfhackfest/sfhackfest.tar.gz -o sfhackfest.tar.gz 2> /dev/null; tar -xvf sfhackfest.tar.gz
$docker-compose -f docker-compose-gettingstarted.yml build
$docker-compose -f docker-compose-gettingstarted.yml up -d
$docker ps
已确认已激活六个容器
2.下载示例并安装模块。
$curl -OOOOOO https://raw.githubusercontent.com/hyperledger/fabric-sdk-node/v1.0-alpha/examples/balance-transfer/{config.json,deploy.js,helper.js,invoke.js,query.js,package.json}
//This link didn't work, so I downloaded the required files from GitHub of fabric-sdk-node
$npm install --global windows-build-tools
$npm install
3.尝试部署链码。
$node deploy.js
答案 0 :(得分:3)
我在遵循最新的#34;写你的第一个应用程序&#34;时遇到了同样的问题。教程(http://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html)。我安装了所有先决条件和fabric-samples
并启动了本地网络。
当我进入注册管理员用户$ node enrollAdmin.js
的步骤时,我收到与上面相同的错误消息Error: connect ECONNREFUSED
,然后是localhost域。
正如第一个答案所示,根本原因是我正在运行Docker Toolbox。我正在使用较旧的Mac OSX v10.9.5进行开发,因此我无法使用Docker for Mac。
要解决此问题,我使用Docker Toolbox中的IP替换了enrollAdmin.js代码中的'localhost'
。
以下是我采取的步骤:
docker is configured to use the default machine with IP
... enrollAdmin.js
目录fabric-samples/fabcar
的副本
找到此代码:
// be sure to change the http to https when the CA is running TLS enabled
fabric_ca_client = new Fabric_CA_Client('http://localhost:7054', tlsOptions , 'ca.example.com', crypto_suite); // <-- This is the line to change
:7054
不变。$ node enrollAdmin.js
连接到CA的脚本已成功完成管理员注册。
进入下一步!
答案 1 :(得分:2)
有几个问题,其中最简单的文档已经过时,并且是针对Hyperledger Fabric的预览版本。由于我们需要更新我们的示例/示例,因此文档实际上正在被删除。
您提到了Docker Toolbox - 您是否尝试在Windows或Mac上运行所有这些?
<强>更新强>
因此,Docker Toolbox或Docker for Windows的一个问题是,当尝试从主机上的应用程序(即使在QuickStart终端中)与Docker的端点进行通信时,您无法使用localhost / 127.0.0.1作为地址容器。当QuickStart Terminal首次启动Docker时,您将看到它将输出您在与暴露端口通信时应使用的端点的IP地址。