github.com/defanghe/fabric@v2.1.1+incompatible/docs/wrappers/configtxlator_postscript.md (about) 1 ## Examples 2 3 ### Decoding 4 5 Decode a block named `fabric_block.pb` to JSON and print to stdout. 6 7 ``` 8 configtxlator proto_decode --input fabric_block.pb --type common.Block 9 ``` 10 11 Alternatively, after starting the REST server, the following curl command 12 performs the same operation through the REST API. 13 14 ``` 15 curl -X POST --data-binary @fabric_block.pb "${CONFIGTXLATOR_URL}/protolator/decode/common.Block" 16 ``` 17 18 ### Encoding 19 20 Convert a JSON document for a policy from stdin to a file named `policy.pb`. 21 22 ``` 23 configtxlator proto_encode --type common.Policy --output policy.pb 24 ``` 25 26 Alternatively, after starting the REST server, the following curl command 27 performs the same operation through the REST API. 28 29 ``` 30 curl -X POST --data-binary /dev/stdin "${CONFIGTXLATOR_URL}/protolator/encode/common.Policy" > policy.pb 31 ``` 32 33 ### Pipelines 34 35 Compute a config update from `original_config.pb` and `modified_config.pb` and decode it to JSON to stdout. 36 37 ``` 38 configtxlator compute_update --channel_id testchan --original original_config.pb --updated modified_config.pb | configtxlator proto_decode --type common.ConfigUpdate 39 ``` 40 41 Alternatively, after starting the REST server, the following curl commands 42 perform the same operations through the REST API. 43 44 ``` 45 curl -X POST -F channel=testchan -F "original=@original_config.pb" -F "updated=@modified_config.pb" "${CONFIGTXLATOR_URL}/configtxlator/compute/update-from-configs" | curl -X POST --data-binary /dev/stdin "${CONFIGTXLATOR_URL}/protolator/encode/common.ConfigUpdate" 46 ``` 47 48 ## Additional Notes 49 50 The tool name is a portmanteau of *configtx* and *translator* and is intended to 51 convey that the tool simply converts between different equivalent data 52 representations. It does not generate configuration. It does not submit or 53 retrieve configuration. It does not modify configuration itself, it simply 54 provides some bijective operations between different views of the configtx 55 format. 56 57 There is no configuration file `configtxlator` nor any authentication or 58 authorization facilities included for the REST server. Because `configtxlator` 59 does not have any access to data, key material, or other information which 60 might be considered sensitive, there is no risk to the owner of the server in 61 exposing it to other clients. However, because the data sent by a user to 62 the REST server might be confidential, the user should either trust the 63 administrator of the server, run a local instance, or operate via the CLI. 64 65 <a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.