超级账本中的第一个网络 [英] First network in hyperledger
问题描述
我正在尝试在Hyperledger Fabric中的第一个网络上工作.使用以下文档 http://hyperledger-fabric.readthedocs.io/en/latest/build_network. html
I am trying to work on my first network in Hyperledger Fabric. Using the following documentation http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html
我已经完成设置,直到 http://hyperledger-fabric.readthedocs.io/zh/latest/build_network.html#create-join-channel
I have completed the setup till http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#create-join-channel
但是当我运行
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
我遇到错误
错误:出现意外状态:BAD_REQUEST
搜索我遇到的问题 http://hyperledgerdocs.readthedocs.io/en/latest/asset_trouble.html
因此,我尝试使用给定的新频道名称(旧频道名称= mychannel), 我已经在cmds下面尝试过
Hence I've tried to use a new channel name as given(old channel name=mychannel), I've tried below cmds
CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050 peer channel create -c myc1
CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer.example.com:7050 peer channel create -c myc1
CORE_PEER_COMMITTER_LEDGER_ORDERER=172.18.0.2:7050 peer channel create -c myc1
对于这三个我都出错了
错误:订购服务端点无效或缺失 用法: 对等频道创建[标志]
Error: Ordering service endpoint is not valid or missing Usage: peer channel create [flags]
此外,我还假设已创建频道,因此尝试过跳过它. 因此跑了
Also I've tried to skip it assuming the channel is already created. hence ran
peer channel join -b ./mychannel.block
但是得到了
错误:投标失败(错误:rpc错误:代码=未知desc =链码错误(状态:500,消息:由于LedgerID已经存在,无法从创始块创建分类帐)) >
我的操作系统是Ubuntu 16.04
My OS is Ubuntu 16.04
docker ps 请帮助
docker ps Kindly help
推荐答案
Let's try to make sure you run thru all the steps as outlined in docs.
-
首先,您需要在 cli 部分中编辑
docker-compose-cli.yaml
文件,以注释掉负责运行频道自动创建和加入流程的行:
First of all you need to edit your
docker-compose-cli.yaml
file the cli section to comment out line responsible to run automatic flow of channel creation and join:
command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'
例如
# command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'
-
您正在使用的下一个导出频道名称:
Next export channel name you are working with:
export CHANNEL_NAME=mychannel
启动网络(使用60秒的默认超时):
Start the network (use default timeout of 60s):
CHANNEL_NAME=$CHANNEL_NAME docker-compose -f docker-compose-cli.yaml up -d
输入cli容器:
docker exec -it cli bash
导出环境变量:
export CHANNEL_NAME=mychannel
创建频道:
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
加入频道:
Join the channel:
peer channel join -b mychannel.block
这篇关于超级账本中的第一个网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!