Skip to content

Commit

Permalink
Update to use channel participation api
Browse files Browse the repository at this point in the history
Signed-off-by: Parameswaran Selvam <parselva@in.ibm.com>
  • Loading branch information
Param-S committed Feb 23, 2023
1 parent fd3cf67 commit 39e712a
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 94 deletions.
31 changes: 2 additions & 29 deletions test-network-nano-bash/configtx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ Channel: &ChannelDefaults
#
################################################################################
Profiles:

TwoOrgsOrdererGenesis:
TwoOrgsChannel:
<<: *ChannelDefaults
Orderer:
<<: *OrdererDefaults
Expand Down Expand Up @@ -327,36 +326,10 @@ Profiles:
HeartbeatTick: 1
MaxInflightBlocks: 5
SnapshotIntervalSize: 16 MB
Consortiums:
SampleConsortium:
Organizations:
- *Org1
- *Org2
TwoOrgsChannel:
Consortium: SampleConsortium
<<: *ChannelDefaults
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
Capabilities:
<<: *ApplicationCapabilities
Org1Channel:
Consortium: SampleConsortium
<<: *ChannelDefaults
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
Capabilities:
<<: *ApplicationCapabilities
Org2Channel:
Consortium: SampleConsortium
<<: *ChannelDefaults
Application:
<<: *ApplicationDefaults
Organizations:
- *Org2
Capabilities:
<<: *ApplicationCapabilities
Expand Down Expand Up @@ -385,7 +358,7 @@ Profiles:
CollectTimeout: 1s
RequestBatchMaxBytes: 10485760
IncomingMessageBufferSize: 200
RequestPoolSize: 400
RequestPoolSize: 100000
LeaderHeartbeatCount: 10
ConsenterMapping:
- ID: 1
Expand Down
21 changes: 10 additions & 11 deletions test-network-nano-bash/generate_artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ cryptogen generate --config="${PWD}"/crypto-config.yaml
# set FABRIC_CFG_PATH to configtx.yaml directory that contains the profiles
export FABRIC_CFG_PATH="${PWD}"

echo "Generating orderer genesis block"
configtxgen -profile TwoOrgsOrdererGenesis -channelID test-system-channel-name -outputBlock channel-artifacts/genesis.block
ordererType="etcdraft"
if [ $# -gt 0 ] && [ "$1" = "BFT" ]
then
profile="BFTTwoOrgsApplicationGenesis"
ordererType="BFT"
else
profile="TwoOrgsChannel"
fi

echo "Generating channel create config transaction"
configtxgen -channelID mychannel -outputCreateChannelTx channel-artifacts/mychannel.tx -profile TwoOrgsChannel
echo "Generating application channel genesis block with ${ordererType} consensus"
configtxgen -profile ${profile} -outputBlock ./channel-artifacts/mychannel.block -channelID mychannel

echo "Generating anchor peer update transaction for Org1"
configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP

echo "Generating anchor peer update transaction for Org2"
configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP

echo "Generating application channel genesis block with BFT consensus"
configtxgen -profile BFTTwoOrgsApplicationGenesis -outputBlock ./channel-artifacts/mychannel.block -channelID mychannel
36 changes: 18 additions & 18 deletions test-network-nano-bash/network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ networkStart() {
CREATE_CHANNEL=false
else
echo "Generating artifacts..."
./generate_artifacts.sh
./generate_artifacts.sh ${ORDERER_TYPE}
CREATE_CHANNEL=true
fi

Expand All @@ -69,8 +69,8 @@ networkStart() {
./orderer2.sh ${ORDERER_TYPE} > ./logs/orderer2.log 2>&1 &
./orderer3.sh ${ORDERER_TYPE} > ./logs/orderer3.log 2>&1 &

# start one additional orderer for smartbft consensus
if [ "$ORDERER_TYPE" = "smartbft" ]; then
# start one additional orderer for BFT consensus
if [ "$ORDERER_TYPE" = "BFT" ]; then
./orderer4.sh ${ORDERER_TYPE} > ./logs/orderer4.log 2>&1 &
fi

Expand All @@ -87,25 +87,25 @@ networkStart() {
sleep ${CLI_DELAY}

if [ "${CREATE_CHANNEL}" = "true" ]; then
if [ "$ORDERER_TYPE" = "smartbft" ]; then
echo "Joining orderers to channel..."
../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9443
../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9444
../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9445
echo "Joining orderers to channel..."
../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9443
../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9444
../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9445
if [ "$ORDERER_TYPE" = "BFT" ]; then
../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9446
else
echo "Creating channel (peer1)..."
. ./peer1admin.sh && ./create_channel.sh
fi

echo "Joining channel (peer2)..."
. ./peer2admin.sh && ./join_channel.sh
echo "Creating channel (peer1)..."
. ./peer1admin.sh && ./join_channel.sh

echo "Joining channel (peer3)..."
. ./peer3admin.sh && ./join_channel.sh
echo "Joining channel (peer2)..."
. ./peer2admin.sh && ./join_channel.sh

echo "Joining channel (peer4)..."
. ./peer4admin.sh && ./join_channel.sh
fi
echo "Joining channel (peer3)..."
. ./peer3admin.sh && ./join_channel.sh

echo "Joining channel (peer4)..."
. ./peer4admin.sh && ./join_channel.sh
fi
echo "Fabric network running. Use Ctrl-C to stop."

Expand Down
21 changes: 12 additions & 9 deletions test-network-nano-bash/orderer1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ export ORDERER_GENERAL_TLS_PRIVATEKEY="${PWD}"/crypto-config/ordererOrganization
export ORDERER_GENERAL_TLS_CERTIFICATE="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
# following setting is not really needed at runtime since channel config has ca root certs, but we need to override the default in orderer.yaml
export ORDERER_GENERAL_TLS_ROOTCAS="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt
if [ $# -gt 0 ] && [ "$1" = "smartbft" ]
export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_CHANNELPARTICIPATION_ENABLED=true
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer
if [ $# -gt 0 ]
then
export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_CHANNELPARTICIPATION_ENABLED=true
else
export ORDERER_GENERAL_BOOTSTRAPMETHOD=file
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block
if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ]
then
echo "Unsupported input consensus type ${1}"
exit 1
fi
export ORDERER_CONSENSUS_TYPE=${1}
fi
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer/etcdraft/wal
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer/etcdraft/wal
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer/consensus/wal
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer/consensus/snap
export ORDERER_OPERATIONS_LISTENADDRESS=127.0.0.1:8443
export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9443

Expand Down
21 changes: 12 additions & 9 deletions test-network-nano-bash/orderer2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ export ORDERER_GENERAL_TLS_PRIVATEKEY="${PWD}"/crypto-config/ordererOrganization
export ORDERER_GENERAL_TLS_CERTIFICATE="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
# following setting is not really needed at runtime since channel config has ca root certs, but we need to override the default in orderer.yaml
export ORDERER_GENERAL_TLS_ROOTCAS="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/ca.crt
if [ $# -gt 0 ] && [ "$1" = "smartbft" ]
export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_CHANNELPARTICIPATION_ENABLED=true
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer2
if [ $# -gt 0 ]
then
export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_CHANNELPARTICIPATION_ENABLED=true
else
export ORDERER_GENERAL_BOOTSTRAPMETHOD=file
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block
if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ]
then
echo "Unsupported input consensus type ${1}"
exit 1
fi
export ORDERER_CONSENSUS_TYPE=${1}
fi
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer2
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer2/etcdraft/wal
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer2/etcdraft/wal
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer2/consensus/wal
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer2/consensus/snap
export ORDERER_OPERATIONS_LISTENADDRESS=127.0.0.1:8444
export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9444

Expand Down
21 changes: 12 additions & 9 deletions test-network-nano-bash/orderer3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ export ORDERER_GENERAL_TLS_PRIVATEKEY="${PWD}"/crypto-config/ordererOrganization
export ORDERER_GENERAL_TLS_CERTIFICATE="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
# following setting is not really needed at runtime since channel config has ca root certs, but we need to override the default in orderer.yaml
export ORDERER_GENERAL_TLS_ROOTCAS="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/ca.crt
if [ $# -gt 0 ] && [ "$1" = "smartbft" ]
export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_CHANNELPARTICIPATION_ENABLED=true
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer3
if [ $# -gt 0 ]
then
export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_CHANNELPARTICIPATION_ENABLED=true
else
export ORDERER_GENERAL_BOOTSTRAPMETHOD=file
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block
if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ]
then
echo "Unsupported input consensus type ${1}"
exit 1
fi
export ORDERER_CONSENSUS_TYPE=${1}
fi
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer3
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer3/etcdraft/wal
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer3/etcdraft/wal
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer3/consensus/wal
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer3/consensus/snap
export ORDERER_OPERATIONS_LISTENADDRESS=127.0.0.1:8445
export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9445

Expand Down
21 changes: 12 additions & 9 deletions test-network-nano-bash/orderer4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ export ORDERER_GENERAL_TLS_PRIVATEKEY="${PWD}"/crypto-config/ordererOrganization
export ORDERER_GENERAL_TLS_CERTIFICATE="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
# following setting is not really needed at runtime since channel config has ca root certs, but we need to override the default in orderer.yaml
export ORDERER_GENERAL_TLS_ROOTCAS="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/ca.crt
if [ $# -gt 0 ] && [ "$1" = "smartbft" ]
export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_CHANNELPARTICIPATION_ENABLED=true
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer4
if [ $# -gt 0 ]
then
export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_CHANNELPARTICIPATION_ENABLED=true
else
export ORDERER_GENERAL_BOOTSTRAPMETHOD=file
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block
if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ]
then
echo "Unsupported input consensus type ${1}"
exit 1
fi
export ORDERER_CONSENSUS_TYPE=${1}
fi
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer4
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer4/etcdraft/wal
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer4/etcdraft/wal
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer4/consensus/wal
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer4/consensus/snap
export ORDERER_OPERATIONS_LISTENADDRESS=127.0.0.1:8450
export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9446

Expand Down

0 comments on commit 39e712a

Please sign in to comment.