# Network Configuration Tools - configtxlator & .jq ![](https://i.imgur.com/4vTvC7r.png) ![](https://i.imgur.com/BjZa5Ih.png) ## Network configuration workflow - Configuration Update workflow: ![](https://i.imgur.com/imAdWbU.png) - configuration updates are made by first fetching the current configuration & then edition it | Web Apps | Fabric | | ------------------------------------------------------------ | ------------------------------------------------- | | configuration files in Source code repositories e.g., GitHub | configuration stored as transaction in the Ledger | - ALWAYS fetch the latest config from Ledger - Update the fetched config and send as Transaction - Update step 1. Fetch the Latest configuration & update it ![](https://i.imgur.com/vDF7xdy.png) 3. Submit the update transaction to Orderer ![](https://i.imgur.com/Cf41f0S.png) ## Network configxlator tool - configxlator = Configuration + Translator used by the administrators for managing the configuration updates for Fabric ![](https://i.imgur.com/ntOFXlH.png) - configxlator modes same binary used to luanching CLI & REST Server - Command Line Interface `configtxlator command --flags` command: - `proto_decode` Protocol Buffers --> JSON - `proto_encode` JSON --> Protocol Buffers - `--type`: type of proto buffer structure to endcode/decode - `common.Block` Block format - `common.Config` Configuraiton transaction - `Envelope` Transaction enclosed in message envelope - `ConfigUpdate` Update config transaction message format - `Policy` Policy message format - `--input` Protocol Buffer file or JSON file - `--output` JSON file or Protocol Buffer file - `compute_update` Compute DELTA between two Protocol Buffers - `--original` original config ProtoBuf fetched from network - `--updated` updated config ProtoBuf - `--channel_id` Channel ID - [REST Server](https://zh.wikipedia.org/wiki/%E8%A1%A8%E7%8E%B0%E5%B1%82%E7%8A%B6%E6%80%81%E8%BD%AC%E6%8D%A2) `configtxlator start --hostname localhost --port 7059` - config translator is launched as a REST server - command are excuted by using the CURL utility :::warning Unlike the other bibaries for Fabric, there is no **configuration file** for config translator ::: ## ./jq Utility ![](https://i.imgur.com/GIX3YYO.png) - Command Line Processor for JSON data - Slice & filter data - Transform the data - Install `sudo apt-get install jq` - Available online for learning | trying https://jqplay.org/ ![](https://i.imgur.com/RMIDlDx.png) - Using the CLI `cat file.json | jq expression` e.g. `cat test.json | jq .data.data[0].playload.header.channel_header` ![](https://i.imgur.com/ELTDLdC.png) `cat test.json | jq .data.data[0].playload.header.channel_header > test1.json` ![](https://i.imgur.com/iMVFpma.png)