hyperledger生成peer和order

证书生成cryptogen crypto-config.yaml

创始块,通道configtxgen configtx.yaml(first-network)
  组织相关信息
       组织名字,组织ID,组织MSP
       组织名字,组织ID,组织MSP,锚节点
   排序节点属性
        共识机制
        区块生成时机
    profiles:
       创始块信息
       通道信息

两个组织
组织1
order
orderer.example.com
组织名字,组织ID,组织MSP

组织2
peer

   org1.example.com 
   org2.example.com 
   组织名字,组织ID,组织MSP,锚节点

目录mytestfabric

    -------base
    -------channel-artifacts
   ---------------channel.tx
   ---------------CppMSPanchor.tx
   ---------------gensis.block
   ---------------GoMSPanchor.tx
    -------crypto-config
    -------chaincode
    --------------可以用chaincode_example02

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

使用docker-compose.yaml进行启动,docker-compose.yaml来源于docker-compose-cli.yaml。

docker-compose ps命令进行查看相应的docker-compose启动的进程
docker-compose up docker-compose down

docker exec -it cli bash进入客户端

orderer.example.com
org1.example.com
org2.example.com

cryptogen --help

cryptogen generate --config=crypto-config.yaml

configtxgen --help 
  # 输出创始块区块文件的路径和名字
  `-outputBlock string`
  # 指定创建的channel的名字, 如果没指定系统会提供一个默认的名字.
  `-channelID string`
  # 表示输通道文件路径和名字
  `-outputCreateChannelTx string`
  # 指定配置文件中的节点
  `-profile string`
  # 更新channel的配置信息
  `-outputAnchorPeersUpdate string`
  # 指定所属的组织名称
  `-asOrg string`
  # 要想执行这个命令, 需要一个配置文件 configtx.yaml

profile 后边的参数从configtx.yaml中的Profiles 里边的配置项

  • 生成创始块文件
    $ configtxgen -profile OrgsOrdererGenesis -outputBlock ./genesis.block -channelID testchannel
    - 在当前目录下得到一个文件: genesis.block
  • 生成通道文件
    $ configtxgen -profile OrgsChannel -outputCreateChannelTx channel.tx -channelID testchannel
    # 如果没有指定channelID, 默认的通道名叫 mychannel
  • 生成锚节点更新文件
    这个操作是可选的
    # 每个组织都对应一个锚节点的更新文件
    # go组织锚节点文件
    $ configtxgen -profile OrgsChannel -outputAnchorPeersUpdate GoMSPanchors.tx -channelID testchannel -asOrg OrgGoMSP
    # cpp组织锚节点文件
    $ configtxgen -profile OrgsChannel -outputAnchorPeersUpdate CppMSPanchors.tx -channelID testchannel -asOrg OrgCppMSP
    # 查看生成的文件
    $ tree -L 1
    .
    ├── channel-artifacts
    ├── channel.tx ----------> 生成的通道文件
    ├── configtx.yaml
    ├── CppMSPanchors.tx -----> 生成的cpp组织锚节点文件
    ├── crypto-config
    ├── crypto-config.yaml
    ├── genesis.block --------> 生成的创始块文件
    └── GoMSPanchors.tx ------> 生成的go组织锚节点文件

docker-compose.yaml
1、order节点环境变量
2、peer节点环境变量
3、客户端环境变量
4、配置文件
5、启动容器

cryptogen generate --config=crypto-config.yaml

在这里插入图片描述
在这里插入图片描述

configtxgen -profile MyGenesis -outputBlock genesis.block在这里插入图片描述

 configtxgen -profile MyChannel -outputCreateChannelTx channel.tx -channelID testchannel

在这里插入图片描述
更新锚节点
configtxgen -profile MyChannel -outputAnchorPeersUpdate orgGoAnchor.tx -channelID testchannel -asOrg OrgGoMSP
在这里插入图片描述
更新锚节点
configtxgen -profile MyChannel -outputAnchorPeersUpdate orgCppAnchor.tx -channelID testchannel -asOrg OrgCppMSP
在这里插入图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值