Fix nano-bash-bft sample to work with channel-participation.

remove dependency on deprecated system-channel.

Signed-off-by: Arkadi Piven <arkadi.piven@ibm.com>
Signed-off-by: arkadipiven <arkadi7770@gmail.com>
This commit is contained in:
Arkadi Piven 2023-05-09 17:06:29 +03:00 committed by Dave Enyeart
parent 20009ecd02
commit 81390fbbbf
13 changed files with 742 additions and 367 deletions

View file

@ -39,11 +39,10 @@ yq -i 'del(.chaincode.externalBuilders) | .chaincode.externalBuilders[0].name =
``` ```
# Instructions for starting network # Instructions for starting network
## Running each component separately ## Running each component separately
Open terminal windows for 3 ordering nodes, 4 peer nodes, and 4 peer admins as seen in the following terminal setup. The first two peers and peer admins belong to Org1, the latter two peer and peer admins belong to Org2. Open terminal windows for 3 ordering nodes or 4 if running BFT Consensus, 4 peer nodes, and 4 peer admins as seen in the following terminal setup. The first two peers and peer admins belong to Org1, the latter two peer and peer admins belong to Org2.
Note, you can start with two ordering nodes and a single Org1 peer node and single Org1 peer admin terminal if you would like to keep things even more minimal (two ordering nodes are required to achieve consensus (2 of 3), while a single peer from Org1 can be utilized since the endorsement policy is set as any single organization). Note, you can start with two ordering nodes and a single Org1 peer node and single Org1 peer admin terminal if you would like to keep things even more minimal (two ordering nodes are required to achieve Raft consensus (2 of 3), while a single peer from Org1 can be utilized since the endorsement policy is set as any single organization).
![Terminal setup](terminal_setup.png) ![Terminal setup](terminal_setup.png)
The following instructions will have you run simple bash scripts that set environment variable overrides for a component and then runs the component. The following instructions will have you run simple bash scripts that set environment variable overrides for a component and then runs the component.
@ -51,25 +50,29 @@ The scripts contain only simple single-line commands so that they are easy to re
If you have trouble running bash scripts in your environment, you can just as easily copy and paste the individual commands from the script files instead of running the script files. If you have trouble running bash scripts in your environment, you can just as easily copy and paste the individual commands from the script files instead of running the script files.
- cd to the `test-network-nano-bash` directory in each terminal window - cd to the `test-network-nano-bash` directory in each terminal window
- In the first orderer terminal, run `./generate_artifacts.sh` to generate crypto material (calls cryptogen) and system and application channel genesis block and configuration transactions (calls configtxgen). The artifacts will be created in the `crypto-config` and `channel-artifacts` directories. - In the first orderer terminal, run `./generate_artifacts.sh` to generate crypto material (calls cryptogen) and application channel genesis block and configuration transactions (calls configtxgen). The artifacts will be created in the `crypto-config` and `channel-artifacts` directories. If you are running BFT consensus then run `./generate_artifacts.sh BFT`.
- In the three orderer terminals, run `./orderer1.sh`, `./orderer2.sh`, `./orderer3.sh` respectively - In the three orderer terminals, run `./orderer1.sh`, `./orderer2.sh`, `./orderer3.sh` respectively. If you are running BFT consensus then run `./orderer4.sh` in the fourth orderer terminal also.
- In the four peer terminals, run `./peer1.sh`, `./peer2.sh`, `./peer3.sh`, `./peer4.sh` respectively - In the four peer terminals, run `./peer1.sh`, `./peer2.sh`, `./peer3.sh`, `./peer4.sh` respectively.
- Note that each orderer and peer write their data (including their ledgers) to their own subdirectory under the `data` directory - Note that each orderer and peer write their data (including their ledgers) to their own subdirectory under the `data` directory
- In the four peer admin terminals, run `source peer1admin.sh && ./create_channel.sh`, `source peer2admin.sh && ./join_channel.sh`, `source peer3admin.sh && ./join_channel.sh`, `source peer4admin.sh && ./join_channel.sh` respectively - Open a different terminal and run `./join_orderers.sh`. If you are running BFT Consensus then run `./join_orderers.sh BFT` instead.
- In the four peer admin terminals, run `source peer1admin.sh && ./join_channel.sh`, `source peer2admin.sh && ./join_channel.sh`, `source peer3admin.sh && ./join_channel.sh`, `source peer4admin.sh && ./join_channel.sh` respectively.
Note the syntax of running the scripts. The peer admin scripts set the admin environment variables and must be run with the `source` command in order that the exported environment variables can be utilized by any subsequent user commands. Note the syntax of running the scripts. The peer admin scripts set the admin environment variables and must be run with the `source` command in order that the exported environment variables can be utilized by any subsequent user commands.
The `create_channel.sh` script creates the application channel `mychannel`, updates the channel configuration for the gossip anchor peer, and joins the peer to `mychannel`.
The `join_channel.sh` script joins a peer to `mychannel`.
## Starting the network with one command ## Starting the network with one command
Using the individual scripts above gives you more control of the process of starting a Fabric network and demonstrates how all the required components fit together, however the same network can also be started using a single script for convenience. Using the individual scripts above gives you more control of the process of starting a Fabric network and demonstrates how all the required components fit together, however the same network can also be started using a single script for convenience.
For Raft consensus type:
```shell ```shell
./network.sh start ./network.sh start
``` ```
For BFT consensus type:
```shell
./network.sh start -o BFT
```
After the network has started, use seperate terminals to run peer commands. After the network has started, use seperate terminals to run peer commands.
You will need to configure the peer environment for each new terminal. You will need to configure the peer environment for each new terminal.
For example to run against peer1, use: For example to run against peer1, use:
@ -85,6 +88,8 @@ To deploy and invoke the chaincode, utilize the peer1 admin terminal that you ha
1. Using a chaincode container 1. Using a chaincode container
2. Running the chaincode as a service 2. Running the chaincode as a service
For your convenience you can run `install&approve&commit_chaincode_peer1.sh` from peer1admin terminal to run basic chaincode as a container and activate it. The output of the script is redirected to the logs folder.
## 1. Using a chaincode container ## 1. Using a chaincode container
Package and install the chaincode on peer1: Package and install the chaincode on peer1:
@ -175,7 +180,7 @@ peer chaincode invoke -o 127.0.0.1:6050 -C mychannel -n basic -c '{"Args":["Upda
peer chaincode query -C mychannel -n basic -c '{"Args":["ReadAsset","1"]}' peer chaincode query -C mychannel -n basic -c '{"Args":["ReadAsset","1"]}'
``` ```
For your convenience you can run `chaincode_interaction.sh` from peer1admin terminal to make this simple transaction. The ouput of the script is redirected to the logs folder.\
Congratulations, you have deployed a minimal Fabric network! Inspect the scripts if you would like to see the minimal set of commands that were required to deploy the network. Congratulations, you have deployed a minimal Fabric network! Inspect the scripts if you would like to see the minimal set of commands that were required to deploy the network.
# Stopping the network # Stopping the network

View file

@ -0,0 +1,320 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
---
################################################################################
#
# Section: Organizations
#
# - This section defines the different organizational identities which will
# be referenced later in the configuration.
#
################################################################################
Organizations:
- &OrdererOrg
# SampleOrg defines an MSP using the sampleconfig. It should never be used
# in production but may be used as a template for other definitions
Name: OrdererOrg
# ID to load the MSP definition as
ID: OrdererMSP
# MSPDir is the filesystem path which contains the MSP configuration
MSPDir: ../crypto-config/ordererOrganizations/example.com/msp
# Policies defines the set of policies at this level of the config tree
# For organization policies, their canonical path is usually
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
Policies:
Readers:
Type: Signature
Rule: "OR('OrdererMSP.member')"
Writers:
Type: Signature
Rule: "OR('OrdererMSP.member')"
Admins:
Type: Signature
Rule: "OR('OrdererMSP.admin')"
OrdererEndpoints:
- 127.0.0.1:6050
- 127.0.0.1:6051
- 127.0.0.1:6052
- 127.0.0.1:6053
- &Org1
Name: Org1MSP
# ID to load the MSP definition as
ID: Org1MSP
MSPDir: ../crypto-config/peerOrganizations/org1.example.com/msp
# Policies defines the set of policies at this level of the config tree
# For organization policies, their canonical path is usually
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
Policies:
Readers:
Type: Signature
Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')"
Writers:
Type: Signature
Rule: "OR('Org1MSP.admin', 'Org1MSP.client')"
Admins:
Type: Signature
Rule: "OR('Org1MSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('Org1MSP.peer')"
# leave this flag set to true.
AnchorPeers:
# AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
# encoded in the genesis block in the Application section context
- Host: 127.0.0.1
Port: 7051
- &Org2
Name: Org2MSP
# ID to load the MSP definition as
ID: Org2MSP
MSPDir: ../crypto-config/peerOrganizations/org2.example.com/msp
# Policies defines the set of policies at this level of the config tree
# For organization policies, their canonical path is usually
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
Policies:
Readers:
Type: Signature
Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')"
Writers:
Type: Signature
Rule: "OR('Org2MSP.admin', 'Org2MSP.client')"
Admins:
Type: Signature
Rule: "OR('Org2MSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('Org2MSP.peer')"
AnchorPeers:
# AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
# encoded in the genesis block in the Application section context
- Host: 127.0.0.1
Port: 7055
################################################################################
#
# SECTION: Capabilities
#
# - This section defines the capabilities of fabric network. This is a new
# concept as of v1.1.0 and should not be utilized in mixed networks with
# v1.0.x peers and orderers. Capabilities define features which must be
# present in a fabric binary for that binary to safely participate in the
# fabric network. For instance, if a new MSP type is added, newer binaries
# might recognize and validate the signatures from this type, while older
# binaries without this support would be unable to validate those
# transactions. This could lead to different versions of the fabric binaries
# having different world states. Instead, defining a capability for a channel
# informs those binaries without this capability that they must cease
# processing transactions until they have been upgraded. For v1.0.x if any
# capabilities are defined (including a map with all capabilities turned off)
# then the v1.0.x peer will deliberately crash.
#
################################################################################
Capabilities:
# Channel capabilities apply to both the orderers and the peers and must be
# supported by both.
# Set the value of the capability to true to require it.
Channel: &ChannelCapabilities
# V2_0 capability ensures that orderers and peers behave according
# to v2.0 channel capabilities. Orderers and peers from
# prior releases would behave in an incompatible way, and are therefore
# not able to participate in channels at v2.0 capability.
# Prior to enabling V2.0 channel capabilities, ensure that all
# orderers and peers on a channel are at v2.0.0 or later.
V3_0: true
# Orderer capabilities apply only to the orderers, and may be safely
# used with prior release peers.
# Set the value of the capability to true to require it.
Orderer: &OrdererCapabilities
# V2_0 orderer capability ensures that orderers behave according
# to v2.0 orderer capabilities. Orderers from
# prior releases would behave in an incompatible way, and are therefore
# not able to participate in channels at v2.0 orderer capability.
# Prior to enabling V2.0 orderer capabilities, ensure that all
# orderers on channel are at v2.0.0 or later.
V2_0: true
# Application capabilities apply only to the peer network, and may be safely
# used with prior release orderers.
# Set the value of the capability to true to require it.
Application: &ApplicationCapabilities
# V2.5 for Application enables the new non-backwards compatible
# features of fabric v2.5, namely the ability to purge private data.
# Prior to enabling V2.5 application capabilities, ensure that all
# peers on a channel are at v2.5.0 or later.
V2_5: true
################################################################################
#
# SECTION: Application
#
# - This section defines the values to encode into a config transaction or
# genesis block for application related parameters
#
################################################################################
Application: &ApplicationDefaults
# Organizations is the list of orgs which are defined as participants on
# the application side of the network
Organizations:
# Policies defines the set of policies at this level of the config tree
# For Application policies, their canonical path is
# /Channel/Application/<PolicyName>
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
LifecycleEndorsement:
Type: Signature
Rule: "OR('Org1MSP.peer','Org2MSP.peer')"
Endorsement:
Type: Signature
Rule: "OR('Org1MSP.peer','Org2MSP.peer')"
Capabilities:
<<: *ApplicationCapabilities
################################################################################
#
# SECTION: Orderer
#
# - This section defines the values to encode into a config transaction or
# genesis block for orderer related parameters
#
################################################################################
Orderer: &OrdererDefaults
# Batch Timeout: The amount of time to wait before creating a batch
BatchTimeout: 2s
# Batch Size: Controls the number of messages batched into a block
BatchSize:
# Max Message Count: The maximum number of messages to permit in a batch
MaxMessageCount: 10
# Absolute Max Bytes: The absolute maximum number of bytes allowed for
# the serialized messages in a batch.
AbsoluteMaxBytes: 99 MB
# Preferred Max Bytes: The preferred maximum number of bytes allowed for
# the serialized messages in a batch. A message larger than the preferred
# max bytes will result in a batch larger than preferred max bytes.
PreferredMaxBytes: 512 KB
# Organizations is the list of orgs which are defined as participants on
# the orderer side of the network
Organizations:
# Policies defines the set of policies at this level of the config tree
# For Orderer policies, their canonical path is
# /Channel/Orderer/<PolicyName>
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
# BlockValidation specifies what signatures must be included in the block
# from the orderer for the peer to validate it.
BlockValidation:
Type: ImplicitMeta
Rule: "ANY Writers"
################################################################################
#
# CHANNEL
#
# This section defines the values to encode into a config transaction or
# genesis block for channel related parameters.
#
################################################################################
Channel: &ChannelDefaults
# Policies defines the set of policies at this level of the config tree
# For Channel policies, their canonical path is
# /Channel/<PolicyName>
Policies:
# Who may invoke the 'Deliver' API
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
# Who may invoke the 'Broadcast' API
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
# By default, who may modify elements at this config level
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
# Capabilities describes the channel level capabilities, see the
# dedicated Capabilities section elsewhere in this file for a full
# description
Capabilities:
<<: *ChannelCapabilities
################################################################################
#
# Profile
#
# - Different configuration profiles may be encoded here to be specified
# as parameters to the configtxgen tool
#
################################################################################
Profiles:
ChannelUsingBFT:
<<: *ChannelDefaults
Orderer:
<<: *OrdererDefaults
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: 100000
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

@ -0,0 +1,16 @@
#!/usr/bin/env sh
# The sleep commands were added because the queries depend on each other and have some latency.
. peer1admin.sh
peer chaincode invoke -o 127.0.0.1:6050 -C mychannel -n basic -c '{"Args":["CreateAsset","1","blue","35","tom","1000"]}' --tls --cafile "${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt >> ./logs/chaincode_interaction.log 2>&1
sleep 2
peer chaincode query -C mychannel -n basic -c '{"Args":["ReadAsset","1"]}' >> ./logs/chaincode_interaction.log 2>&1
sleep 2
peer chaincode invoke -o 127.0.0.1:6050 -C mychannel -n basic -c '{"Args":["UpdateAsset","1","blue","35","jerry","1000"]}' --tls --cafile "${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt >> ./logs/chaincode_interaction.log 2>&1
sleep 2
peer chaincode query -C mychannel -n basic -c '{"Args":["ReadAsset","1"]}' >> ./logs/chaincode_interaction.log 2>&1

View file

@ -13,108 +13,87 @@
# #
################################################################################ ################################################################################
Organizations: Organizations:
- &OrdererOrg
# SampleOrg defines an MSP using the sampleconfig. It should never be used # SampleOrg defines an MSP using the sampleconfig. It should never be used
# in production but may be used as a template for other definitions # in production but may be used as a template for other definitions
- &OrdererOrg Name: OrdererOrg
# DefaultOrg defines the organization which is used in the sampleconfig # ID to load the MSP definition as
# of the fabric.git development environment ID: OrdererMSP
Name: OrdererOrg # MSPDir is the filesystem path which contains the MSP configuration
MSPDir: crypto-config/ordererOrganizations/example.com/msp
# ID to load the MSP definition as # Policies defines the set of policies at this level of the config tree
ID: OrdererMSP # For organization policies, their canonical path is usually
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
# MSPDir is the filesystem path which contains the MSP configuration Policies:
MSPDir: crypto-config/ordererOrganizations/example.com/msp Readers:
Type: Signature
# Policies defines the set of policies at this level of the config tree Rule: "OR('OrdererMSP.member')"
# For organization policies, their canonical path is usually Writers:
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName> Type: Signature
Policies: Rule: "OR('OrdererMSP.member')"
Readers: Admins:
Type: Signature Type: Signature
Rule: "OR('OrdererMSP.member')" Rule: "OR('OrdererMSP.admin')"
Writers: OrdererEndpoints:
Type: Signature - 127.0.0.1:6050
Rule: "OR('OrdererMSP.member')" - 127.0.0.1:6051
Admins: - 127.0.0.1:6052
Type: Signature - 127.0.0.1:6053
Rule: "OR('OrdererMSP.admin')" - &Org1
Name: Org1MSP
OrdererEndpoints: # ID to load the MSP definition as
- 127.0.0.1:6050 ID: Org1MSP
- 127.0.0.1:6051 MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
- 127.0.0.1:6052 # Policies defines the set of policies at this level of the config tree
# For organization policies, their canonical path is usually
- &Org1 # /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
# DefaultOrg defines the organization which is used in the sampleconfig Policies:
# of the fabric.git development environment Readers:
Name: Org1MSP Type: Signature
Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')"
# ID to load the MSP definition as Writers:
ID: Org1MSP Type: Signature
Rule: "OR('Org1MSP.admin', 'Org1MSP.client')"
MSPDir: crypto-config/peerOrganizations/org1.example.com/msp Admins:
Type: Signature
# Policies defines the set of policies at this level of the config tree Rule: "OR('Org1MSP.admin')"
# For organization policies, their canonical path is usually Endorsement:
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName> Type: Signature
Policies: Rule: "OR('Org1MSP.peer')"
Readers: # leave this flag set to true.
Type: Signature AnchorPeers:
Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')" # AnchorPeers defines the location of peers which can be used
Writers: # for cross org gossip communication. Note, this value is only
Type: Signature # encoded in the genesis block in the Application section context
Rule: "OR('Org1MSP.admin', 'Org1MSP.client')" - Host: 127.0.0.1
Admins: Port: 7051
Type: Signature - &Org2
Rule: "OR('Org1MSP.admin')" Name: Org2MSP
Endorsement: # ID to load the MSP definition as
Type: Signature ID: Org2MSP
Rule: "OR('Org1MSP.peer')" MSPDir: crypto-config/peerOrganizations/org2.example.com/msp
# Policies defines the set of policies at this level of the config tree
# leave this flag set to true. # For organization policies, their canonical path is usually
AnchorPeers: # /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
# AnchorPeers defines the location of peers which can be used Policies:
# for cross org gossip communication. Note, this value is only Readers:
# encoded in the genesis block in the Application section context Type: Signature
- Host: 127.0.0.1 Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')"
Port: 7051 Writers:
Type: Signature
- &Org2 Rule: "OR('Org2MSP.admin', 'Org2MSP.client')"
# DefaultOrg defines the organization which is used in the sampleconfig Admins:
# of the fabric.git development environment Type: Signature
Name: Org2MSP Rule: "OR('Org2MSP.admin')"
Endorsement:
# ID to load the MSP definition as Type: Signature
ID: Org2MSP Rule: "OR('Org2MSP.peer')"
AnchorPeers:
MSPDir: crypto-config/peerOrganizations/org2.example.com/msp # AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
# Policies defines the set of policies at this level of the config tree # encoded in the genesis block in the Application section context
# For organization policies, their canonical path is usually - Host: 127.0.0.1
# /Channel/<Application|Orderer>/<OrgName>/<PolicyName> Port: 7055
Policies:
Readers:
Type: Signature
Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')"
Writers:
Type: Signature
Rule: "OR('Org2MSP.admin', 'Org2MSP.client')"
Admins:
Type: Signature
Rule: "OR('Org2MSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('Org2MSP.peer')"
AnchorPeers:
# AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
# encoded in the genesis block in the Application section context
- Host: 127.0.0.1
Port: 7055
################################################################################ ################################################################################
# #
# SECTION: Capabilities # SECTION: Capabilities
@ -135,40 +114,37 @@ Organizations:
# #
################################################################################ ################################################################################
Capabilities: Capabilities:
# Channel capabilities apply to both the orderers and the peers and must be # Channel capabilities apply to both the orderers and the peers and must be
# supported by both. # supported by both.
# Set the value of the capability to true to require it. # Set the value of the capability to true to require it.
Channel: &ChannelCapabilities Channel: &ChannelCapabilities
# V2_0 capability ensures that orderers and peers behave according # V2_0 capability ensures that orderers and peers behave according
# to v2.0 channel capabilities. Orderers and peers from # to v2.0 channel capabilities. Orderers and peers from
# prior releases would behave in an incompatible way, and are therefore # prior releases would behave in an incompatible way, and are therefore
# not able to participate in channels at v2.0 capability. # not able to participate in channels at v2.0 capability.
# Prior to enabling V2.0 channel capabilities, ensure that all # Prior to enabling V2.0 channel capabilities, ensure that all
# orderers and peers on a channel are at v2.0.0 or later. # orderers and peers on a channel are at v2.0.0 or later.
V2_0: true V2_0: true
# Orderer capabilities apply only to the orderers, and may be safely
# Orderer capabilities apply only to the orderers, and may be safely # used with prior release peers.
# used with prior release peers. # Set the value of the capability to true to require it.
# Set the value of the capability to true to require it. Orderer: &OrdererCapabilities
Orderer: &OrdererCapabilities # V2_0 orderer capability ensures that orderers behave according
# V2_0 orderer capability ensures that orderers behave according # to v2.0 orderer capabilities. Orderers from
# to v2.0 orderer capabilities. Orderers from # prior releases would behave in an incompatible way, and are therefore
# prior releases would behave in an incompatible way, and are therefore # not able to participate in channels at v2.0 orderer capability.
# not able to participate in channels at v2.0 orderer capability. # Prior to enabling V2.0 orderer capabilities, ensure that all
# Prior to enabling V2.0 orderer capabilities, ensure that all # orderers on channel are at v2.0.0 or later.
# orderers on channel are at v2.0.0 or later. V2_0: true
V2_0: true # Application capabilities apply only to the peer network, and may be safely
# used with prior release orderers.
# Application capabilities apply only to the peer network, and may be safely # Set the value of the capability to true to require it.
# used with prior release orderers. Application: &ApplicationCapabilities
# Set the value of the capability to true to require it. # V2.5 for Application enables the new non-backwards compatible
Application: &ApplicationCapabilities # features of fabric v2.5, namely the ability to purge private data.
# V2.5 for Application enables the new non-backwards compatible # Prior to enabling V2.5 application capabilities, ensure that all
# features of fabric v2.5, namely the ability to purge private data. # peers on a channel are at v2.5.0 or later.
# Prior to enabling V2.5 application capabilities, ensure that all V2_5: true
# peers on a channel are at v2.5.0 or later.
V2_5: true
################################################################################ ################################################################################
# #
# SECTION: Application # SECTION: Application
@ -178,33 +154,30 @@ Capabilities:
# #
################################################################################ ################################################################################
Application: &ApplicationDefaults Application: &ApplicationDefaults
# Organizations is the list of orgs which are defined as participants on
# Organizations is the list of orgs which are defined as participants on # the application side of the network
# the application side of the network Organizations:
Organizations: # Policies defines the set of policies at this level of the config tree
# For Application policies, their canonical path is
# Policies defines the set of policies at this level of the config tree # /Channel/Application/<PolicyName>
# For Application policies, their canonical path is Policies:
# /Channel/Application/<PolicyName> Readers:
Policies: Type: ImplicitMeta
Readers: Rule: "ANY Readers"
Type: ImplicitMeta Writers:
Rule: "ANY Readers" Type: ImplicitMeta
Writers: Rule: "ANY Writers"
Type: ImplicitMeta Admins:
Rule: "ANY Writers" Type: ImplicitMeta
Admins: Rule: "MAJORITY Admins"
Type: ImplicitMeta LifecycleEndorsement:
Rule: "MAJORITY Admins" Type: Signature
LifecycleEndorsement: Rule: "OR('Org1MSP.peer','Org2MSP.peer')"
Type: Signature Endorsement:
Rule: "OR('Org1MSP.peer','Org2MSP.peer')" Type: Signature
Endorsement: Rule: "OR('Org1MSP.peer','Org2MSP.peer')"
Type: Signature Capabilities:
Rule: "OR('Org1MSP.peer','Org2MSP.peer')" <<: *ApplicationCapabilities
Capabilities:
<<: *ApplicationCapabilities
################################################################################ ################################################################################
# #
# SECTION: Orderer # SECTION: Orderer
@ -214,94 +187,40 @@ Application: &ApplicationDefaults
# #
################################################################################ ################################################################################
Orderer: &OrdererDefaults Orderer: &OrdererDefaults
# Batch Timeout: The amount of time to wait before creating a batch
# Orderer Type: The orderer implementation to start BatchTimeout: 2s
OrdererType: etcdraft # Batch Size: Controls the number of messages batched into a block
BatchSize:
EtcdRaft: # Max Message Count: The maximum number of messages to permit in a batch
Consenters: MaxMessageCount: 10
- Host: 127.0.0.1 # Absolute Max Bytes: The absolute maximum number of bytes allowed for
Port: 6050 # the serialized messages in a batch.
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt AbsoluteMaxBytes: 99 MB
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt # Preferred Max Bytes: The preferred maximum number of bytes allowed for
- Host: 127.0.0.1 # the serialized messages in a batch. A message larger than the preferred
Port: 6051 # max bytes will result in a batch larger than preferred max bytes.
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt PreferredMaxBytes: 512 KB
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt # Organizations is the list of orgs which are defined as participants on
- Host: 127.0.0.1 # the orderer side of the network
Port: 6052 Organizations:
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt # Policies defines the set of policies at this level of the config tree
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt # For Orderer policies, their canonical path is
# /Channel/Orderer/<PolicyName>
# Options to be specified for all the etcd/raft nodes. The values here Policies:
# are the defaults for all new channels and can be modified on a Readers:
# per-channel basis via configuration updates. Type: ImplicitMeta
Options: Rule: "ANY Readers"
# TickInterval is the time interval between two Node.Tick invocations. Writers:
#TickInterval: 500ms default Type: ImplicitMeta
TickInterval: 2500ms Rule: "ANY Writers"
Admins:
# ElectionTick is the number of Node.Tick invocations that must pass Type: ImplicitMeta
# between elections. That is, if a follower does not receive any Rule: "MAJORITY Admins"
# message from the leader of current term before ElectionTick has # BlockValidation specifies what signatures must be included in the block
# elapsed, it will become candidate and start an election. # from the orderer for the peer to validate it.
# ElectionTick must be greater than HeartbeatTick. BlockValidation:
# ElectionTick: 10 default Type: ImplicitMeta
ElectionTick: 5 Rule: "ANY Writers"
# 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
BatchTimeout: 2s
# Batch Size: Controls the number of messages batched into a block
BatchSize:
# Max Message Count: The maximum number of messages to permit in a batch
MaxMessageCount: 10
# Absolute Max Bytes: The absolute maximum number of bytes allowed for
# the serialized messages in a batch.
AbsoluteMaxBytes: 99 MB
# Preferred Max Bytes: The preferred maximum number of bytes allowed for
# the serialized messages in a batch. A message larger than the preferred
# max bytes will result in a batch larger than preferred max bytes.
PreferredMaxBytes: 512 KB
# Organizations is the list of orgs which are defined as participants on
# the orderer side of the network
Organizations:
# Policies defines the set of policies at this level of the config tree
# For Orderer policies, their canonical path is
# /Channel/Orderer/<PolicyName>
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
# BlockValidation specifies what signatures must be included in the block
# from the orderer for the peer to validate it.
BlockValidation:
Type: ImplicitMeta
Rule: "ANY Writers"
################################################################################ ################################################################################
# #
# CHANNEL # CHANNEL
@ -311,29 +230,27 @@ Orderer: &OrdererDefaults
# #
################################################################################ ################################################################################
Channel: &ChannelDefaults Channel: &ChannelDefaults
# Policies defines the set of policies at this level of the config tree # Policies defines the set of policies at this level of the config tree
# For Channel policies, their canonical path is # For Channel policies, their canonical path is
# /Channel/<PolicyName> # /Channel/<PolicyName>
Policies: Policies:
# Who may invoke the 'Deliver' API # Who may invoke the 'Deliver' API
Readers: Readers:
Type: ImplicitMeta Type: ImplicitMeta
Rule: "ANY Readers" Rule: "ANY Readers"
# Who may invoke the 'Broadcast' API # Who may invoke the 'Broadcast' API
Writers: Writers:
Type: ImplicitMeta Type: ImplicitMeta
Rule: "ANY Writers" Rule: "ANY Writers"
# By default, who may modify elements at this config level # By default, who may modify elements at this config level
Admins: Admins:
Type: ImplicitMeta Type: ImplicitMeta
Rule: "MAJORITY Admins" Rule: "MAJORITY Admins"
# Capabilities describes the channel level capabilities, see the
# Capabilities describes the channel level capabilities, see the # dedicated Capabilities section elsewhere in this file for a full
# dedicated Capabilities section elsewhere in this file for a full # description
# description Capabilities:
Capabilities: <<: *ChannelCapabilities
<<: *ChannelCapabilities
################################################################################ ################################################################################
# #
# Profile # Profile
@ -343,45 +260,39 @@ Channel: &ChannelDefaults
# #
################################################################################ ################################################################################
Profiles: Profiles:
ChannelUsingRaft:
TwoOrgsOrdererGenesis: <<: *ChannelDefaults
<<: *ChannelDefaults Orderer:
Orderer: <<: *OrdererDefaults
<<: *OrdererDefaults Organizations:
Organizations: - *OrdererOrg
- *OrdererOrg Capabilities:
Capabilities: <<: *OrdererCapabilities
<<: *OrdererCapabilities OrdererType: etcdraft
Consortiums: EtcdRaft:
SampleConsortium: Consenters:
Organizations: - Host: 127.0.0.1
- *Org1 Port: 6050
- *Org2 ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
TwoOrgsChannel: ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
Consortium: SampleConsortium - Host: 127.0.0.1
<<: *ChannelDefaults Port: 6051
Application: ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
<<: *ApplicationDefaults ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
Organizations: - Host: 127.0.0.1
- *Org1 Port: 6052
- *Org2 ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
Capabilities: ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
<<: *ApplicationCapabilities Options:
Org1Channel: TickInterval: 2500ms
Consortium: SampleConsortium ElectionTick: 5
<<: *ChannelDefaults HeartbeatTick: 1
Application: MaxInflightBlocks: 5
<<: *ApplicationDefaults SnapshotIntervalSize: 16 MB
Organizations: Application:
- *Org1 <<: *ApplicationDefaults
Capabilities: Organizations:
<<: *ApplicationCapabilities - *Org1
Org2Channel: - *Org2
Consortium: SampleConsortium Capabilities:
<<: *ChannelDefaults <<: *ApplicationCapabilities
Application:
<<: *ApplicationDefaults
Organizations:
- *Org2
Capabilities:
<<: *ApplicationCapabilities

View file

@ -1,12 +0,0 @@
#!/usr/bin/env sh
#
# SPDX-License-Identifier: Apache-2.0
#
set -eu
# create channel and add anchor peer
peer channel create -c mychannel -o 127.0.0.1:6050 -f "${PWD}"/channel-artifacts/mychannel.tx --outputBlock "${PWD}"/channel-artifacts/mychannel.block --tls --cafile "${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt
peer channel update -o 127.0.0.1:6050 -c mychannel -f "${PWD}"/channel-artifacts/Org1MSPanchors.tx --tls --cafile "${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt
# join peer to channel
peer channel join -b "${PWD}"/channel-artifacts/mychannel.block

View file

@ -18,14 +18,17 @@ cryptogen generate --config="${PWD}"/crypto-config.yaml
# set FABRIC_CFG_PATH to configtx.yaml directory that contains the profiles # set FABRIC_CFG_PATH to configtx.yaml directory that contains the profiles
export FABRIC_CFG_PATH="${PWD}" export FABRIC_CFG_PATH="${PWD}"
echo "Generating orderer genesis block" ordererType="etcdraft"
configtxgen -profile TwoOrgsOrdererGenesis -channelID test-system-channel-name -outputBlock channel-artifacts/genesis.block if [ $# -gt 0 ] && [ "$1" = "BFT" ]
then
profile="ChannelUsingBFT"
ordererType="BFT"
export FABRIC_CFG_PATH="${PWD}/bft-config"
else
profile="ChannelUsingRaft"
fi
echo "Generating channel create config transaction" echo "Generating application channel genesis block with ${ordererType} consensus"
configtxgen -channelID mychannel -outputCreateChannelTx channel-artifacts/mychannel.tx -profile TwoOrgsChannel 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

View file

@ -0,0 +1,22 @@
#!/usr/bin/env sh
#
# SPDX-License-Identifier: Apache-2.0
#
# 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"
. peer1admin.sh
# Install Chaincode on Peer1
peer lifecycle chaincode package basic.tar.gz --path ../asset-transfer-basic/chaincode-go --lang golang --label basic_1 >> ./logs/install\&approve\&commit_chaincode_peer_1.log 2>&1
peer lifecycle chaincode install basic.tar.gz >> ./logs/install\&approve\&commit_chaincode_peer_1.log 2>&1
# Extract the CHAINCODE_ID from the logs
id=$(sed -n '2s/.*Chaincode code package identifier: //p' ./logs/install\&approve\&commit_chaincode_peer_1.log)
export CHAINCODE_ID="$id"
# Approve the chaincode using Peer1Admin
peer lifecycle chaincode approveformyorg -o 127.0.0.1:6050 --channelID mychannel --name basic --version 1 --package-id "${CHAINCODE_ID}" --sequence 1 --tls --cafile "${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt >> ./logs/install\&approve\&commit_chaincode_peer_1.log 2>&1
peer lifecycle chaincode commit -o 127.0.0.1:6050 --channelID mychannel --name basic --version 1 --sequence 1 --tls --cafile "${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt >> ./logs/install\&approve\&commit_chaincode_peer_1.log 2>&1

View file

@ -0,0 +1,28 @@
#!/usr/bin/env sh
set -eu
export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH"
export FABRIC_CFG_PATH="${PWD}"/../config
ORDERER_CONSENSUS_TYPE="etcdraft"
if [ $# -gt 0 ]
then
if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ]
then
echo "Unsupported input consensus type ${1}"
exit 1
fi
if [ "$1" = "BFT" ]
then
ORDERER_CONSENSUS_TYPE="BFT"
fi
fi
osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9443
osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9444
osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9445
if [ "$ORDERER_CONSENSUS_TYPE" = "BFT" ]; then
osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9446
fi

View file

@ -57,7 +57,7 @@ networkStart() {
CREATE_CHANNEL=false CREATE_CHANNEL=false
else else
echo "Generating artifacts..." echo "Generating artifacts..."
./generate_artifacts.sh ./generate_artifacts.sh "${ORDERER_TYPE}"
CREATE_CHANNEL=true CREATE_CHANNEL=true
fi fi
@ -65,9 +65,14 @@ 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 &
#start one additional orderer for BFT consensus
if [ "$ORDERER_TYPE" = "BFT" ]; 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}
@ -82,19 +87,25 @@ networkStart() {
sleep ${CLI_DELAY} sleep ${CLI_DELAY}
if [ "${CREATE_CHANNEL}" = "true" ]; then if [ "${CREATE_CHANNEL}" = "true" ]; then
echo "Joining orderers to channel..."
if [ "$ORDERER_TYPE" = "BFT" ]; then
./join_orderers.sh BFT
else
./join_orderers.sh
fi
echo "Creating channel (peer1)..." echo "Creating channel (peer1)..."
. ./peer1admin.sh && ./create_channel.sh . peer1admin.sh && ./join_channel.sh
echo "Joining channel (peer2)..." echo "Joining channel (peer2)..."
. ./peer2admin.sh && ./join_channel.sh . peer2admin.sh && ./join_channel.sh
echo "Joining channel (peer3)..." echo "Joining channel (peer3)..."
. ./peer3admin.sh && ./join_channel.sh . peer3admin.sh && ./join_channel.sh
echo "Joining channel (peer4)..." echo "Joining channel (peer4)..."
. ./peer4admin.sh && ./join_channel.sh . peer4admin.sh && ./join_channel.sh
fi fi
echo "Fabric network running. Use Ctrl-C to stop." echo "Fabric network running. Use Ctrl-C to stop."
wait wait
@ -119,6 +130,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 +140,10 @@ while [ $# -ge 1 ] ; do
CLI_DELAY="$2" CLI_DELAY="$2"
shift shift
;; ;;
-o )
ORDERER_TYPE="$2"
shift
;;
-h ) -h )
printHelp "$MODE" printHelp "$MODE"
exit 0 exit 0

View file

@ -17,11 +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 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 export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block export ORDERER_CHANNELPARTICIPATION_ENABLED=true
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer/etcdraft/wal if [ $# -gt 0 ]
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer/etcdraft/wal then
if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ]
then
echo "Unsupported input consensus type ${1}"
exit 1
fi
export ORDERER_CONSENSUS_TYPE=${1}
fi
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_OPERATIONS_LISTENADDRESS=127.0.0.1:8443
export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9443 export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9443

View file

@ -17,11 +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 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 export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block export ORDERER_CHANNELPARTICIPATION_ENABLED=true
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer2 export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer2
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer2/etcdraft/wal if [ $# -gt 0 ]
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer2/etcdraft/wal then
if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ]
then
echo "Unsupported input consensus type ${1}"
exit 1
fi
export ORDERER_CONSENSUS_TYPE=${1}
fi
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_OPERATIONS_LISTENADDRESS=127.0.0.1:8444
export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9444 export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9444

View file

@ -17,11 +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 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 export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block export ORDERER_CHANNELPARTICIPATION_ENABLED=true
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer3 export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer3
export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer3/etcdraft/wal if [ $# -gt 0 ]
export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer3/etcdraft/wal then
if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ]
then
echo "Unsupported input consensus type ${1}"
exit 1
fi
export ORDERER_CONSENSUS_TYPE=${1}
fi
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_OPERATIONS_LISTENADDRESS=127.0.0.1:8445
export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9445 export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9445

View file

@ -0,0 +1,38 @@
#!/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
export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_CHANNELPARTICIPATION_ENABLED=true
export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer4
if [ $# -gt 0 ]
then
if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ]
then
echo "Unsupported input consensus type ${1}"
exit 1
fi
export ORDERER_CONSENSUS_TYPE=${1}
fi
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
# start orderer
orderer