This page contains example bash commands and scripts to generate the interoperability artefacts for joining and updating a channel.
Create common.ConfigGroup for Join Request
In this section the artefact for the join request will be created.
Locate your fabric peer organisation's cryptographic material.
The directory structure should look like this:crypto-config
- peerOrganizations
- example-org.com
- ca
- msp
- peers
- tlsca
- users
- example-org.com
- peerOrganizations
- configtx.yaml
Find or create a configtx.yaml file that contains at least the information about the organisation you want to join to the channel.
An example configuration file looks like this:configtx.yaml--- Organizations: - &Org1 Name: ExampleOrg ID: ExampleOrg MSPDir: crypto-config/peerOrganizations/example-org.com/msp Policies: &Org1Policies Readers: Type: Signature Rule: "OR('ExampleOrg.member')" Writers: Type: Signature Rule: "OR('ExampleOrg.member')" Admins: Type: Signature Rule: "OR('ExampleOrg.admin')" AnchorPeers: - Host: peer0.example-org.com Port: 7051
Create the ConfigGroup JSON using the configtxgen printOrg function.
Execute the following command in the directory of your configtx.yaml:configtxgen -printOrg ExampleOrg > configGroup.json
Send the configGroup.json to one of the channel members.
Create common.ConfigUpdate (channel update)
TODO: step-by-step guide
# Decode the block to JSON to be able to extract the config and update it later. configtxlator proto_decode --type common.Block --input channel_block.pb --output channel_block.json # Extract the channel config (assuming the CONFIG transaction is the first transaction). cat channel_block.json | jq '.data.data[0].payload.data.config' > channel_config.json MSPID=$(cat configGroup.json | jq -r '.values.MSP.value.config.name') CONFIG=$(cat configGroup.json) # Insert the new config of the organization into the channel config. cat channel_config.json | jq ".channel_group.groups.Application.groups.${MSPID} = ${CONFIG}" > updated_config.json # Encode the original and updated config block to proto to calculate the diff. configtxlator proto_encode --type common.Config --input channel_config.json --output channel_config.pb configtxlator proto_encode --type common.Config --input updated_config.json --output updated_config.pb # Calculate the channel update based on the created artifacts. configtxlator compute_update --original channel_config.pb --updated updated_config.pb --channel_id=my-channel --output channel_update.pb