mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
Test network nano bash - initial commit (#450)
Test network Nano bash provides a set of minimal bash scripts to run a Fabric network on your local machine. The network is functionally equivalent to the docker-based Test Network, you can therefore run all the tutorials and samples that target the Test Network. The Fabric release binaries are utilized rather than using docker containers to avoid all unnecessary layers. Only the chaincode and chaincode builder runs in a docker container behind the scenes. Using the Fabric binaries also makes it simple for Fabric developers to iteratively and quickly modify Fabric code and test a Fabric network as a user. Signed-off-by: David Enyeart <enyeart@us.ibm.com>
This commit is contained in:
parent
8890d49d19
commit
2663a07765
17 changed files with 842 additions and 0 deletions
4
test-network-nano-bash/.gitignore
vendored
Normal file
4
test-network-nano-bash/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
channel-artifacts/
|
||||||
|
crypto-config/
|
||||||
|
data/
|
||||||
|
*.gz
|
||||||
85
test-network-nano-bash/README.md
Normal file
85
test-network-nano-bash/README.md
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
# Test network - Nano bash
|
||||||
|
|
||||||
|
Test network Nano bash provides a set of minimal bash scripts to run a Fabric network on your local machine.
|
||||||
|
The network is functionally equivalent to the docker-based Test Network, you can therefore run all the tutorials and samples that target the Test Network with minimal changes.
|
||||||
|
The Fabric release binaries are utilized rather than using docker containers to avoid all unnecessary layers. Only the chaincode and chaincode builder runs in a docker container behind the scenes.
|
||||||
|
Using the Fabric binaries also makes it simple for Fabric developers to iteratively and quickly modify Fabric code and test a Fabric network as a user.
|
||||||
|
|
||||||
|
As the name `nano` implies, the scripts provide the smallest minimal setup possible for a Fabric network while still offering a multi-node TLS-enabled network:
|
||||||
|
- Minimal set of dependencies
|
||||||
|
- Minimal requirements on Fabric version (any v2.x orderer and peer nodes should work)
|
||||||
|
- Minimal set of environment variable overrides of the default orderer orderer.yaml and peer core.yaml configurations
|
||||||
|
- Minimal scripting with minimal set of reference commands to get a Fabric network up and running
|
||||||
|
- Minimal channel configuration for an orderer organization (3 ordering nodes) and two peer organizations (with two peers each)
|
||||||
|
- Minimal endorsement policy to allow a single organization to approve and commit a chaincode (unlike Test Network which requires both organizations to endorse)
|
||||||
|
|
||||||
|
# Prereqs
|
||||||
|
|
||||||
|
- Follow the Fabric documentation for the [Prereqs](https://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html)
|
||||||
|
- Follow the Fabric documentation for [downloading the Fabric samples and binaries](https://hyperledger-fabric.readthedocs.io/en/latest/install.html). You can skip the docker image downloads by using `curl -sSL https://bit.ly/2ysbOFE | bash -s -- -d`
|
||||||
|
|
||||||
|
# Instructions for starting network
|
||||||
|
|
||||||
|
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.
|
||||||
|
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).
|
||||||
|

|
||||||
|
|
||||||
|
The following instructions will have you run simple bash scripts that set environment variable overrides for a component and then runs the component.
|
||||||
|
The scripts contain only simple single-line commands so that they are easy to read and understand.
|
||||||
|
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
|
||||||
|
- 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 three orderer terminals, run `./orderer1.sh`, `./orderer2.sh`, `./orderer3.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
|
||||||
|
- In the four peer admin terminals, run `source peer1admin.sh`, `source peer2admin.sh`, `source peer3admin.sh`, `source peer4admin.sh` respectively
|
||||||
|
|
||||||
|
Note the syntax of running the scripts. The peer admin scripts run with the `source` command in order to source the script files in the respective shells. This is important so that the exported environment variables can be utilized by any subsequent user commands.
|
||||||
|
|
||||||
|
The `peer1admin.sh` script sets the peer1 admin environment variables, creates the application channel `mychannel`, updates the channel configuration for the org1 gossip anchor peer, and joins peer1 to `mychannel`.
|
||||||
|
The remaining peer admin scripts join their respective peers to `mychannel`.
|
||||||
|
|
||||||
|
# Instructions for deploying and running the basic asset transfer sample chaincode
|
||||||
|
|
||||||
|
To deploy and invoke the chaincode, utilize the peer1 admin terminal that you have created in the prior steps.
|
||||||
|
|
||||||
|
Package and install the chaincode on peer1:
|
||||||
|
|
||||||
|
```
|
||||||
|
peer lifecycle chaincode package basic.tar.gz --path ../asset-transfer-basic/chaincode-go --lang golang --label basic_1
|
||||||
|
|
||||||
|
peer lifecycle chaincode install basic.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
The chaincode install may take a minute since the `fabric-ccenv` chaincode builder docker image will be downloaded if not already available on your machine.
|
||||||
|
Copy the returned chaincode package ID into an environment variable for use in subsequent commands (your ID may be different):
|
||||||
|
|
||||||
|
```
|
||||||
|
export CC_PACKAGE_ID=basic_1:faaa38f2fc913c8344986a7d1617d21f6c97bc8d85ee0a489c90020cd57af4a5
|
||||||
|
```
|
||||||
|
|
||||||
|
Approve and commit the chaincode (only a single approver is required based on the lifecycle endorsement policy of any organization):
|
||||||
|
|
||||||
|
```
|
||||||
|
peer lifecycle chaincode approveformyorg -o 127.0.0.1:6050 --channelID mychannel --name basic --version 1 --package-id $CC_PACKAGE_ID --sequence 1 --tls --cafile ${PWD}/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
Invoke the chaincode to create an asset (only a single endorser is required based on the default endorsement policy of any organization).
|
||||||
|
Then query the asset, update it, and query again to see the resulting asset changes on the ledger.
|
||||||
|
|
||||||
|
```
|
||||||
|
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
|
||||||
|
|
||||||
|
peer chaincode query -C mychannel -n basic -c '{"Args":["ReadAsset","1"]}'
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
peer chaincode query -C mychannel -n basic -c '{"Args":["ReadAsset","1"]}'
|
||||||
|
```
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Utilize `Ctrl-C` in the orderer and peer terminal windows to kill the orderer and peer processes. You can run the scripts again to restart the components with their existing data, or run `./generate_artifacts` again to clean up the existing artifacts and data if you would like to restart with a clean environment.
|
||||||
389
test-network-nano-bash/configtx.yaml
Normal file
389
test-network-nano-bash/configtx.yaml
Normal file
|
|
@ -0,0 +1,389 @@
|
||||||
|
# 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:
|
||||||
|
|
||||||
|
# SampleOrg defines an MSP using the sampleconfig. It should never be used
|
||||||
|
# in production but may be used as a template for other definitions
|
||||||
|
- &OrdererOrg
|
||||||
|
# DefaultOrg defines the organization which is used in the sampleconfig
|
||||||
|
# of the fabric.git development environment
|
||||||
|
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
|
||||||
|
|
||||||
|
- &Org1
|
||||||
|
# DefaultOrg defines the organization which is used in the sampleconfig
|
||||||
|
# of the fabric.git development environment
|
||||||
|
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
|
||||||
|
# DefaultOrg defines the organization which is used in the sampleconfig
|
||||||
|
# of the fabric.git development environment
|
||||||
|
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.
|
||||||
|
V2_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_0 application capability ensures that peers behave according
|
||||||
|
# to v2.0 application capabilities. Peers from
|
||||||
|
# prior releases would behave in an incompatible way, and are therefore
|
||||||
|
# not able to participate in channels at v2.0 application capability.
|
||||||
|
# Prior to enabling V2.0 application capabilities, ensure that all
|
||||||
|
# peers on channel are at v2.0.0 or later.
|
||||||
|
V2_0: 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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
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:
|
||||||
|
|
||||||
|
TwoOrgsOrdererGenesis:
|
||||||
|
<<: *ChannelDefaults
|
||||||
|
Orderer:
|
||||||
|
<<: *OrdererDefaults
|
||||||
|
Organizations:
|
||||||
|
- *OrdererOrg
|
||||||
|
Capabilities:
|
||||||
|
<<: *OrdererCapabilities
|
||||||
|
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
|
||||||
54
test-network-nano-bash/crypto-config.yaml
Normal file
54
test-network-nano-bash/crypto-config.yaml
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
# Copyright IBM Corp. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# "OrdererOrgs" - Definition of organizations managing orderer nodes
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
OrdererOrgs:
|
||||||
|
- Name: Orderer
|
||||||
|
Domain: example.com
|
||||||
|
EnableNodeOUs: true
|
||||||
|
|
||||||
|
Specs:
|
||||||
|
- Hostname: orderer
|
||||||
|
SANS:
|
||||||
|
- 127.0.0.1
|
||||||
|
- Hostname: orderer2
|
||||||
|
SANS:
|
||||||
|
- 127.0.0.1
|
||||||
|
- Hostname: orderer3
|
||||||
|
SANS:
|
||||||
|
- 127.0.0.1
|
||||||
|
- Hostname: orderer4
|
||||||
|
SANS:
|
||||||
|
- 127.0.0.1
|
||||||
|
- Hostname: orderer5
|
||||||
|
SANS:
|
||||||
|
- 127.0.0.1
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# "PeerOrgs" - Definition of organizations managing peer nodes
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
PeerOrgs:
|
||||||
|
- Name: Org1
|
||||||
|
Domain: org1.example.com
|
||||||
|
EnableNodeOUs: true
|
||||||
|
|
||||||
|
Template:
|
||||||
|
Count: 2
|
||||||
|
SANS:
|
||||||
|
- 127.0.0.1
|
||||||
|
Users:
|
||||||
|
Count: 1
|
||||||
|
|
||||||
|
- Name: Org2
|
||||||
|
Domain: org2.example.com
|
||||||
|
EnableNodeOUs: true
|
||||||
|
Template:
|
||||||
|
Count: 2
|
||||||
|
SANS:
|
||||||
|
- 127.0.0.1
|
||||||
|
Users:
|
||||||
|
Count: 1
|
||||||
28
test-network-nano-bash/generate_artifacts.sh
Executable file
28
test-network-nano-bash/generate_artifacts.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# remove existing artifacts, or proceed on if the directories don't exist
|
||||||
|
rm -r "${PWD}"/channel-artifacts || true
|
||||||
|
rm -r "${PWD}"/crypto-config || true
|
||||||
|
rm -r "${PWD}"/data || true
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
echo "Generating MSP certificates using cryptogen tool"
|
||||||
|
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
|
||||||
|
|
||||||
|
echo "Generating channel create config transaction"
|
||||||
|
configtxgen -channelID mychannel -outputCreateChannelTx channel-artifacts/mychannel.tx -profile TwoOrgsChannel
|
||||||
|
|
||||||
|
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
|
||||||
26
test-network-nano-bash/orderer1.sh
Executable file
26
test-network-nano-bash/orderer1.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# 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=6050
|
||||||
|
export ORDERER_GENERAL_LOCALMSPID=OrdererMSP
|
||||||
|
export ORDERER_GENERAL_LOCALMSPDIR="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp
|
||||||
|
export ORDERER_GENERAL_TLS_ENABLED=true
|
||||||
|
export ORDERER_GENERAL_TLS_PRIVATEKEY="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key
|
||||||
|
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
|
||||||
|
export ORDERER_GENERAL_BOOTSTRAPMETHOD=file
|
||||||
|
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block
|
||||||
|
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_OPERATIONS_LISTENADDRESS=127.0.0.1:8443
|
||||||
|
export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9443
|
||||||
|
|
||||||
|
# start orderer
|
||||||
|
orderer
|
||||||
26
test-network-nano-bash/orderer2.sh
Executable file
26
test-network-nano-bash/orderer2.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# 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=6051
|
||||||
|
export ORDERER_GENERAL_LOCALMSPID=OrdererMSP
|
||||||
|
export ORDERER_GENERAL_LOCALMSPDIR="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/msp
|
||||||
|
export ORDERER_GENERAL_TLS_ENABLED=true
|
||||||
|
export ORDERER_GENERAL_TLS_PRIVATEKEY="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.key
|
||||||
|
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
|
||||||
|
export ORDERER_GENERAL_BOOTSTRAPMETHOD=file
|
||||||
|
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block
|
||||||
|
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_OPERATIONS_LISTENADDRESS=127.0.0.1:8444
|
||||||
|
export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9444
|
||||||
|
|
||||||
|
# start orderer
|
||||||
|
orderer
|
||||||
26
test-network-nano-bash/orderer3.sh
Executable file
26
test-network-nano-bash/orderer3.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# 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=6052
|
||||||
|
export ORDERER_GENERAL_LOCALMSPID=OrdererMSP
|
||||||
|
export ORDERER_GENERAL_LOCALMSPDIR="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/msp
|
||||||
|
export ORDERER_GENERAL_TLS_ENABLED=true
|
||||||
|
export ORDERER_GENERAL_TLS_PRIVATEKEY="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.key
|
||||||
|
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
|
||||||
|
export ORDERER_GENERAL_BOOTSTRAPMETHOD=file
|
||||||
|
export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block
|
||||||
|
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_OPERATIONS_LISTENADDRESS=127.0.0.1:8445
|
||||||
|
export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9445
|
||||||
|
|
||||||
|
# start orderer
|
||||||
|
orderer
|
||||||
35
test-network-nano-bash/peer1.sh
Executable file
35
test-network-nano-bash/peer1.sh
Executable file
|
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# 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,grpc,peer.gossip.mcs,gossip,leveldbhelper=info
|
||||||
|
export CORE_PEER_TLS_ENABLED=true
|
||||||
|
export CORE_PEER_TLS_CERT_FILE="${PWD}"/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
|
||||||
|
export CORE_PEER_TLS_KEY_FILE="${PWD}"/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
|
||||||
|
export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
|
||||||
|
export CORE_PEER_ID=peer0.org1.example.com
|
||||||
|
export CORE_PEER_ADDRESS=127.0.0.1:7051
|
||||||
|
export CORE_PEER_LISTENADDRESS=127.0.0.1:7051
|
||||||
|
export CORE_PEER_CHAINCODEADDRESS=host.docker.internal:7052
|
||||||
|
export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7052
|
||||||
|
# bootstrap peer is the other peer in the same org
|
||||||
|
export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7053
|
||||||
|
export CORE_PEER_GOSSIP_EXTERNALENDPOINT=127.0.0.1:7051
|
||||||
|
export CORE_PEER_LOCALMSPID=Org1MSP
|
||||||
|
export CORE_PEER_MSPCONFIGPATH="${PWD}"/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp
|
||||||
|
export CORE_OPERATIONS_LISTENADDRESS=127.0.0.1:8446
|
||||||
|
export CORE_PEER_FILESYSTEMPATH="${PWD}"/data/peer0.org1.example.com
|
||||||
|
export CORE_LEDGER_SNAPSHOTS_ROOTDIR="${PWD}"/data/peer0.org1.example.com/snapshots
|
||||||
|
|
||||||
|
# uncomment the lines below to utilize couchdb state database, when done with the environment you can stop the couchdb container with "docker rm -f couchdb1"
|
||||||
|
# export CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
||||||
|
# export CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=127.0.0.1:5984
|
||||||
|
# export CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
|
||||||
|
# export CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=password
|
||||||
|
# docker run --publish 5984:5984 --detach -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password --name couchdb1 couchdb:3.1.1
|
||||||
|
|
||||||
|
# start peer
|
||||||
|
peer node start
|
||||||
19
test-network-nano-bash/peer1admin.sh
Executable file
19
test-network-nano-bash/peer1admin.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 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=INFO
|
||||||
|
export CORE_PEER_TLS_ENABLED=true
|
||||||
|
export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
|
||||||
|
export CORE_PEER_ADDRESS=127.0.0.1:7051
|
||||||
|
export CORE_PEER_LOCALMSPID=Org1MSP
|
||||||
|
export CORE_PEER_MSPCONFIGPATH="${PWD}"/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
|
||||||
|
|
||||||
|
# peer1 admin will be responsible for creating channel and adding 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
|
||||||
35
test-network-nano-bash/peer2.sh
Executable file
35
test-network-nano-bash/peer2.sh
Executable file
|
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# 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,grpc,peer.gossip.mcs,gossip,leveldbhelper=info
|
||||||
|
export CORE_PEER_TLS_ENABLED=true
|
||||||
|
export CORE_PEER_TLS_CERT_FILE="${PWD}"/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/server.crt
|
||||||
|
export CORE_PEER_TLS_KEY_FILE="${PWD}"/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/server.key
|
||||||
|
export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt
|
||||||
|
export CORE_PEER_ID=peer1.org1.example.com
|
||||||
|
export CORE_PEER_ADDRESS=127.0.0.1:7053
|
||||||
|
export CORE_PEER_LISTENADDRESS=127.0.0.1:7053
|
||||||
|
export CORE_PEER_CHAINCODEADDRESS=host.docker.internal:7054
|
||||||
|
export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7054
|
||||||
|
# bootstrap peer is the other peer in the same org
|
||||||
|
export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7051
|
||||||
|
export CORE_PEER_GOSSIP_EXTERNALENDPOINT=127.0.0.1:7053
|
||||||
|
export CORE_PEER_LOCALMSPID=Org1MSP
|
||||||
|
export CORE_PEER_MSPCONFIGPATH="${PWD}"/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp
|
||||||
|
export CORE_OPERATIONS_LISTENADDRESS=127.0.0.1:8447
|
||||||
|
export CORE_PEER_FILESYSTEMPATH="${PWD}"/data/peer1.org1.example.com
|
||||||
|
export CORE_LEDGER_SNAPSHOTS_ROOTDIR="${PWD}"/data/peer1.org1.example.com/snapshots
|
||||||
|
|
||||||
|
# uncomment the lines below to utilize couchdb state database, when done with the environment you can stop the couchdb container with "docker rm -f couchdb2"
|
||||||
|
# export CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
||||||
|
# export CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=127.0.0.1:5985
|
||||||
|
# export CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
|
||||||
|
# export CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=password
|
||||||
|
# docker run --publish 5985:5984 --detach -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password --name couchdb2 couchdb:3.1.1
|
||||||
|
|
||||||
|
# start peer
|
||||||
|
peer node start
|
||||||
15
test-network-nano-bash/peer2admin.sh
Executable file
15
test-network-nano-bash/peer2admin.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 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=INFO
|
||||||
|
export CORE_PEER_TLS_ENABLED=true
|
||||||
|
export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt
|
||||||
|
export CORE_PEER_ADDRESS=127.0.0.1:7053
|
||||||
|
export CORE_PEER_LOCALMSPID=Org1MSP
|
||||||
|
export CORE_PEER_MSPCONFIGPATH="${PWD}"/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
|
||||||
|
|
||||||
|
# join peer to channel
|
||||||
|
peer channel join -b "${PWD}"/channel-artifacts/mychannel.block
|
||||||
35
test-network-nano-bash/peer3.sh
Executable file
35
test-network-nano-bash/peer3.sh
Executable file
|
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# 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,grpc,peer.gossip.mcs,gossip,leveldbhelper=info
|
||||||
|
export CORE_PEER_TLS_ENABLED=true
|
||||||
|
export CORE_PEER_TLS_CERT_FILE="${PWD}"/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt
|
||||||
|
export CORE_PEER_TLS_KEY_FILE="${PWD}"/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key
|
||||||
|
export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
|
||||||
|
export CORE_PEER_ID=peer0.org2.example.com
|
||||||
|
export CORE_PEER_ADDRESS=127.0.0.1:7055
|
||||||
|
export CORE_PEER_LISTENADDRESS=127.0.0.1:7055
|
||||||
|
export CORE_PEER_CHAINCODEADDRESS=host.docker.internal:7056
|
||||||
|
export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7056
|
||||||
|
# bootstrap peer is the other peer in the same org
|
||||||
|
export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7057
|
||||||
|
export CORE_PEER_GOSSIP_EXTERNALENDPOINT=127.0.0.1:7055
|
||||||
|
export CORE_PEER_LOCALMSPID=Org2MSP
|
||||||
|
export CORE_PEER_MSPCONFIGPATH="${PWD}"/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp
|
||||||
|
export CORE_OPERATIONS_LISTENADDRESS=127.0.0.1:8448
|
||||||
|
export CORE_PEER_FILESYSTEMPATH="${PWD}"/data/peer0.org2.example.com
|
||||||
|
export CORE_LEDGER_SNAPSHOTS_ROOTDIR="${PWD}"/data/peer0.org2.example.com/snapshots
|
||||||
|
|
||||||
|
# uncomment the lines below to utilize couchdb state database, when done with the environment you can stop the couchdb container with "docker rm -f couchdb3"
|
||||||
|
# export CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
||||||
|
# export CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=127.0.0.1:5986
|
||||||
|
# export CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
|
||||||
|
# export CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=password
|
||||||
|
# docker run --publish 5986:5984 --detach -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password --name couchdb3 couchdb:3.1.1
|
||||||
|
|
||||||
|
# start peer
|
||||||
|
peer node start
|
||||||
15
test-network-nano-bash/peer3admin.sh
Executable file
15
test-network-nano-bash/peer3admin.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 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=INFO
|
||||||
|
export CORE_PEER_TLS_ENABLED=true
|
||||||
|
export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
|
||||||
|
export CORE_PEER_ADDRESS=127.0.0.1:7055
|
||||||
|
export CORE_PEER_LOCALMSPID=Org2MSP
|
||||||
|
export CORE_PEER_MSPCONFIGPATH="${PWD}"/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
|
||||||
|
|
||||||
|
# join peer to channel
|
||||||
|
peer channel join -b "${PWD}"/channel-artifacts/mychannel.block
|
||||||
35
test-network-nano-bash/peer4.sh
Executable file
35
test-network-nano-bash/peer4.sh
Executable file
|
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# 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,grpc,peer.gossip.mcs,gossip,leveldbhelper=info
|
||||||
|
export CORE_PEER_TLS_ENABLED=true
|
||||||
|
export CORE_PEER_TLS_CERT_FILE="${PWD}"/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/server.crt
|
||||||
|
export CORE_PEER_TLS_KEY_FILE="${PWD}"/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/server.key
|
||||||
|
export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt
|
||||||
|
export CORE_PEER_ID=peer0.org2.example.com
|
||||||
|
export CORE_PEER_ADDRESS=127.0.0.1:7057
|
||||||
|
export CORE_PEER_LISTENADDRESS=127.0.0.1:7057
|
||||||
|
export CORE_PEER_CHAINCODEADDRESS=host.docker.internal:7058
|
||||||
|
export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7058
|
||||||
|
# bootstrap peer is the other peer in the same org
|
||||||
|
export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7055
|
||||||
|
export CORE_PEER_GOSSIP_EXTERNALENDPOINT=127.0.0.1:7057
|
||||||
|
export CORE_PEER_LOCALMSPID=Org2MSP
|
||||||
|
export CORE_PEER_MSPCONFIGPATH="${PWD}"/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp
|
||||||
|
export CORE_OPERATIONS_LISTENADDRESS=127.0.0.1:8449
|
||||||
|
export CORE_PEER_FILESYSTEMPATH="${PWD}"/data/peer1.org2.example.com
|
||||||
|
export CORE_LEDGER_SNAPSHOTS_ROOTDIR="${PWD}"/data/peer1.org2.example.com/snapshots
|
||||||
|
|
||||||
|
# uncomment the lines below to utilize couchdb state database, when done with the environment you can stop the couchdb container with "docker rm -f couchdb4"
|
||||||
|
# export CORE_LEDGER_STATE_STATEDATABASE=CouchDB
|
||||||
|
# export CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=127.0.0.1:5987
|
||||||
|
# export CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
|
||||||
|
# export CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=password
|
||||||
|
# docker run --publish 5987:5984 --detach -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password --name couchdb4 couchdb:3.1.1
|
||||||
|
|
||||||
|
# start peer
|
||||||
|
peer node start
|
||||||
15
test-network-nano-bash/peer4admin.sh
Executable file
15
test-network-nano-bash/peer4admin.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 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=INFO
|
||||||
|
export CORE_PEER_TLS_ENABLED=true
|
||||||
|
export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt
|
||||||
|
export CORE_PEER_ADDRESS=127.0.0.1:7057
|
||||||
|
export CORE_PEER_LOCALMSPID=Org2MSP
|
||||||
|
export CORE_PEER_MSPCONFIGPATH="${PWD}"/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
|
||||||
|
|
||||||
|
# join peer to channel
|
||||||
|
peer channel join -b "${PWD}"/channel-artifacts/mychannel.block
|
||||||
BIN
test-network-nano-bash/terminal_setup.png
Normal file
BIN
test-network-nano-bash/terminal_setup.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 163 KiB |
Loading…
Reference in a new issue