Fabric命令手册

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

configtxlator proto_decode

将一个protobuf消息转换为JSON格式。

使用方法

~$ configtxlator proto_decode --type=TYPE [<flags>]

命令标志:

  --help                Show context-sensitive help (also try --help-long and
                        --help-man).
  --type=TYPE           The type of protobuf structure to decode from. For
                        example, 'common.Config'.
  --input=/dev/stdin    A file containing the proto message.
  --output=/dev/stdout  A file to write the JSON document to.

示例代码

下面的示例将名为fabric_block.pb的区块转换为json格式并在stdout输出:

~$ configtxlator proto_decode --input fabric_block.pb --type common.Block

在启动rest服务后,下面的示例使用curl命令通过rest api执行同样的操作:

~$ curl -X POST --data-binary @fabric_block.pb "${CONFIGTXLATOR_URL}/protolator/decode/common.Block"