## 1. 释义
将一个JSON文档转换为protobuf格式数据。
## 2. 使用方法
```
~$ configtxlator proto_encode --type=TYPE [<flags>]
```
命令标志:
```
--help Show context-sensitive help (also try --help-long and
--help-man).
--type=TYPE The type of protobuf structure to encode to. For
example, 'common.Config'.
--input=/dev/stdin A file containing the JSON document.
--output=/dev/stdout A file to write the output to.
```
## 3. 示例代码
下面的示例将控制台输入的json格式的policy,转换为protobuf格式并存入文件policy.pb:
```
~$ configtxlator proto_encode --type common.Policy --output policy.pb
```
在启动rest服务后,下面的示例使用curl命令通过rest api执行同样的操作:
```
~$ curl -X POST --data-binary /dev/stdin "${CONFIGTXLATOR_URL}/protolator/encode/common.Policy" > policy.pb
```
- Fabric命令手册
- Peer命令
- peer
- peer node
- peer node start
- peer node status
- peer channel
- peer channel create
- peer channel fetch
- peer channel getinfo
- peer channel join
- peer channel list
- peer channel signconfigtx
- peer channel update
- peer chaincode
- peer chaincode install
- peer chaincode instantiate
- peer chaincode invoke
- peer chaincode list
- peer chaincode package
- peer chaincode query
- peer chaincode signpackage
- peer chaincode upgrade
- peer version
- peer logging
- peer logging getlevel
- peer logging revertlevels
- peer logging setlevel
- Configtxgen命令
- configtxgen
- Configtxlator命令
- configtxlator
- configtxlator start
- configtxlator proto_encode
- configtxlator proto_decode
- configtxlator compute_update
- configtxlator version
- Cryptogen命令
- cryptogen
- cryptogen help
- cryptogen generate
- cryptogen showtemplate
- FabricCA命令
- fabric-ca-client
- fabric-ca-server