mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-26 03:25:09 +00:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
585d0d4a0b
15 changed files with 42 additions and 110 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue