I am trying to make two channels with hyper ledger fabric. In one channel there will be two organizations and in another channel, there will be another two organizations. In every organization, there will be two peers. So total 8 peers in 4 organizations with two channels. Until now I have done these:
crypto-config.yaml
file I have declared one orderer and four organizations. In every organization, I have declared template count: 2 and users count: 1 (can anyone please explain the meaning of template count? Is it a total number of peers?)cryptogen generate --config=./crypto-config.yaml
command to generate keys and certificates.configtx.yaml
file, I have declared two channels with their organization's name:Profiles:
FourOrgsOrdererGenesis:
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Consortiums:
SampleConsortium:
Organizations:
- *Org1
- *Org2
- *Org3
- *Org4
TwoOrgsChannel1:
Consortium: SampleConsortium
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
TwoOrgsChannel2:
Consortium: SampleConsortium
Application:
<<: *ApplicationDefaults
Organizations:
- *Org3
- *Org4
Organizations:
- &OrdererOrg
Name: OrdererOrg
ID: OrdererMSP
MSPDir: crypto-config/ordererOrganizations/acme.com/msp
- &Org1
Name: Org1MSP
ID: Org1MSP
MSPDir: crypto-config/peerOrganizations/org1.acme.com/msp
AnchorPeers:
- Host: peer0.org1.acme.com
Port: 7051
- &Org2
Name: Org2MSP
ID: Org2MSP
MSPDir: crypto-config/peerOrganizations/org2.acme.com/msp
AnchorPeers:
- Host: peer0.org2.acme.com
Port: 7051
- &Org3
Name: Org3MSP
ID: Org3MSP
MSPDir: crypto-config/peerOrganizations/org3.acme.com/msp
AnchorPeers:
- Host: peer0.org3.acme.com
Port: 7051
- &Org4
Name: Org4MSP
ID: Org4MSP
MSPDir: crypto-config/peerOrganizations/org4.acme.com/msp
AnchorPeers:
- Host: peer0.org4.acme.com
Port: 7051
Orderer: &OrdererDefaults
OrdererType: solo
Addresses:
- orderer.acme.com:7050
BatchTimeout: 2s
BatchSize:
MaxMessageCount: 10
AbsoluteMaxBytes: 99 MB
PreferredMaxBytes: 512 KB
Kafka:
Brokers:
- 127.0.0.1:9092
Organizations:
Application: &ApplicationDefaults
Organizations:
Then I have created genesis block using this command
configtxgen -profile FourOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
Probably, I need to make two genesis block as there are two channels. In that case, what will be the command instead of above one?
I have used following commands to make channel transaction and anchor peer transaction.
configtxgen -profile TwoOrgsChannel1 -outputCreateChannelTx ./channel-artifacts/channel1.tx -channelID mychannel1
configtxgen -profile TwoOrgsChannel2 -outputCreateChannelTx ./channel-artifacts/channel2.tx -channelID mychannel2
configtxgen -profile TwoOrgsChannel1-outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel1 -asOrg Org1MSP
configtxgen -profile TwoOrgsChannel1 -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel1 -asOrg Org2MSP
configtxgen -profile TwoOrgsChannel2-outputAnchorPeersUpdate ./channel-artifacts/Org3MSPanchors.tx -channelID mychannel2 -asOrg Org3MSP
configtxgen -profile TwoOrgsChannel2-outputAnchorPeersUpdate ./channel-artifacts/Org4MSPanchors.tx -channelID mychannel2 -asOrg Org4MSP
Finally used this command to make up:
CHANNEL_NAME=mychannel1 docker-compose -f docker-compose-cli.yaml up –d
Whenever I am trying to run:
CHANNEL_NAME=mychannel2 docker-compose -f docker-compose-cli.yaml up –d
It is saying already peers are running.
So my questions are:
After some trial and error, I have found the problem. Actually, I thought, if I want to make multiple channels then I have to use docker-compose command multiple times, which is not correct. The correct syntax for creating multiple channels are:
cryptogen generate --config=./crypto-config.yaml
export FABRIC_CFG_PATH=$PWD
configtxgen -profile FourOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
configtxgen -profile TwoOrgsChannel1 -outputCreateChannelTx ./channel-artifacts/channel1.tx -channelID mychannel1
configtxgen -profile TwoOrgsChannel2 -outputCreateChannelTx ./channel-artifacts/channel2.tx -channelID mychannel2
configtxgen -profile TwoOrgsChannel1 -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel1 -asOrg Org1MSP
configtxgen -profile TwoOrgsChannel1 -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel1 -asOrg Org2MSP
configtxgen -profile TwoOrgsChannel2 -outputAnchorPeersUpdate ./channel-artifacts/Org3MSPanchors.tx -channelID mychannel2 -asOrg Org3MSP
configtxgen -profile TwoOrgsChannel2 -outputAnchorPeersUpdate ./channel-artifacts/Org4MSPanchors.tx -channelID mychannel2 -asOrg Org4MSP
docker-compose -f docker-compose-cli.yaml up -d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With