我在建立简单的Hyperledger Fabric v1.2.0网络时遇到麻烦。我要构建的网络由一个订购者和一个具有一个同级的单一组织组成。我确实成功完成了“首次构建网络”教程,并且希望从头开始。但是,在将对等方加入频道时,我总是遇到错误。
docker exec -e "CORE_PEER_LOCALMSPID=FooMSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@foo.bcn.org/msp" -e "CORE_PEER_ADDRESS=peer0.foo.bcn.org:7051" peer0.foo.bcn.org peer channel join -b /etc/hyperledger/configtx/genesis.block
2018-08-25 17:50:18.970 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: proposal failed (err: bad proposal response 500)
订购者的日志或对等方的日志都没有(至少对我来说)显示一些揭示信息。
记录peer0.foo.bcn.org
2018-08-25 17:50:13.676 UTC [nodeCmd] serve -> INFO 01d Started peer with ID=[name:"peer0.foo.bcn.org" ], network ID=[dev], address=[peer0.foo.bcn.org:7051]
2018-08-25 17:50:18.972 UTC [endorser] ProcessProposal -> ERRO 01e [][20e127e8] simulateProposal() resulted in chaincode name:"cscc" response status 500 for txid: 20e127e8af5dc8f513da9ea287b1ae2940df834be0f1b0404560b3e94e94627a
记录orderer.bcn.org
除了下面一行,订购者的日志对我没有任何可疑之处。
2018-08-25 17:50:18.784 UTC [common/deliver] Handle -> WARN 2fc Error reading from 172.18.0.3:50860: rpc error: code = Canceled desc = context canceled
直接导致我出错的命令,生成通道工件并连接到对等端以创建并加入通道。
# generate crypto material
cryptogen generate --config=./crypto-config.yaml
# generate genesis block for orderer
configtxgen -profile OrdererGenesis -outputBlock ./channel-artifacts/genesis.block
# generate channel configuration transaction
configtxgen -profile OrgChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID bcnchannel
docker-compose -f docker-compose.yaml up -d
# Create the channel
docker exec -e "CORE_PEER_LOCALMSPID=FooMSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@foo.bcn.org/msp" -e "CORE_PEER_ADDRESS=peer0.foo.bcn.org:7051" peer0.foo.bcn.org peer channel create -o orderer.bcn.org:7050 -c bcnchannel -f /etc/hyperledger/configtx/channel.tx
# Join peer to the channel.
docker exec -e "CORE_PEER_LOCALMSPID=FooMSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@foo.bcn.org/msp" -e "CORE_PEER_ADDRESS=peer0.foo.bcn.org:7051" peer0.foo.bcn.org peer channel join -b /etc/hyperledger/configtx/genesis.block
任何想法可能导致此问题以及如何解决该问题?
谢谢!
crypto-config.yaml
OrdererOrgs:
- Name: Orderer
Domain: bcn.org
Specs:
- Hostname: orderer
PeerOrgs:
- Name: Foo
Domain: foo.bcn.org
Template:
Count: 1
Start: 0
Users:
Count: 1
configtx.yaml
Organizations:
- &OrdererOrg
Name: BCNOrdererOrg
ID: BCNOrdererMSP
AdminPrincipal: Role.ADMIN
MSPDir: crypto-config/ordererOrganizations/bcn.org/msp
- &Org1
Name: Foo
ID: FooMSP
AdminPrincipal: Role.ADMIN
MSPDir: crypto-config/peerOrganizations/foo.bcn.org/msp
AnchorPeers:
- Host: peer0.foo.bcn.org
Port: 7051
Application: &ApplicationDefaults
Organizations:
Orderer: &OrdererDefaults
OrdererType: solo
Addresses:
- orderer.bcn.org:7050
BatchTimeout: 2s
MaxChannels: 0
BatchSize:
MaxMessageCount: 10
AbsoluteMaxBytes: 99 MB
PreferredMaxBytes: 512 KB
Organizations:
Profiles:
OrdererGenesis:
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Consortiums:
BCNConsortium:
Organizations:
- *Org1
OrgChannel:
Consortium: BCNConsortium
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
docker-compose.yaml
version: '2'
networks:
bcn-net:
services:
orderer.bcn.org:
container_name: orderer.bcn.org
image: hyperledger/fabric-orderer
environment:
- ORDERER_GENERAL_LOGLEVEL=debug
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block
- ORDERER_GENERAL_LOCALMSPID=BCNOrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/orderer
command: orderer
ports:
- 7050:7050
volumes:
- ./channel-artifacts/:/etc/hyperledger/configtx
- ./crypto-config/ordererOrganizations/bcn.org/orderers/orderer.bcn.org/:/etc/hyperledger/msp/orderer
networks:
- bcn-net
peer0.foo.bcn.org:
container_name: peer0.foo.bcn.org
image: hyperledger/fabric-peer
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.foo.bcn.org
- CORE_LOGGING_PEER=debug
- CORE_CHAINCODE_LOGGING_LEVEL=debug
- CORE_PEER_LOCALMSPID=FooMSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/
- CORE_PEER_ADDRESS=peer0.foo.bcn.org:7051
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_bcn-net
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: peer node start
ports:
- 7051:7051
- 7053:7053
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/foo.bcn.org/peers/peer0.foo.bcn.org/msp:/etc/hyperledger/msp/peer
- ./crypto-config/peerOrganizations/foo.bcn.org/users:/etc/hyperledger/msp/users
- ./channel-artifacts:/etc/hyperledger/configtx
depends_on:
- orderer.bcn.org
networks:
- bcn-net
答案 0 :(得分:0)
无数小时地检查我的配置文件后,我终于发现我搞砸了。 问题在于加入频道时使用了错误的阻止文件。
为了加入渠道,我使用了订购者的创始块,而不是在“对等渠道创建”过程中创建的那个。
因此,在使用
创建频道后peer channel create -o orderer.bcn.org:7050 -c bcnchannel -f /etc/hyperledger/configtx/channel.tx
我应该用过
peer channel join -b bcnchannel.block
代替
peer channel join -b /etc/hyperledger/configtx/genesis.block