HomeBlockchainBlockchain DIYAdding an Organization to a Decentralized Fabric Network

Adding an Organization to a Decentralized Fabric Network

Audio version of the article

Introduction

Overview

Demonstration

Step 1: Prepare crypto material for all the three organizations

cd super-network
./start_cryptomaterial
Adding an Organization to a Decentralized Fabric Network 27

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

Adding an Organization to a Decentralized Fabric Network 28
A decentralized fabric network with two orgs (org1 and org2)

Step 4: Test with sacc

Adding an Organization to a Decentralized Fabric Network 29

Adding an Organization to a Decentralized Fabric Network 30

 

 

 

 

 

Adding an Organization to a Decentralized Fabric Network 31

Adding an Organization to a Decentralized Fabric Network 32

Step 5: Fetch and inspect configuration block

peer channel fetch config -c mychannel
Adding an Organization to a Decentralized Fabric Network 33

Adding an Organization to a Decentralized Fabric Network 34

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
Adding an Organization to a Decentralized Fabric Network 35

Adding an Organization to a Decentralized Fabric Network 36

Adding an Organization to a Decentralized Fabric Network 37

Adding an Organization to a Decentralized Fabric Network 38

Step 6: Create MSP for org3

cd org3
configtxgen -configPath ${PWD} -printOrg org3MSP > ./org3.json

Adding an Organization to a Decentralized Fabric Network 39
org3.json (generated with org3/configtx.yaml)

Step 7: Create configuration file to include org3 information

cp config.json modified_config.json

Adding an Organization to a Decentralized Fabric Network 40
Insert org3MSP in Application

Adding an Organization to a Decentralized Fabric Network 41
Insert org3MSP in Orderer

Adding an Organization to a Decentralized Fabric Network 42
base64 /tmp/hyperledger/org3/orderer1/tls-msp/signcerts/cert.pem -w 0
Adding an Organization to a Decentralized Fabric Network 43

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
Adding an Organization to a Decentralized Fabric Network 44

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

Adding an Organization to a Decentralized Fabric Network 45
Now org1 signs the transaction (terminal for org1)

peer channel signconfigtx -f org3_update_in_envelope.pb
Adding an Organization to a Decentralized Fabric Network 46
peer channel update -f org3_update_in_envelope.pb -c mychannel -o localhost:8050 --ordererTLSHostnameOverride orderer1-org2 --tls --cafile $ORDERER_CA
Adding an Organization to a Decentralized Fabric Network 47
Adding an Organization to a Decentralized Fabric Network 48
Adding an Organization to a Decentralized Fabric Network 49

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

docker-compose up -d orderer1-org3 peer1-org3
Adding an Organization to a Decentralized Fabric Network 50
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
Adding an Organization to a Decentralized Fabric Network 51

Adding an Organization to a Decentralized Fabric Network 52
docker logs on orderer1-org3

peer channel join -b mychannel.block

Adding an Organization to a Decentralized Fabric Network 53
docker logs on peer1-org3

Adding an Organization to a Decentralized Fabric Network 54
Adding an Organization to a Decentralized Fabric Network 55

Step 11: Install and approve chaincode sacc and make observation

Adding an Organization to a Decentralized Fabric Network 56
Adding an Organization to a Decentralized Fabric Network 57
Now check all the three peers, and the ledger is updated.

Adding an Organization to a Decentralized Fabric Network 58
query from peer1-org1

Adding an Organization to a Decentralized Fabric Network 59
query from peer1-org2

Adding an Organization to a Decentralized Fabric Network 60
query from peer1-org3

Summary

This article has been published from the source link without modifications to the text. Only the headline has been changed.

- Advertisment -Adding an Organization to a Decentralized Fabric Network 62Adding an Organization to a Decentralized Fabric Network 63

Most Popular

- Advertisment -Adding an Organization to a Decentralized Fabric Network 64Adding an Organization to a Decentralized Fabric Network 65