Hands-On Hyperledger Fabric——Fabric模块命令之configtxlator

Fabric模块的子命令和配置文件

configtxlator

configtxlator模块可以把区块链的二进制文件转化成JSON文件,便于我们阅读和理解。

configtxlator命令如下:

root@da8733922983:~# configtxlator --help
usage: configtxlator [<flags>] <command> [<args> ...]

Utility for generating Hyperledger Fabric channel configurations

Flags:
  --help  Show context-sensitive help (also try --help-long and --help-man).

Commands:
  help [<command>...]
    Show help.

  start [<flags>]			# 启动configtxlator REST服务器
    Start the configtxlator REST server

  proto_encode --type=TYPE [<flags>]		# 将JSON编码为protobuf(.pb)文件
    Converts a JSON document to protobuf.

  proto_decode --type=TYPE [<flags>]		# 将其他文件解码为JSON文件
    Converts a proto message to JSON.

  compute_update --channel_id=CHANNEL_ID [<flags>]
  # 计算配置更新量,也就是计算两个配置文件的差异,提取出其中的差异并生成区块格式的.pb文件
    Takes two marshaled common.Config messages and computes the config update which transitions
    between the two.

  version
    Show version information

configtxlator 是以一个RESTAPI服务的形式提供服务的,可以通过标准的HTTP请求来访问configtxlator。其启动命令如下:

root@da8733922983:~# configtxlator start --help
usage: configtxlator start [<flags>]

Start the configtxlator REST server

Flags:
  --help                Show context-sensitive help (also try --help-long and --help-man).
  --hostname="0.0.0.0"  The hostname or IP on which the REST server will listen
  --port=7059           The port on which the REST server will listen
  --CORS=CORS ...       Allowable CORS domains, e.g. '*' or 'www.example.com' (may be repeated).

configtxgen典型的应用场景

运行configtxlator REST服务器:

 configtxlator start --hostname=localhost --port=7059  &

解码:

curl -X POST  --data-binary orderer.genesis.block localhost:7059/protolator/decode/common.Block > orderer.genesis.json

编码:

curl -X POST  --data-binary orderer.genesis.json localhost:7059/protolator/encode/common.Config > orderer.genesis.pb

其他命令 以后再说,环境太难搭建了。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值