test network nano bash updated with smartbft consensus

Signed-off-by: Parameswaran Selvam <parselva@in.ibm.com>
This commit is contained in:
Parameswaran Selvam 2023-01-31 11:16:48 -08:00
parent c986c8d227
commit d340f62b03
7 changed files with 166 additions and 55 deletions

View file

@ -215,52 +215,6 @@ Application: &ApplicationDefaults
################################################################################ ################################################################################
Orderer: &OrdererDefaults Orderer: &OrdererDefaults
# Orderer Type: The orderer implementation to start
OrdererType: etcdraft
EtcdRaft:
Consenters:
- Host: 127.0.0.1
Port: 6050
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
- Host: 127.0.0.1
Port: 6051
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
- Host: 127.0.0.1
Port: 6052
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
# Options to be specified for all the etcd/raft nodes. The values here
# are the defaults for all new channels and can be modified on a
# per-channel basis via configuration updates.
Options:
# TickInterval is the time interval between two Node.Tick invocations.
#TickInterval: 500ms default
TickInterval: 2500ms
# ElectionTick is the number of Node.Tick invocations that must pass
# between elections. That is, if a follower does not receive any
# message from the leader of current term before ElectionTick has
# elapsed, it will become candidate and start an election.
# ElectionTick must be greater than HeartbeatTick.
# ElectionTick: 10 default
ElectionTick: 5
# HeartbeatTick is the number of Node.Tick invocations that must
# pass between heartbeats. That is, a leader sends heartbeat
# messages to maintain its leadership every HeartbeatTick ticks.
HeartbeatTick: 1
# MaxInflightBlocks limits the max number of in-flight append messages
# during optimistic replication phase.
MaxInflightBlocks: 5
# SnapshotIntervalSize defines number of bytes per which a snapshot is taken
SnapshotIntervalSize: 16 MB
# Batch Timeout: The amount of time to wait before creating a batch # Batch Timeout: The amount of time to wait before creating a batch
BatchTimeout: 2s BatchTimeout: 2s
@ -352,6 +306,27 @@ Profiles:
- *OrdererOrg - *OrdererOrg
Capabilities: Capabilities:
<<: *OrdererCapabilities <<: *OrdererCapabilities
OrdererType: etcdraft
EtcdRaft:
Consenters:
- Host: 127.0.0.1
Port: 6050
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
- Host: 127.0.0.1
Port: 6051
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
- Host: 127.0.0.1
Port: 6052
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
Options:
TickInterval: 2500ms
ElectionTick: 5
HeartbeatTick: 1
MaxInflightBlocks: 5
SnapshotIntervalSize: 16 MB
Consortiums: Consortiums:
SampleConsortium: SampleConsortium:
Organizations: Organizations:
@ -385,3 +360,65 @@ Profiles:
- *Org2 - *Org2
Capabilities: Capabilities:
<<: *ApplicationCapabilities <<: *ApplicationCapabilities
BFTTwoOrgsApplicationGenesis:
<<: *ChannelDefaults
Orderer:
<<: *OrdererDefaults
Addresses:
- 127.0.0.1:6050
- 127.0.0.1:6051
- 127.0.0.1:6052
- 127.0.0.1:6053
Organizations:
- *OrdererOrg
Capabilities: *OrdererCapabilities
OrdererType: BFT
SmartBFT:
RequestBatchMaxCount: 100
RequestBatchMaxInterval: 50ms
RequestForwardTimeout: 2s
RequestComplainTimeout: 20s
RequestAutoRemoveTimeout: 3m0s
ViewChangeResendInterval: 5s
ViewChangeTimeout: 20s
LeaderHeartbeatTimeout: 1m0s
CollectTimeout: 1s
RequestBatchMaxBytes: 10485760
IncomingMessageBufferSize: 200
RequestPoolSize: 400
LeaderHeartbeatCount: 10
ConsenterMapping:
- ID: 1
Host: 127.0.0.1
Port: 6050
MSPID: OrdererMSP
Identity: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/signcerts/orderer.example.com-cert.pem
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
- ID: 2
Host: 127.0.0.1
Port: 6051
MSPID: OrdererMSP
Identity: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/msp/signcerts/orderer2.example.com-cert.pem
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
- ID: 3
Host: 127.0.0.1
Port: 6052
MSPID: OrdererMSP
Identity: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/msp/signcerts/orderer3.example.com-cert.pem
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
- ID: 4
Host: 127.0.0.1
Port: 6053
MSPID: OrdererMSP
Identity: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/msp/signcerts/orderer4.example.com-cert.pem
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
Capabilities: *ApplicationCapabilities

View file

@ -29,3 +29,6 @@ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate channel-artifacts/O
echo "Generating anchor peer update transaction for Org2" echo "Generating anchor peer update transaction for Org2"
configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP 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

View file

@ -65,13 +65,25 @@ networkStart() {
mkdir -p "${PWD}"/logs mkdir -p "${PWD}"/logs
echo "Starting orderers..." echo "Starting orderers..."
./orderer1.sh > ./logs/orderer1.log 2>&1 & ./orderer1.sh ${ORDERER_TYPE} > ./logs/orderer1.log 2>&1 &
./orderer2.sh > ./logs/orderer2.log 2>&1 & ./orderer2.sh ${ORDERER_TYPE} > ./logs/orderer2.log 2>&1 &
./orderer3.sh > ./logs/orderer3.log 2>&1 & ./orderer3.sh ${ORDERER_TYPE} > ./logs/orderer3.log 2>&1 &
if [ "$ORDERER_TYPE" = "smartbft" ]; then
./orderer4.sh ${ORDERER_TYPE} > ./logs/orderer4.log 2>&1 &
fi
echo "Waiting ${CLI_DELAY}s..." echo "Waiting ${CLI_DELAY}s..."
sleep ${CLI_DELAY} sleep ${CLI_DELAY}
if [ "$ORDERER_TYPE" = "smartbft" ]; then
../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
../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9446
echo "smartbft orderers cluster should be up now..."
wait
fi
echo "Starting peers..." echo "Starting peers..."
./peer1.sh > ./logs/peer1.log 2>&1 & ./peer1.sh > ./logs/peer1.log 2>&1 &
./peer2.sh > ./logs/peer2.log 2>&1 & ./peer2.sh > ./logs/peer2.log 2>&1 &
@ -119,6 +131,8 @@ else
shift shift
fi fi
ORDERER_TYPE="etcdraft"
# parse flags # parse flags
while [ $# -ge 1 ] ; do while [ $# -ge 1 ] ; do
key="$1" key="$1"
@ -127,6 +141,10 @@ while [ $# -ge 1 ] ; do
CLI_DELAY="$2" CLI_DELAY="$2"
shift shift
;; ;;
-c )
ORDERER_TYPE="$2"
shift
;;
-h ) -h )
printHelp "$MODE" printHelp "$MODE"
exit 0 exit 0

View file

@ -17,8 +17,14 @@ 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 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 # 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 export ORDERER_GENERAL_TLS_ROOTCAS="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt
export ORDERER_GENERAL_BOOTSTRAPMETHOD=file if [ $# -gt 0 ] && [ "$1" = "smartbft" ]
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block 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
fi
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer/etcdraft/wal export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer/etcdraft/wal
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer/etcdraft/wal export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer/etcdraft/wal

View file

@ -17,8 +17,14 @@ 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 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 # 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 export ORDERER_GENERAL_TLS_ROOTCAS="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/ca.crt
export ORDERER_GENERAL_BOOTSTRAPMETHOD=file if [ $# -gt 0 ] && [ "$1" = "smartbft" ]
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block 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
fi
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer2 export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer2
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer2/etcdraft/wal export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer2/etcdraft/wal
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer2/etcdraft/wal export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer2/etcdraft/wal

View file

@ -17,8 +17,14 @@ 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 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 # 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 export ORDERER_GENERAL_TLS_ROOTCAS="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/ca.crt
export ORDERER_GENERAL_BOOTSTRAPMETHOD=file if [ $# -gt 0 ] && [ "$1" = "smartbft" ]
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block 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
fi
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer3 export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer3
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer3/etcdraft/wal export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer3/etcdraft/wal
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer3/etcdraft/wal export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer3/etcdraft/wal

View file

@ -0,0 +1,35 @@
#!/usr/bin/env sh
#
# SPDX-License-Identifier: Apache-2.0
#
set -eu
# look for binaries in local dev environment /build/bin directory and then in local samples /bin directory
export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH"
export FABRIC_CFG_PATH="${PWD}"/../config
export FABRIC_LOGGING_SPEC=debug:cauthdsl,policies,msp,common.configtx,common.channelconfig=info
export ORDERER_GENERAL_LISTENPORT=6053
export ORDERER_GENERAL_LOCALMSPID=OrdererMSP
export ORDERER_GENERAL_LOCALMSPDIR="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/msp
export ORDERER_GENERAL_TLS_ENABLED=true
export ORDERER_GENERAL_TLS_PRIVATEKEY="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.key
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" ]
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
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_OPERATIONS_LISTENADDRESS=127.0.0.1:8446
export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9446
# start orderer
orderer