fabric1.4.3单机环境搭建教程(二)

本文详细介绍如何通过crypto-config.yaml和configtx.yaml配置文件手动搭建Hyperledger Fabric网络,包括生成组织结构及身份证书、创世区块和通道文件等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

手动搭建自己的Fabric网络

1.如何生成组织结构及身份证书
生成过程主要依赖crypto-config.yaml配置文件,该文件路径为fabric-samples/first-network/crypto-config.yaml
进入fabric-samples/first-network目录

$ cd hy/fabric-samples/first-network/

使用cryptogen工具为网络生成指定组织结构和身份证书

$ sudo …/bin/cryptogen generate --config=./crypto-config.yaml

2.生成创世区块和通道文件
生成过程主要依赖configtx.yaml配置文件

$ sudo …/bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock
./channel-artifacts/genesis.block(生成创世区块)
$ export CHANNEL_NAME=mychannel (指定通道名称)
$ sudo …/bin/configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx
-channelID $CHANNEL_NAME(创建通道)

3.生成锚节点更新配置文件

$ sudo …/bin/configtxgen -profile TwoOrgsChannel
-outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP
$ sudo …/bin/configtxgen -profile TwoOrgsChannel
-outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP

4.启动网络

$ sudo docker-compose -f docker-compose-cli.yaml up -d

5.查看网络运行情况

$ sudo docker ps

6.关闭网络

$ sudo docker-compose -f docker-compose-cli.yaml down

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值