From 5b8c4390dbe2563e005f76392a9d9b067e787ba6 Mon Sep 17 00:00:00 2001 From: Nikhil Gupta Date: Tue, 12 Jan 2021 18:22:55 -0500 Subject: [PATCH 1/3] Cleanup of register/enroll script Signed-off-by: Nikhil Gupta --- .../addOrg3/fabric-ca/registerEnroll.sh | 12 ------- .../organizations/fabric-ca/registerEnroll.sh | 32 ------------------- 2 files changed, 44 deletions(-) diff --git a/test-network/addOrg3/fabric-ca/registerEnroll.sh b/test-network/addOrg3/fabric-ca/registerEnroll.sh index 65b4122c..e2d49c14 100644 --- a/test-network/addOrg3/fabric-ca/registerEnroll.sh +++ b/test-network/addOrg3/fabric-ca/registerEnroll.sh @@ -5,15 +5,11 @@ # SPDX-License-Identifier: Apache-2.0 # -. ../../scripts/utils.sh - function createOrg3 { infoln "Enrolling the CA admin" mkdir -p ../organizations/peerOrganizations/org3.example.com/ export FABRIC_CA_CLIENT_HOME=${PWD}/../organizations/peerOrganizations/org3.example.com/ -# rm -rf $FABRIC_CA_CLIENT_HOME/fabric-ca-client-config.yaml -# rm -rf $FABRIC_CA_CLIENT_HOME/msp set -x fabric-ca-client enroll -u https://admin:adminpw@localhost:11054 --caname ca-org3 --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem @@ -49,9 +45,6 @@ function createOrg3 { fabric-ca-client register --caname ca-org3 --id.name org3admin --id.secret org3adminpw --id.type admin --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem { set +x; } 2>/dev/null - mkdir -p ../organizations/peerOrganizations/org3.example.com/peers - mkdir -p ../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com - infoln "Generating the peer0 msp" set -x fabric-ca-client enroll -u https://peer0:peer0pw@localhost:11054 --caname ca-org3 -M ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/msp --csr.hosts peer0.org3.example.com --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem @@ -78,9 +71,6 @@ function createOrg3 { mkdir ${PWD}/../organizations/peerOrganizations/org3.example.com/ca cp ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/msp/cacerts/* ${PWD}/../organizations/peerOrganizations/org3.example.com/ca/ca.org3.example.com-cert.pem - mkdir -p ../organizations/peerOrganizations/org3.example.com/users - mkdir -p ../organizations/peerOrganizations/org3.example.com/users/User1@org3.example.com - infoln "Generating the user msp" set -x fabric-ca-client enroll -u https://user1:user1pw@localhost:11054 --caname ca-org3 -M ${PWD}/../organizations/peerOrganizations/org3.example.com/users/User1@org3.example.com/msp --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem @@ -88,8 +78,6 @@ function createOrg3 { cp ${PWD}/../organizations/peerOrganizations/org3.example.com/msp/config.yaml ${PWD}/../organizations/peerOrganizations/org3.example.com/users/User1@org3.example.com/msp/config.yaml - mkdir -p ../organizations/peerOrganizations/org3.example.com/users/Admin@org3.example.com - infoln "Generating the org admin msp" set -x fabric-ca-client enroll -u https://org3admin:org3adminpw@localhost:11054 --caname ca-org3 -M ${PWD}/../organizations/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem diff --git a/test-network/organizations/fabric-ca/registerEnroll.sh b/test-network/organizations/fabric-ca/registerEnroll.sh index c064d024..89ab538b 100755 --- a/test-network/organizations/fabric-ca/registerEnroll.sh +++ b/test-network/organizations/fabric-ca/registerEnroll.sh @@ -1,14 +1,10 @@ #!/bin/bash -source scripts/utils.sh - function createOrg1() { infoln "Enrolling the CA admin" mkdir -p organizations/peerOrganizations/org1.example.com/ export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/peerOrganizations/org1.example.com/ - # rm -rf $FABRIC_CA_CLIENT_HOME/fabric-ca-client-config.yaml - # rm -rf $FABRIC_CA_CLIENT_HOME/msp set -x fabric-ca-client enroll -u https://admin:adminpw@localhost:7054 --caname ca-org1 --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem @@ -44,9 +40,6 @@ function createOrg1() { fabric-ca-client register --caname ca-org1 --id.name org1admin --id.secret org1adminpw --id.type admin --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem { set +x; } 2>/dev/null - mkdir -p organizations/peerOrganizations/org1.example.com/peers - mkdir -p organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com - infoln "Generating the peer0 msp" set -x fabric-ca-client enroll -u https://peer0:peer0pw@localhost:7054 --caname ca-org1 -M ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp --csr.hosts peer0.org1.example.com --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem @@ -72,9 +65,6 @@ function createOrg1() { mkdir -p ${PWD}/organizations/peerOrganizations/org1.example.com/ca cp ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/cacerts/* ${PWD}/organizations/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - mkdir -p organizations/peerOrganizations/org1.example.com/users - mkdir -p organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com - infoln "Generating the user msp" set -x fabric-ca-client enroll -u https://user1:user1pw@localhost:7054 --caname ca-org1 -M ${PWD}/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem @@ -82,8 +72,6 @@ function createOrg1() { cp ${PWD}/organizations/peerOrganizations/org1.example.com/msp/config.yaml ${PWD}/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/config.yaml - mkdir -p organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com - infoln "Generating the org admin msp" set -x fabric-ca-client enroll -u https://org1admin:org1adminpw@localhost:7054 --caname ca-org1 -M ${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem @@ -97,8 +85,6 @@ function createOrg2() { mkdir -p organizations/peerOrganizations/org2.example.com/ export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/peerOrganizations/org2.example.com/ - # rm -rf $FABRIC_CA_CLIENT_HOME/fabric-ca-client-config.yaml - # rm -rf $FABRIC_CA_CLIENT_HOME/msp set -x fabric-ca-client enroll -u https://admin:adminpw@localhost:8054 --caname ca-org2 --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem @@ -134,9 +120,6 @@ function createOrg2() { fabric-ca-client register --caname ca-org2 --id.name org2admin --id.secret org2adminpw --id.type admin --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem { set +x; } 2>/dev/null - mkdir -p organizations/peerOrganizations/org2.example.com/peers - mkdir -p organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com - infoln "Generating the peer0 msp" set -x fabric-ca-client enroll -u https://peer0:peer0pw@localhost:8054 --caname ca-org2 -M ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp --csr.hosts peer0.org2.example.com --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem @@ -162,9 +145,6 @@ function createOrg2() { mkdir -p ${PWD}/organizations/peerOrganizations/org2.example.com/ca cp ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/cacerts/* ${PWD}/organizations/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem - mkdir -p organizations/peerOrganizations/org2.example.com/users - mkdir -p organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com - infoln "Generating the user msp" set -x fabric-ca-client enroll -u https://user1:user1pw@localhost:8054 --caname ca-org2 -M ${PWD}/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem @@ -172,8 +152,6 @@ function createOrg2() { cp ${PWD}/organizations/peerOrganizations/org2.example.com/msp/config.yaml ${PWD}/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/config.yaml - mkdir -p organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com - infoln "Generating the org admin msp" set -x fabric-ca-client enroll -u https://org2admin:org2adminpw@localhost:8054 --caname ca-org2 -M ${PWD}/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem @@ -187,8 +165,6 @@ function createOrderer() { mkdir -p organizations/ordererOrganizations/example.com export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/ordererOrganizations/example.com - # rm -rf $FABRIC_CA_CLIENT_HOME/fabric-ca-client-config.yaml - # rm -rf $FABRIC_CA_CLIENT_HOME/msp set -x fabric-ca-client enroll -u https://admin:adminpw@localhost:9054 --caname ca-orderer --tls.certfiles ${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem @@ -219,11 +195,6 @@ function createOrderer() { fabric-ca-client register --caname ca-orderer --id.name ordererAdmin --id.secret ordererAdminpw --id.type admin --tls.certfiles ${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem { set +x; } 2>/dev/null - mkdir -p organizations/ordererOrganizations/example.com/orderers - mkdir -p organizations/ordererOrganizations/example.com/orderers/example.com - - mkdir -p organizations/ordererOrganizations/example.com/orderers/orderer.example.com - infoln "Generating the orderer msp" set -x fabric-ca-client enroll -u https://orderer:ordererpw@localhost:9054 --caname ca-orderer -M ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp --csr.hosts orderer.example.com --csr.hosts localhost --tls.certfiles ${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem @@ -246,9 +217,6 @@ function createOrderer() { mkdir -p ${PWD}/organizations/ordererOrganizations/example.com/msp/tlscacerts cp ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/tlscacerts/* ${PWD}/organizations/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem - mkdir -p organizations/ordererOrganizations/example.com/users - mkdir -p organizations/ordererOrganizations/example.com/users/Admin@example.com - infoln "Generating the admin msp" set -x fabric-ca-client enroll -u https://ordererAdmin:ordererAdminpw@localhost:9054 --caname ca-orderer -M ${PWD}/organizations/ordererOrganizations/example.com/users/Admin@example.com/msp --tls.certfiles ${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem From 622cf5281459967b9263c6e83879381f9bbf8d22 Mon Sep 17 00:00:00 2001 From: Brett Logan Date: Wed, 13 Jan 2021 12:22:26 -0500 Subject: [PATCH 2/3] Update Fabric Dependency Version Signed-off-by: Brett Logan --- ci/azure-pipelines.yml | 2 +- ci/scripts/pullFabricImages.sh | 2 +- ci/scripts/run-test-network-basic.sh | 2 +- ci/scripts/run-test-network-events.sh | 2 +- ci/scripts/run-test-network-ledger.sh | 2 +- ci/scripts/run-test-network-private.sh | 2 +- ci/scripts/run-test-network-sbe.sh | 2 +- ci/scripts/run-test-network-secured.sh | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ci/azure-pipelines.yml b/ci/azure-pipelines.yml index 5d314a8f..b9695eea 100644 --- a/ci/azure-pipelines.yml +++ b/ci/azure-pipelines.yml @@ -7,7 +7,7 @@ trigger: - release-1.4 variables: - FABRIC_VERSION: 2.2 + FABRIC_VERSION: 2.3 GO_BIN: $(Build.Repository.LocalPath)/bin GO_VER: 1.14.6 NODE_VER: 12.x diff --git a/ci/scripts/pullFabricImages.sh b/ci/scripts/pullFabricImages.sh index 38cb8e2d..ec31fa62 100755 --- a/ci/scripts/pullFabricImages.sh +++ b/ci/scripts/pullFabricImages.sh @@ -1,7 +1,7 @@ #!/bin/bash -e set -euo pipefail -FABRIC_VERSION=${FABRIC_VERSION:-2.2} +FABRIC_VERSION=${FABRIC_VERSION:-2.3} STABLE_TAG=amd64-${FABRIC_VERSION}-stable for image in baseos peer orderer ca tools orderer ccenv javaenv nodeenv tools; do diff --git a/ci/scripts/run-test-network-basic.sh b/ci/scripts/run-test-network-basic.sh index 6cda2083..a55f5460 100755 --- a/ci/scripts/run-test-network-basic.sh +++ b/ci/scripts/run-test-network-basic.sh @@ -1,6 +1,6 @@ set -euo pipefail -FABRIC_VERSION=${FABRIC_VERSION:-2.2} +FABRIC_VERSION=${FABRIC_VERSION:-2.3} CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go} CHAINCODE_NAME=${CHAINCODE_NAME:-basic} CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-basic} diff --git a/ci/scripts/run-test-network-events.sh b/ci/scripts/run-test-network-events.sh index 770f0238..8afc3c6a 100755 --- a/ci/scripts/run-test-network-events.sh +++ b/ci/scripts/run-test-network-events.sh @@ -1,6 +1,6 @@ set -euo pipefail -FABRIC_VERSION=${FABRIC_VERSION:-2.2} +FABRIC_VERSION=${FABRIC_VERSION:-2.3} CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-javascript} CHAINCODE_NAME=${CHAINCODE_NAME:-events} CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-events} diff --git a/ci/scripts/run-test-network-ledger.sh b/ci/scripts/run-test-network-ledger.sh index 6546833d..6065c077 100755 --- a/ci/scripts/run-test-network-ledger.sh +++ b/ci/scripts/run-test-network-ledger.sh @@ -1,6 +1,6 @@ set -euo pipefail -FABRIC_VERSION=${FABRIC_VERSION:-2.2} +FABRIC_VERSION=${FABRIC_VERSION:-2.3} CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go} CHAINCODE_NAME=${CHAINCODE_NAME:-ledger} CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-ledger-queries} diff --git a/ci/scripts/run-test-network-private.sh b/ci/scripts/run-test-network-private.sh index 19dff1ab..d40ab90a 100755 --- a/ci/scripts/run-test-network-private.sh +++ b/ci/scripts/run-test-network-private.sh @@ -1,6 +1,6 @@ set -euo pipefail -FABRIC_VERSION=${FABRIC_VERSION:-2.2} +FABRIC_VERSION=${FABRIC_VERSION:-2.3} CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go} CHAINCODE_NAME=${CHAINCODE_NAME:-private} CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-private-data} diff --git a/ci/scripts/run-test-network-sbe.sh b/ci/scripts/run-test-network-sbe.sh index c5ccfec1..c4b6014f 100755 --- a/ci/scripts/run-test-network-sbe.sh +++ b/ci/scripts/run-test-network-sbe.sh @@ -1,6 +1,6 @@ set -euo pipefail -FABRIC_VERSION=${FABRIC_VERSION:-2.2} +FABRIC_VERSION=${FABRIC_VERSION:-2.3} CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-typescript} CHAINCODE_NAME=${CHAINCODE_NAME:-sbe} CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-sbe} diff --git a/ci/scripts/run-test-network-secured.sh b/ci/scripts/run-test-network-secured.sh index 6fb6a84d..f2c68188 100755 --- a/ci/scripts/run-test-network-secured.sh +++ b/ci/scripts/run-test-network-secured.sh @@ -1,6 +1,6 @@ set -euo pipefail -FABRIC_VERSION=${FABRIC_VERSION:-2.2} +FABRIC_VERSION=${FABRIC_VERSION:-2.3} CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go} CHAINCODE_NAME=${CHAINCODE_NAME:-secured} CHAINCODE_PATH=${CHAINCODE_PATH:-../asset-transfer-secured-agreement} From aa7287e1e38d99cf305b53443b8239b82e1371f9 Mon Sep 17 00:00:00 2001 From: Julian Castrence Date: Fri, 8 Jan 2021 18:37:54 -0500 Subject: [PATCH 3/3] Update Test Network to Use osadmin FAB-18369 Signed-off-by: Julian Castrence --- test-network/configtx/configtx.yaml | 12 +---- .../docker/docker-compose-test-net.yaml | 11 +++- test-network/network.sh | 51 ++++--------------- test-network/scripts/createChannel.sh | 16 +++--- test-network/scripts/envVar.sh | 2 + 5 files changed, 34 insertions(+), 58 deletions(-) diff --git a/test-network/configtx/configtx.yaml b/test-network/configtx/configtx.yaml index 77db240f..8d7e48e6 100644 --- a/test-network/configtx/configtx.yaml +++ b/test-network/configtx/configtx.yaml @@ -301,7 +301,7 @@ Channel: &ChannelDefaults ################################################################################ Profiles: - TwoOrgsOrdererGenesis: + TwoOrgsApplicationGenesis: <<: *ChannelDefaults Orderer: <<: *OrdererDefaults @@ -309,18 +309,10 @@ Profiles: - *OrdererOrg Capabilities: <<: *OrdererCapabilities - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - - *Org2 - TwoOrgsChannel: - Consortium: SampleConsortium - <<: *ChannelDefaults Application: <<: *ApplicationDefaults Organizations: - *Org1 - *Org2 Capabilities: - <<: *ApplicationCapabilities + <<: *ApplicationCapabilities \ No newline at end of file diff --git a/test-network/docker/docker-compose-test-net.yaml b/test-network/docker/docker-compose-test-net.yaml index 71acf7fa..c8b3d66d 100644 --- a/test-network/docker/docker-compose-test-net.yaml +++ b/test-network/docker/docker-compose-test-net.yaml @@ -22,8 +22,6 @@ services: - FABRIC_LOGGING_SPEC=INFO - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7050 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp # enabled TLS @@ -36,6 +34,14 @@ services: - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 working_dir: /opt/gopath/src/github.com/hyperledger/fabric command: orderer volumes: @@ -45,6 +51,7 @@ services: - orderer.example.com:/var/hyperledger/production/orderer ports: - 7050:7050 + - 7053:7053 networks: - test diff --git a/test-network/network.sh b/test-network/network.sh index 0768cd66..9217104b 100755 --- a/test-network/network.sh +++ b/test-network/network.sh @@ -120,7 +120,7 @@ function checkPrereqs() { # directory. Cryptogen uses the files to generate the crypto material for each # org in the "organizations" directory. -# You can also Fabric CAs to generate the crypto material. CAs sign the certificates +# You can also use Fabric CAs to generate the crypto material. CAs sign the certificates # and keys that they generate to create a valid root of trust for each organization. # The script uses Docker Compose to bring up three CAs, one for each peer organization # and the ordering organization. The configuration file for creating the Fabric CA @@ -211,23 +211,17 @@ function createOrgs() { } # Once you create the organization crypto material, you need to create the -# genesis block of the orderer system channel. This block is required to bring -# up any orderer nodes and create any application channels. +# genesis block of the application channel. # The configtxgen tool is used to create the genesis block. Configtxgen consumes a # "configtx.yaml" file that contains the definitions for the sample network. The -# genesis block is defined using the "TwoOrgsOrdererGenesis" profile at the bottom -# of the file. This profile defines a sample consortium, "SampleConsortium", -# consisting of our two Peer Orgs. This consortium defines which organizations are -# recognized as members of the network. The peer and ordering organizations are defined -# in the "Profiles" section at the top of the file. As part of each organization -# profile, the file points to a the location of the MSP directory for each member. -# This MSP is used to create the channel MSP that defines the root of trust for -# each organization. In essence, the channel MSP allows the nodes and users to be -# recognized as network members. The file also specifies the anchor peers for each -# peer org. In future steps, this same file is used to create the channel creation -# transaction and the anchor peer updates. -# +# genesis block is defined using the "TwoOrgsApplicationGenesis" profile at the bottom +# of the file. This profile defines an application channel consisting of our two Peer Orgs. +# The peer and ordering organizations are defined in the "Profiles" section at the +# top of the file. As part of each organization profile, the file points to the +# location of the MSP directory for each member. This MSP is used to create the channel +# MSP that defines the root of trust for each organization. In essence, the channel +# MSP allows the nodes and users to be recognized as network members. # # If you receive the following warning, it can be safely ignored: # @@ -236,27 +230,7 @@ function createOrgs() { # You can ignore the logs regarding intermediate certs, we are not using them in # this crypto implementation. -# Generate orderer system channel genesis block. -function createConsortium() { - which configtxgen - if [ "$?" -ne 0 ]; then - fatalln "configtxgen tool not found." - fi - - infoln "Generating Orderer Genesis block" - - # Note: For some unknown reason (at least for now) the block file can't be - # named orderer.genesis.block or the orderer will fail to launch! - set -x - configtxgen -profile TwoOrgsOrdererGenesis -channelID system-channel -outputBlock ./system-genesis-block/genesis.block - res=$? - { set +x; } 2>/dev/null - if [ $res -ne 0 ]; then - fatalln "Failed to generate orderer genesis block..." - fi -} - -# After we create the org crypto material and the system channel genesis block, +# After we create the org crypto material and the application channel genesis block, # we can now bring up the peers and ordering service. By default, the base # file for creating the network is "docker-compose-test-net.yaml" in the ``docker`` # folder. This file defines the environment variables and file mounts that @@ -268,7 +242,6 @@ function networkUp() { # generate artifacts if they don't exist if [ ! -d "organizations/peerOrganizations" ]; then createOrgs - createConsortium fi COMPOSE_FILES="-f ${COMPOSE_FILE_BASE}" @@ -296,9 +269,7 @@ function createChannel() { fi # now run the script that creates a channel. This script uses configtxgen once - # more to create the channel creation transaction and the anchor peer updates. - # configtx.yaml is mounted in the cli container, which allows us to use it to - # create the channel artifacts + # to create the channel creation transaction and the anchor peer updates. scripts/createChannel.sh $CHANNEL_NAME $CLI_DELAY $MAX_RETRY $VERBOSE } diff --git a/test-network/scripts/createChannel.sh b/test-network/scripts/createChannel.sh index 567155cb..9ee2740b 100755 --- a/test-network/scripts/createChannel.sh +++ b/test-network/scripts/createChannel.sh @@ -17,9 +17,13 @@ if [ ! -d "channel-artifacts" ]; then mkdir channel-artifacts fi -createChannelTx() { +createChannelGenesisBlock() { + which configtxgen + if [ "$?" -ne 0 ]; then + fatalln "configtxgen tool not found." + fi set -x - configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/${CHANNEL_NAME}.tx -channelID $CHANNEL_NAME + configtxgen -profile TwoOrgsApplicationGenesis -outputBlock ./channel-artifacts/${CHANNEL_NAME}.block -channelID $CHANNEL_NAME res=$? { set +x; } 2>/dev/null verifyResult $res "Failed to generate channel configuration transaction..." @@ -33,7 +37,7 @@ createChannel() { while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ] ; do sleep $DELAY set -x - peer channel create -o localhost:7050 -c $CHANNEL_NAME --ordererTLSHostnameOverride orderer.example.com -f ./channel-artifacts/${CHANNEL_NAME}.tx --outputBlock $BLOCKFILE --tls --cafile $ORDERER_CA >&log.txt + osnadmin channel join --channel-id $CHANNEL_NAME --config-block ./channel-artifacts/${CHANNEL_NAME}.block -o localhost:7053 --ca-file $ORDERER_CA --client-cert $ORDERER_ADMIN_TLS_SIGN_CERT --client-key $ORDERER_ADMIN_TLS_PRIVATE_KEY >&log.txt res=$? { set +x; } 2>/dev/null let rc=$res @@ -71,9 +75,9 @@ setAnchorPeer() { FABRIC_CFG_PATH=${PWD}/configtx -## Create channeltx -infoln "Generating channel create transaction '${CHANNEL_NAME}.tx'" -createChannelTx +## Create channel genesis block +infoln "Generating channel genesis block '${CHANNEL_NAME}.block'" +createChannelGenesisBlock FABRIC_CFG_PATH=$PWD/../config/ BLOCKFILE="./channel-artifacts/${CHANNEL_NAME}.block" diff --git a/test-network/scripts/envVar.sh b/test-network/scripts/envVar.sh index 4ac40c07..978754ef 100755 --- a/test-network/scripts/envVar.sh +++ b/test-network/scripts/envVar.sh @@ -15,6 +15,8 @@ export ORDERER_CA=${PWD}/organizations/ordererOrganizations/example.com/orderers export PEER0_ORG1_CA=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt export PEER0_ORG2_CA=${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt export PEER0_ORG3_CA=${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt +export ORDERER_ADMIN_TLS_SIGN_CERT=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt +export ORDERER_ADMIN_TLS_PRIVATE_KEY=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key # Set environment variables for the peer org setGlobals() {