Add an Organization to a Decentralized Fabric Network with No System Channel (Fabric v2.3)

Introduction

Overview

Demonstration

Step 1: Prepare crypto material for all the three organizations

cd super-network
./start_cryptomaterial

Step 2: Bring up a fabric network with both org1 and org2

docker-compose up -d orderer1-org1 peer1-org1 orderer1-org2 peer1-org2

Step 3: Create application channel mychannel and joins all components to mychannel

source term-org1
source term-org2
configtxgen -profile SampleAppChannelEtcdRaft -configPath ${PWD} -outputBlock mychannel.block -channelID mychannel
osnadmin channel join --channelID mychannel --config-block mychannel.block -o localhost:7080 --ca-file $ORDERER_CA --client-cert /tmp/hyperledger/org1/admin/tls-msp/signcerts/cert.pem --client-key /tmp/hyperledger/org1/admin/tls-msp/keystore/key.pem
osnadmin channel join --channelID mychannel --config-block mychannel.block -o localhost:8080 --ca-file $ORDERER_CA --client-cert /tmp/hyperledger/org2/admin/tls-msp/signcerts/cert.pem --client-key /tmp/hyperledger/org2/admin/tls-msp/keystore/key.pem
peer channel join -b mychannel.block
peer channel join -b mychannel.block
A decentralized fabric network with two orgs (org1 and org2)

Step 4: Test with sacc

Step 5: Fetch and inspect configuration block

peer channel fetch config -c mychannel
configtxlator proto_decode --input mychannel_config.block --type common.Block --output mychannel_config.jsonjq .data.data[0].payload.data.config mychannel_config.json > config.json

Step 6: Create MSP for org3

cd org3
configtxgen -configPath ${PWD} -printOrg org3MSP > ./org3.json
org3.json (generated with org3/configtx.yaml)

Step 7: Create configuration file to include org3 information

cp config.json modified_config.json
Insert org3MSP in Application
Insert org3MSP in Orderer
Insert orderer1-org3 in consenters
base64 /tmp/hyperledger/org3/orderer1/tls-msp/signcerts/cert.pem -w 0

Step 8: Create configuration update transaction with envelope

configtxlator proto_encode --input config.json --type common.Config --output config.pbconfigtxlator proto_encode --input modified_config.json --type common.Config --output modified_config.pbconfigtxlator compute_update --channel_id mychannel --original config.pb --updated modified_config.pb --output org3_update.pbconfigtxlator proto_decode --input org3_update.pb --type common.ConfigUpdate --output org3_update.jsonecho '{"payload":{"header":{"channel_header":{"channel_id":"mychannel", "type":2}},"data":{"config_update":'$(cat org3_update.json)'}}}' | jq . > org3_update_in_envelope.jsonconfigtxlator proto_encode --input org3_update_in_envelope.json --type common.Envelope --output org3_update_in_envelope.pb

Step 9: Sign and submit the update transaction by both org1 and org2

Now org1 signs the transaction (terminal for org1)
peer channel signconfigtx -f org3_update_in_envelope.pb
peer channel update -f org3_update_in_envelope.pb -c mychannel -o localhost:8050 --ordererTLSHostnameOverride orderer1-org2 --tls --cafile $ORDERER_CA

Step 10: Bring up orderer and peer for org3 and join mychannel

docker-compose up -d orderer1-org3 peer1-org3
source term-org3
osnadmin channel join --channelID mychannel --config-block mychannel.block -o localhost:9080 --ca-file $ORDERER_CA --client-cert /tmp/hyperledger/org3/admin/tls-msp/signcerts/cert.pem --client-key /tmp/hyperledger/org3/admin/tls-msp/keystore/key.pem
docker logs on orderer1-org3
peer channel join -b mychannel.block
docker logs on peer1-org3

Step 11: Install and approve chaincode sacc and make observation

query from peer1-org1
query from peer1-org2
query from peer1-org3

Summary

Visit http://www.ledgertech.biz/kcarticles.html for all my works. Reach me on https://www.linkedin.com/in/ktam1/ or follow me @kctheservant in Twitter.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store