我正在尝试使用Hyperledger Fabric版本2建立一个由单个订购者和3个组织组成的网络,每个组织在AWS上具有一个对等节点。我可以使用configtxgen成功地为订购者和通道配置事务生成创世块。以下命令:
configtxgen -profile ThreeOrgsOrdererGenesis -channelID ordererchannel -outputBlock ./config/genesis.block
configtxgen -profile ChannelAll -outputCreateChannelTx ./config/channel.tx -channelID channelall
这是我的configtx.yaml文件:(这里的策略不是一个好习惯,只是做实验)
---
Organizations:
- &OrdererOrg
Name: OrdererOrg
ID: OrdererMSP
MSPDir: ./crypto-config/ordererOrganizations/example.com/msp
Policies:
Readers:
Type: Signature
Rule: "OR('OrdererMSP.member')"
Writers:
Type: Signature
Rule: "OR('OrdererMSP.member')"
Admins:
Type: Signature
Rule: "OR('OrdererMSP.member')"
- &Org1
Name: Org1MSP
ID: Org1MSP
MSPDir: ./crypto-config/peerOrganizations/org1.example.com/msp
Policies:
Readers:
Type: Signature
Rule: "OR('Org1MSP.member')"
Writers:
Type: Signature
Rule: "OR('Org1MSP.member')"
Admins:
Type: Signature
Rule: "OR('Org1MSP.member')"
Endorsement:
Type: Signature
Rule: "OR('Org1MSP.member')"
- &Org2
Name: Org2MSP
ID: Org2MSP
MSPDir: ./crypto-config/peerOrganizations/org2.example.com/msp
Policies:
Readers:
Type: Signature
Rule: "OR('Org2MSP.member')"
Writers:
Type: Signature
Rule: "OR('Org2MSP.member')"
Admins:
Type: Signature
Rule: "OR('Org2MSP.member')"
Endorsement:
Type: Signature
Rule: "OR('Org2MSP.member')"
- &Org3
Name: Org3MSP
ID: Org3MSP
MSPDir: ./crypto-config/peerOrganizations/org3.example.com/msp
Policies:
Readers:
Type: Signature
Rule: "OR('Org3MSP.member')"
Writers:
Type: Signature
Rule: "OR('Org3MSP.member')"
Admins:
Type: Signature
Rule: "OR('Org3MSP.member')"
Endorsement:
Type: Signature
Rule: "OR('Org3MSP.member')"
Capabilities:
Channel: &ChannelCapabilities
V1_3: true
Orderer: &OrdererCapabilities
V1_1: true
Application: &ApplicationCapabilities
V2_0: true
V1_3: false
V1_2: false
V1_1: false
Application: &ApplicationDefaults
Organizations:
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
LifecycleEndorsement:
Type: ImplicitMeta
Rule: "MAJORITY Endorsement"
Endorsement:
Type: ImplicitMeta
Rule: "MAJORITY Endorsement"
Capabilities:
<<: *ApplicationCapabilities
Orderer: &OrdererDefaults
OrdererType: solo
Addresses:
- orderer.example.com:7050
BatchTimeout: 2s
BatchSize:
MaxMessageCount: 300
AbsoluteMaxBytes: 99 MB
PreferredMaxBytes: 512 KB
Kafka:
Brokers:
- 127.0.0.1:9092
Organizations:
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
BlockValidation:
Type: ImplicitMeta
Rule: "ANY Writers"
Channel: &ChannelDefaults
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
Capabilities:
<<: *ChannelCapabilities
Profiles:
ThreeOrgsOrdererGenesis:
<<: *ChannelDefaults
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Capabilities:
<<: *OrdererCapabilities
Consortiums:
SampleConsortium:
Organizations:
- *Org1
- *Org2
- *Org3
ChannelAll:
Consortium: SampleConsortium
<<: *ChannelDefaults
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
- *Org3
Capabilities:
<<: *ApplicationCapabilities
当我将peer1
加入创建的频道时,在订购者的docker日志中收到以下警告:
Handle -> WARN 008 Error reading from 172.31.19.174:35362: rpc error: code = Canceled desc = context canceled
首先,我只是忽略了此警告,并将其他节点加入了该频道。但是,我无法使用使用Fabric Node SDK的客户端程序连接到区块链,所以我相信这是问题的根本原因。
答案 0 :(得分:0)
我注意到您使用
configtxgen -profile OneOrgOrdererGenesis
在“个人资料”部分的configtx.yaml
中是ThreeOrgsOrdererGenesis
。
也许您应该尝试使用以下命令生成加密文件:
configtxgen -profile ThreeOrgsOrdererGenesis -channelID ordererchannel -outputBlock ./config/genesis.block
configtxgen -profile ChannelAll -outputCreateChannelTx ./config/channel.tx -channelID channelall