没有合适的资源?快使用搜索试试~ 我知道了~
手动搭建fabric单机多节点网络.pdf
需积分: 30 16 下载量 145 浏览量
2020-07-20
09:35:24
上传
评论 1
收藏 168KB PDF 举报
温馨提示


试读
22页
基于hyperledger fabric2.0手动搭建单机多节点网络,所有步骤均基于fabric-sample的test-network脚本
资源推荐
资源详情
资源评论













构建fabric单机多节点⽹络
在进⾏后续操作之前将 fabric-samples/bin ⽬录添加到 PATH 变量中,这样就可以在任意位置
使⽤fabric提供的⼆进制⽂件命令
echo "export PATH=$PATH:$HOME/Documents/fabric-learn/fabric-samples/bin" >>
~/.bash_profile
⼯作⽬录为 fabric-samples/setup-up-my-network
1.⽣成加密材料
这⼀步通过 cryptogen ⼯具完成
这⾥使⽤ showtemplate ⼦命令,该命令将⽣成加密材料所需要的配置信息显示在terminal,可以结合
重定向命令将配置信息输出到指定的配置⽂件中
将 crypto-config.yaml ⽂件移动到 organizations/cryptogen ⽬录下,然后复制三份并分别改名
为 crypto-config-orderer.yaml、crypto-config-org1.yaml、crypto-config-org2.yaml
# 下⾯是该命令的帮助信息
$ cryptogen --help
usage: cryptogen [<flags>] <command> [<args> ...]
Utility for generating Hyperledger Fabric key material
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
Commands:
generate [<flags>] # ⽤于⽣成密码材料
showtemplate # 显示默认的配置模板
extend [<flags>] # 拓展已有的⽹络
$ cryptogen showtemplate >> crypto-config.yaml
# crypto-config-orderer.yaml
OrdererOrgs:
- Name: Orderer
Domain: example.com
EnableNodeOUs: true
Specs:
- Hostname: orderer
SANS:
- localhost

⽣成证书使⽤的是 cryptogen generate 命令
下⾯是实际操作
# crypto-config-org1.yaml
PeerOrgs:
- Name: Org1
Domain: org1.example.com
EnableNodeOUs: true
Template:
Count: 1
SANS:
- localhost
Users:
Count: 1
# crypto-config-org2.yaml
PeerOrgs:
- Name: Org2
Domain: org2.example.com
EnableNodeOUs: true
Template:
Count: 1
SANS:
- localhost
Users:
Count: 1
# cryptogen generate --help查看该⼦命令帮助信息
$ cryptogen generate --help
usage: cryptogen generate [<flags>]
Generate key material
Flags:
--output="crypto-config" # 指定加密材料的输出⽬录
--config=CONFIG # 要使⽤的配置⽂件的路径
cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --
output="organizations"
cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --
output="organizations"
cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --
output="organizations"

2.创建系统channel的创世块
这⼀步⽤到了 configtxgen 命令,可通过 --help 参数查看该命令帮助信息。
该命令需要⼀个配置⽂件 configtx.yaml 才能执⾏(⽂件名固定),可以从 test-network/configtx
⽬录下拷⻉
下⾯是修改之后的 configtx.yaml 配置⽂件
Usage of configtxgen:
-asOrg string
Performs the config generation as a particular organization (by name), only
including values in the write set that org (likely) has privilege to set
-channelCreateTxBaseProfile string
Specifies a profile to consider as the orderer system channel current state to
allow modification of non-application parameters during channel create tx generation.
Only valid in conjunction with 'outputCreateChannelTx'.
-channelID string
The channel ID to use in the configtx
-configPath string
The path containing the configuration to use (if set)
-inspectBlock string
Prints the configuration contained in the block at the specified path
-inspectChannelCreateTx string
Prints the configuration contained in the transaction at the specified path
-outputAnchorPeersUpdate string
[DEPRECATED] Creates a config update to update an anchor peer (works only with
the default channel creation, and only for the first update)
-outputBlock string
The path to write the genesis block to (if set)
-outputCreateChannelTx string
The path to write a channel creation configtx to (if set)
-printOrg string
Prints the definition of an organization as JSON. (useful for adding an org to a
channel manually)
-profile string
The profile from configtx.yaml to use for generation.
-version
Show version information
$ cp ../configtx/configtx.yaml configtx
################################################################################
#
# Section: Organizations
#
# - This section defines the different organizational identities which will
# be referenced later in the configuration.
#
################################################################################
Organizations:

# SampleOrg defines an MSP using the sampleconfig. It should never be used
# in production but may be used as a template for other definitions
- &OrdererOrg
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Name: OrdererOrg
# ID to load the MSP definition as
ID: OrdererMSP
# MSPDir is the filesystem path which contains the MSP configuration
MSPDir: ../organizations/ordererOrganizations/example.com/msp
# Policies defines the set of policies at this level of the config tree
# For organization policies, their canonical path is usually
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
Policies:
Readers:
Type: Signature
Rule: "OR('OrdererMSP.member')"
Writers:
Type: Signature
Rule: "OR('OrdererMSP.member')"
Admins:
Type: Signature
Rule: "OR('OrdererMSP.admin')"
OrdererEndpoints:
- orderer.example.com:7050
- &Org1
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Name: Org1MSP
# ID to load the MSP definition as
ID: Org1MSP
MSPDir: ../organizations/peerOrganizations/org1.example.com/msp
# Policies defines the set of policies at this level of the config tree
# For organization policies, their canonical path is usually
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
Policies:
Readers:
Type: Signature
Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')"
Writers:
Type: Signature
Rule: "OR('Org1MSP.admin', 'Org1MSP.client')"
Admins:
Type: Signature

Rule: "OR('Org1MSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('Org1MSP.peer')"
# leave this flag set to true.
AnchorPeers:
# AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
# encoded in the genesis block in the Application section context
- Host: peer0.org1.example.com
Port: 7051
- &Org2
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Name: Org2MSP
# ID to load the MSP definition as
ID: Org2MSP
MSPDir: ../organizations/peerOrganizations/org2.example.com/msp
# Policies defines the set of policies at this level of the config tree
# For organization policies, their canonical path is usually
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
Policies:
Readers:
Type: Signature
Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')"
Writers:
Type: Signature
Rule: "OR('Org2MSP.admin', 'Org2MSP.client')"
Admins:
Type: Signature
Rule: "OR('Org2MSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('Org2MSP.peer')"
AnchorPeers:
# AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
# encoded in the genesis block in the Application section context
- Host: peer0.org2.example.com
Port: 9051
################################################################################
#
# SECTION: Capabilities
#
# - This section defines the capabilities of fabric network. This is a new
剩余21页未读,继续阅读
资源评论


半纸药笺
- 粉丝: 12
- 资源: 8
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- Qt、QtSerialPort串口通信串口调试助手SerialAssistant.zip
- C++ OpenCv 二维码识别,跟踪,二维码框示周围,内容读取
- 项目2.zip
- VC++ 内存绘制图像并保存
- 使用CefSharp在.Net程序中嵌入Chrome内核使用CefSharp在.Net程序中嵌入Chrome内核使用CefSha
- College-Second-hand-vue-main.zip
- python Zbar 二维码识别,跟踪,二维码框示周围,倾角计算,内容读取
- 基于STM32单片机+ESP8266+DS1302的实时时间天气串口屏显示倒计时报警软件源码.zip
- Temperature Cycling JESD22-A104D
- ST单电阻PMSM 方案专利文档,专利号US20090284194
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
