Demonstration of No-System-Channel Setup in Hyperledger Fabric v2.3

Introduction

Overview

System channel related steps (yellow) are not needed any more.

Observation Test Network with System Channel

cd fabric-samples
cd test-network
./network.sh up
docker exec orderer.example.com ls /var/hyperledger/production/orderer/chains
./network.sh createChanneldocker exec orderer.example.com ls /var/hyperledger/production/orderer/chains
./network.sh down

Demonstration of No-System-Channel Setup

1. Duplicate the Test Network for the demonstration

cd fabric-samples
cp -r test-network demo-test-network
cd demo-test-network

2. Generate crypto material using cryptogen

// make sure fabric-samples/bin is included in PATH
export PATH=$PATH:${HOME}/fabric-samples/bin
cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --output="organizations"cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --output="organizations"cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --output="organizations"

3. Modify docker compose file

cd dockercp docker-compose-test-net.yaml docker-compose-no-system-channel.yaml

4. Bring up components

docker-compose -f docker/docker-compose-no-system-channel.yaml up -d
docker exec orderer.example.com ls /var/hyperledger/production/orderer/chains

5. Add a profile for no-system-channel setup in channel configuration

Profiles:    TwoOrgsOrdererGenesis:

TwoOrgsChannel:

SampleAppChannelEtcdRaft:
<<: *ChannelDefaults
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Capabilities:
<<: *OrdererCapabilities
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
Capabilities:
<<: *ApplicationCapabilities

6. Prepare genesis block for mychannel

export FABRIC_CFG_PATH=../configcd configtx/
configtxgen -profile SampleAppChannelEtcdRaft -outputBlock mychannel.block -channelID mychannel
cd ..

7. Join orderer to mychannel

osnadmin channel list -o localhost:7080 --ca-file ./organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt --client-cert ./organizations/ordererOrganizations/example.com/users/Admin\@example.com/tls/client.crt --client-key ./organizations/ordererOrganizations/example.com/users/Admin\@example.com/tls/client.key
No system channel and application channels defined yet in the orderer.
osnadmin channel join --channel-id mychannel --config-block configtx/mychannel.block -o localhost:7080 --ca-file ./organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt --client-cert ./organizations/ordererOrganizations/example.com/users/Admin\@example.com/tls/client.crt --client-key ./organizations/ordererOrganizations/example.com/users/Admin\@example.com/tls/client.key
The orderer joins mychannel.
docker exec orderer.example.com ls /var/hyperledger/production/orderer/chains

8. Join peers to mychannel

// for peer of org1
peer channel join -b configtx/mychannel.block
// for peer of org2
peer channel join -b configtx/mychannel.block
Join peer0.org1.example.com to mychannel
Join peer0.org2.example.com to mychannel

9. Test with SACC chaincode

./network.sh deployCC -ccn mycc -ccp ../chaincode/sacc -ccl go
Terminal for peer0.org1.example.com
Terminal for peer0.org2.example.com
docker-compose -f docker/docker-compose-no-system-channel.yaml down -v

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