它利用了configtx.yaml文件,个中包括网络的界说,因此我们将在burakcan-network目次下建设以下文件。
Type: Signature
OrdererEndpoints:
MSPDir: crypto-config/ordererOrganizations/burakcan-network.com/msp
Type: ImplicitMeta
Rule: "ANY Readers"
<<: *ApplicationCapabilities
Rule: "OR('OrdererMSP.member')"
Domain: be1.burakcan-network.com
- orderer.burakcan-network.com:7050
Template:
Policies:
Rule: "OR('Burakcan1MSP.admin')"
Type: ImplicitMeta
Policies:
Writers:
Name: Burakcan2MSP
EnableNodeOUs: true
V2_0: true
Organizations:
<<: *ChannelCapabilities
建设一个自界说网络并启动它
- Host: peer0.be2.burakcan-network.com
Type: Signature
<<: *OrdererDefaults
Type: Signature
./channel-artifacts/genesis.block -channelID channelorderergenesis
MyFirstConsortium:
V2_0: true
- Name: Burakcan2
ID: Burakcan1MSP
Rule: "OR('Burakcan1MSP.peer')"
Domain: be2.burakcan-network.com
Type: ImplicitMeta
Capabilities:
· 2 anchor peer transactions(必需针对每个组织,而且我们有Burakcan1和Burakcan2组织,因此我们将生成2个)
Users:
Brokers:
- *Burakcan1
Type: ImplicitMeta
Policies:
<<: *ChannelDefaults
- orderer.burakcan-network.com:7050
Organizations:
Type: ImplicitMeta
- Hostname: orderer
界说configtx.yaml文件后,我们有序执行以下呼吁以生成我们在burakcan-network目次下上面提到的设置构件;
Type: ImplicitMeta
Type: Signature
Application: &ApplicationDefaults
Channel: &ChannelDefaults
../bin/configtxgen -profile OrdererGenesis -outputBlock
· 1 orderer genesis block
- &Burakcan2
Kafka:
# Application
界说crypto-config.yaml文件后,我们在burakcan-network目次下执行以下呼吁通道。
<<: *OrdererCapabilities
Admins:
Rule: "OR('Burakcan2MSP.admin')"
Port: 7051
Orderer: &OrdererDefaults
Admins:
Domain: burakcan-network.com
Rule: "OR('Burakcan2MSP.admin', 'Burakcan2MSP.client')"
在开始之前,你先要设置好Hyperledger Fabric的插件和设置好情况变量。详细可以参考上一遍文章。 Channel: &ChannelCapabilities
Writers:
Port: 7051
Name: OrderingService
Readers:
Rule: "MAJORITY Admins"
我们应该看到以下动静。
- Name: OrderingService
Policies:
- &Burakcan1
../bin/cryptogen generate --config crypto-config.yaml --output=crypto-config
Admins:
Rule: "ANY Writers"
Endorsement:
Count: 1
Template:
Addresses:
Endorsement:
- *OrdererOrg
Capabilities:
MSPDir: crypto-config/peerOrganizations/be1.burakcan-network.com/msp
Specs:
Admins:
Orderer:
Application: &ApplicationCapabilities
Users:
ID: Burakcan2MSP
LifecycleEndorsement:
Consortium: MyFirstConsortium
Type: Signature
Rule: "ANY Writers"
Rule: "OR('Burakcan2MSP.admin', 'Burakcan2MSP.peer', 'Burakcan2MSP.client')"
Application:
OrdererGenesis:
Rule: "ANY Readers"
然后,我们将继承安装平台特定的二进制文件时已经安装的configtxgen东西,该东西也将安排在fabric-samples/bin文件夹下。它提供了生成这些重要设置工件的要领。
· 1 channel configuration transaction
ChannelDemo:
Type: ImplicitMeta
Rule: "OR('Burakcan1MSP.admin', 'Burakcan1MSP.peer', 'Burakcan1MSP.client')"
<<: *ChannelCapabilities
- *Burakcan1
BatchSize:
Admins:
Type: Signature
Capabilities:
Rule: "MAJORITY Admins"
- &OrdererOrg
Type: ImplicitMeta
Rule: "OR('OrdererMSP.admin')"
Organizations:
Readers:
MSPDir: crypto-config/peerOrganizations/be2.burakcan-network.com/msp
Count: 1
AnchorPeers:
Rule: "OR('Burakcan1MSP.admin', 'Burakcan1MSP.client')"
<<: *ApplicationCapabilities
Readers:
Type: Signature
Count: 1 Rule: "MAJORITY Endorsement"
Writers:
<<: *ChannelDefaults
Type: Signature
我们在fabric-samples文件夹下建设一个名为burakcan-network的文件夹。在我们的网络中,有3个节点,包罗2个组织,别离是BurakCan1和Burakcan2,以及1个orderer,因此我们需要生成所有证书和密钥来证明节点是否真的是本身。我们将利用cryptogen东西提供用于为我们的网络实体生成暗码质料,,而且在安装特定于平台的二进制文件时已经安装了它。它放在fabric-samples / bin文件夹下。它利用了包括网络拓扑的crypto-config.yaml文件,并答允我们为组织以及属于这些组织的组件生成一组证书和密钥。 - *Burakcan2
Readers:
这就是我们在burakcan网络目次下建设以下文件的原因。我们界说了一个Orderer组织(OrdererOrg)和2个对等组织(Burakcan1和Burakcan2)。组织中的每个计数值都指定该组织中的peers数。 Capabilities:
生成orderer的创世块;
BatchTimeout: 2s
Rule: "ANY Writers"
Profiles:
Type: ImplicitMeta
Capabilities:
Type: ImplicitMeta
- 127.0.0.1:9092
AnchorPeers:
Writers:
- Name: Burakcan1
AbsoluteMaxBytes: 99 MB
OrdererType: solo
Rule: "MAJORITY Admins"
Policies:
Type: Signature
Readers:
Rule: "ANY Writers"
Rule: "OR('Burakcan2MSP.peer')"
Writers:
Name: Burakcan1MSP
Policies:
BlockValidation:
Count: 2
V2_0: true
Orderer: &OrdererCapabilities
EnableNodeOUs: true
Type: Signature
Readers:
Rule: "ANY Readers"
OrdererOrgs:
- Host: peer0.be1.burakcan-network.com
MaxMessageCount: 10
PreferredMaxBytes: 512 KB
Rule: "MAJORITY Endorsement"
- *Burakcan2
Rule: "OR('OrdererMSP.member')"
ID: OrdererMSP
Capabilities:
Endorsement:
# Orderer
Type: ImplicitMeta
<<: *ApplicationDefaults
在本文中我们将建设一个自界说网络,并利用Hyperledger Fabric v2.1陈设示例链代码。之后,我们将查询chaincode并由我们将建设的2个对等点与网络举办交互。
PeerOrgs:Organizations:
Admins:
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。