diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index f6eda5a0..1f908cc7 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -169,3 +169,55 @@ jobs: path: | e2e-network/docker/test-04-snapshot.sh.logs/* e2e-network/docker/test-04-snapshot.sh.tmpdir/fablo-target/**/* + + test-05-v3: + needs: test-main + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - name: Build Fablo + run: | + shellcheck --version && \ + yamllint -v && \ + npm install && \ + ./fablo-build.sh + + - name: Test version 3 + run: e2e-network/docker/test-05-version3.sh + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: test-05-version3 + path: | + e2e-network/docker/test-05-version3-snapshot.sh.logs/* + e2e-network/docker/test-05-version3-snapshot.sh.tmpdir/fablo-target/**/* + + test-05-v3-BFT: + needs: test-main + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - name: Build Fablo + run: | + shellcheck --version && \ + yamllint -v && \ + npm install && \ + ./fablo-build.sh + + - name: Test version 3 with BFT + run: e2e-network/docker/test-05-version3-BFT.sh + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: test-05-version3-BFT-snapshot + path: | + e2e-network/docker/test-05-version3-BFT-snapshot.sh.logs/* + e2e-network/docker/test-05-version3-BFT-snapshot.sh.tmpdir/fablo-target/**/* + + diff --git a/.gitignore b/.gitignore index ef408c5a..4dd24541 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ fablo-target generators node_modules .idea +samples/invalid-fablo-config.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 81b56ebb..5c00d166 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.1.0 + +### Features +* Support Fabric 3.0.0-beta, along with BFT consensus + [#501](https://github.com/hyperledger-labs/fablo/pull/501) + ## 2.0.0 ### Breaking changes diff --git a/docs/schema.json b/docs/schema.json index fd598100..2f411465 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -224,7 +224,8 @@ "description": "The 'solo' consensus type may be used in development environment only. Use 'raft' in production.", "enum": [ "solo", - "raft" + "raft", + "BFT" ] }, "instances": { diff --git a/e2e-network/TEST_CASES.md b/e2e-network/TEST_CASES.md index 247a98de..9e364a13 100644 --- a/e2e-network/TEST_CASES.md +++ b/e2e-network/TEST_CASES.md @@ -1,22 +1,22 @@ # Test cases -| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | -| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:| -| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | -| TLS | no | yes | no | yes | -| Channel capabilities | v2 | v2 | v2_5 | v2 | -| Consensus | solo | RAFT | solo | RAFT | -| Orderer nodes | 1 | 3 | 1 | 1 | -| Organizations | 1 | 2 | 2 | 1 | -| CA database | SQLite | SQLite | SQLite | Postgres | -| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | -| Peer count | 2 | 2, 2 | 2, 1 | 2 | -| Channels | 1 | 2 | 1 | 1 | -| Node chaincode | yes | yes | yes | yes | -| Node chaincode upgrade | no | yes | no | no | -| Node chaincode endorsement| OR | OR | OR, AND | default | -| Private data | no | no | yes | yes | -| Java chaincode | no | yes | no | no | -| Go chaincode | no | no | no | no | -| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | -| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | +| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | test-05-version3 | test-05-version3-BFT | +| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:|:------------------:|:---------------------:| +| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | 3.0.0-beta | 3.0.0-beta | +| TLS | no | yes | no | yes | yes | yes | +| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | v3_0 | +| Consensus | solo | RAFT | solo | RAFT | RAFT | BFT | +| Orderer nodes | 1 | 3 | 1 | 1 | 3 | 4 | +| Organizations | 1 | 2 | 2 | 1 | 1 | 1 | +| CA database | SQLite | SQLite | SQLite | Postgres | SQLite | SQLite | +| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | LevelDB | LevelDB | +| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | 2 | +| Channels | 1 | 2 | 1 | 1 | 1 | 1 | +| Node chaincode | yes | yes | yes | yes | yes | yes | +| Node chaincode upgrade | no | yes | no | no | no | no | +| Node chaincode endorsement| OR | OR | OR, AND | default | OR | OR | +| Private data | no | no | yes | yes | no | no | +| Java chaincode | no | yes | no | no | no | no | +| Go chaincode | no | no | no | no | no | no | +| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | - | - | +| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh new file mode 100755 index 00000000..42d3b575 --- /dev/null +++ b/e2e-network/docker/test-05-version3-BFT.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +set -eu + +TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" +TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" +FABLO_HOME="$TEST_TMP/../../.." + +export FABLO_HOME + +CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json" + +networkUp() { + "$FABLO_HOME/fablo-build.sh" + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) +} + +dumpLogs() { + echo "Saving logs of $1 to $TEST_LOGS/$1.log" + mkdir -p "$TEST_LOGS" + docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 +} + +networkDown() { + rm -rf "$TEST_LOGS" + (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) + dumpLogs orderer0.group1.orderer.example.com + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) +} + +waitForContainer() { + sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" +} + +waitForChaincode() { + (cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") +} + +expectInvoke() { + (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "") +} + +expectCommand() { + sh "$TEST_TMP/../expect-command.sh" "$1" "$2" +} + +trap networkDown EXIT +trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT + +# start the network +networkUp + +waitForContainer "orderer0.group1.orderer.example.com" "Channel created" +waitForContainer "orderer1.group1.orderer.example.com" "Channel created" +waitForContainer "orderer2.group1.orderer.example.com" "Channel created" +waitForContainer "orderer3.group1.orderer.example.com" "Channel created" +waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" +waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" +waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" +waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" + +# Test simple chaincode +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ + '{\"success\":\"OK\"}' +expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:get", "name"]}' \ + '{\"success\":\"Willy Wonka\"}' + +# Verify channel query scripts +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) +expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 3 my-channel1 org1 peer1 "another.block") +expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") +expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," + +expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":5" + +echo "🎉 Test passed! 🎉" \ No newline at end of file diff --git a/e2e-network/docker/test-05-version3.sh b/e2e-network/docker/test-05-version3.sh new file mode 100755 index 00000000..5f08f5cf --- /dev/null +++ b/e2e-network/docker/test-05-version3.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +set -eu + +TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" +TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" +FABLO_HOME="$TEST_TMP/../../.." + +export FABLO_HOME + +CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-1orgs-1chaincode.json" + +networkUp() { + "$FABLO_HOME/fablo-build.sh" + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) +} + +dumpLogs() { + echo "Saving logs of $1 to $TEST_LOGS/$1.log" + mkdir -p "$TEST_LOGS" + docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 +} + +networkDown() { + rm -rf "$TEST_LOGS" + (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) + dumpLogs orderer0.group1.orderer.example.com + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) +} + +waitForContainer() { + sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" +} + +waitForChaincode() { + (cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") +} + +expectInvoke() { + (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "") +} + +expectCommand() { + sh "$TEST_TMP/../expect-command.sh" "$1" "$2" +} + +trap networkDown EXIT +trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT + +# start the network +networkUp + +waitForContainer "orderer0.group1.orderer.example.com" "Starting raft node as part of a new channel channel=my-channel1" +waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" +waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" +waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" +waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" + +# Test simple chaincode +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ + '{\"success\":\"OK\"}' +expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:get", "name"]}' \ + '{\"success\":\"Willy Wonka\"}' + +# Verify channel query scripts +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) +expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 3 my-channel1 org1 peer1 "another.block") +expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") +expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," + +expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":5" + +echo "🎉 Test passed! 🎉" \ No newline at end of file diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index a926ccf3..0473ec54 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -103,6 +103,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -114,6 +115,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -126,6 +128,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -139,6 +142,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -435,6 +439,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -446,6 +451,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -458,6 +464,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -471,6 +478,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -586,6 +594,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5.9", "fabricVersion": "2.5.9", "monitoring": { "loglevel": "info", @@ -603,6 +612,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -623,6 +633,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -634,6 +645,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -646,6 +658,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -692,6 +705,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -704,6 +718,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -914,6 +929,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -925,6 +941,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -937,6 +954,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -950,6 +968,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1246,6 +1265,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1257,6 +1277,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1269,6 +1290,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1282,6 +1304,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1397,6 +1420,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "fabricJavaenvVersion": "2.4", "fabricNodeenvVersion": "2.4", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.4.7", "fabricVersion": "2.4.7", "monitoring": { "loglevel": "info", @@ -1414,6 +1438,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1434,6 +1459,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1445,6 +1471,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1457,6 +1484,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1503,6 +1531,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1515,6 +1544,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1720,6 +1750,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1731,6 +1762,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1743,6 +1775,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1756,6 +1789,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2037,6 +2071,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2048,6 +2083,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2060,6 +2096,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2073,6 +2110,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2183,6 +2221,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "fabricJavaenvVersion": "2.3", "fabricNodeenvVersion": "2.3", "fabricRecommendedNodeVersion": "12", + "fabricToolsVersion": "2.3.3", "fabricVersion": "2.3.3", "monitoring": { "loglevel": "info", @@ -2205,6 +2244,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2225,6 +2265,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2236,6 +2277,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2248,6 +2290,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2294,6 +2337,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2306,6 +2350,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2511,6 +2556,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2522,6 +2568,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2534,6 +2581,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2547,6 +2595,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2915,6 +2964,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2926,6 +2976,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2938,6 +2989,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2951,6 +3003,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3320,6 +3373,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3331,6 +3385,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3343,6 +3398,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3356,6 +3412,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3534,6 +3591,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "fabricJavaenvVersion": "2.4", "fabricNodeenvVersion": "2.4", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.4.7", "fabricVersion": "2.4.7", "monitoring": { "loglevel": "info", @@ -3551,6 +3609,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3571,6 +3630,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3582,6 +3642,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3594,6 +3655,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3640,6 +3702,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3652,6 +3715,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3930,6 +3994,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -3941,6 +4006,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -3953,6 +4019,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -3963,6 +4030,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -3973,6 +4041,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -3986,6 +4055,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4371,6 +4441,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4382,6 +4453,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4394,6 +4466,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4404,6 +4477,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -4414,6 +4488,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -4427,6 +4502,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4813,6 +4889,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4824,6 +4901,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4836,6 +4914,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4846,6 +4925,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -4856,6 +4936,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -4869,6 +4950,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5152,6 +5234,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5163,6 +5246,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5175,6 +5259,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5185,6 +5270,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -5195,6 +5281,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -5208,6 +5295,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5503,6 +5591,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group2", "ordererHead": { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5514,6 +5603,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5526,6 +5616,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5539,6 +5630,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5758,6 +5850,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "fabricJavaenvVersion": "2.4", "fabricNodeenvVersion": "2.4", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.4.3", "fabricVersion": "2.4.3", "monitoring": { "loglevel": "debug", @@ -5775,6 +5868,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5785,6 +5879,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5805,6 +5900,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5816,6 +5912,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5828,6 +5925,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5838,6 +5936,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -5848,6 +5947,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -5869,6 +5969,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group2", "ordererHead": { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5880,6 +5981,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5892,6 +5994,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5938,6 +6041,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5950,6 +6054,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5960,6 +6065,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -5970,6 +6076,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -6019,6 +6126,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -6031,6 +6139,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -6316,6 +6425,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6328,6 +6438,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6338,6 +6449,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6393,6 +6505,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6404,6 +6517,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6414,6 +6528,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6424,6 +6539,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -6434,6 +6550,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -6446,6 +6563,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6456,6 +6574,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -6466,6 +6585,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6476,6 +6596,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6486,6 +6607,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -6496,6 +6618,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -6506,6 +6629,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -6516,6 +6640,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -6529,6 +6654,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6607,6 +6733,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6619,6 +6746,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6629,6 +6757,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6745,6 +6874,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6757,6 +6887,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6767,6 +6898,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6886,6 +7018,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6898,6 +7031,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6908,6 +7042,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6963,6 +7098,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6974,6 +7110,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6984,6 +7121,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6994,6 +7132,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7004,6 +7143,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7016,6 +7156,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7026,6 +7167,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -7036,6 +7178,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7046,6 +7189,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7056,6 +7200,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7066,6 +7211,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7076,6 +7222,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7086,6 +7233,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -7099,6 +7247,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7177,6 +7326,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7189,6 +7339,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7199,6 +7350,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7313,6 +7465,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7325,6 +7478,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7335,6 +7489,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7390,6 +7545,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7401,6 +7557,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7411,6 +7568,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7421,6 +7579,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7431,6 +7590,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7443,6 +7603,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7453,6 +7614,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -7463,6 +7625,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7473,6 +7636,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7483,6 +7647,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7493,6 +7658,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7503,6 +7669,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7513,6 +7680,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -7526,6 +7694,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7604,6 +7773,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7616,6 +7786,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7626,6 +7797,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7740,6 +7912,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7752,6 +7925,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7762,6 +7936,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7817,6 +7992,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7828,6 +8004,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7838,6 +8015,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7848,6 +8026,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7858,6 +8037,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7870,6 +8050,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7880,6 +8061,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -7890,6 +8072,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7900,6 +8083,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7910,6 +8094,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7920,6 +8105,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7930,6 +8116,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7940,6 +8127,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -7953,6 +8141,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8031,6 +8220,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8043,6 +8233,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8053,6 +8244,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -8163,6 +8355,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8175,6 +8368,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8185,6 +8379,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -8245,6 +8440,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "fabricJavaenvVersion": "2.3", "fabricNodeenvVersion": "2.3", "fabricRecommendedNodeVersion": "12", + "fabricToolsVersion": "2.3.2", "fabricVersion": "2.3.2", "monitoring": { "loglevel": "info", @@ -8267,6 +8463,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8277,6 +8474,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8287,6 +8485,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8297,6 +8496,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8320,6 +8520,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8331,6 +8532,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8341,6 +8543,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8351,6 +8554,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8361,6 +8565,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8373,6 +8578,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8383,6 +8589,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -8393,6 +8600,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8403,6 +8611,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -8413,6 +8622,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8423,6 +8633,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -8433,6 +8644,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8443,6 +8655,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -8489,6 +8702,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8501,6 +8715,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8511,6 +8726,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -8596,6 +8812,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8608,6 +8825,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8618,6 +8836,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -8728,6 +8947,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8740,6 +8960,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8750,6 +8971,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -8860,6 +9082,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8872,6 +9095,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8882,6 +9106,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -8927,6 +9152,1922 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. } `; +exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +{ + "chaincodes": [ + { + "channel": { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], + "profileName": "MyChannel1", + }, + "directory": "./chaincodes/chaincode-kv-node", + "endorsement": "AND ('Org1MSP.member')", + "init": "{"Args":[]}", + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "lang": "node", + "name": "chaincode1", + "privateData": [], + "privateDataConfigFile": undefined, + "version": "0.0.1", + }, + ], + "channels": [ + { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], + "profileName": "MyChannel1", + }, + ], + "global": { + "capabilities": { + "application": "V2_5", + "channel": "V3_0", + "isV2": false, + "isV3": true, + "orderer": "V2_0", + }, + "engine": "docker", + "fabricBaseosVersion": "3.0.0-beta", + "fabricCaVersion": "1.5.5", + "fabricCcenvVersion": "3.0.0-beta", + "fabricJavaenvVersion": "2.5", + "fabricNodeenvVersion": "2.5", + "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "3.0.0-beta", + "fabricVersion": "3.0.0-beta", + "monitoring": { + "loglevel": "debug", + }, + "paths": { + "chaincodesBaseDir": "", + "fabloConfig": "", + }, + "tls": true, + "tools": {}, + }, + "hooks": { + "postGenerate": "", + }, + "orderedHeadsDistinct": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "orgs": [ + { + "anchorPeers": [], + "bootstrapPeers": """", + "ca": { + "address": "ca.orderer.example.com", + "caAdminNameVar": "ORDERER_CA_ADMIN_NAME", + "caAdminPassVar": "ORDERER_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7020, + "fullAddress": "ca.orderer.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.orderer.example.com", + }, + "cryptoConfigFileName": "crypto-config-orderer", + "domain": "orderer.example.com", + "headPeer": undefined, + "mspName": "OrdererMSP", + "name": "Orderer", + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "peers": [], + "peersCount": 0, + "tools": {}, + }, + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], +} +`; + +exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +{ + "chaincodes": [ + { + "channel": { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "BFT", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], + "profileName": "MyChannel1", + }, + "directory": "./chaincodes/chaincode-kv-node", + "endorsement": "AND ('Org1MSP.member')", + "init": "{"Args":[]}", + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "lang": "node", + "name": "chaincode1", + "privateData": [], + "privateDataConfigFile": undefined, + "version": "0.0.1", + }, + ], + "channels": [ + { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "BFT", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], + "profileName": "MyChannel1", + }, + ], + "global": { + "capabilities": { + "application": "V2_5", + "channel": "V3_0", + "isV2": false, + "isV3": true, + "orderer": "V2_0", + }, + "engine": "docker", + "fabricBaseosVersion": "3.0.0-beta", + "fabricCaVersion": "1.5.5", + "fabricCcenvVersion": "3.0.0-beta", + "fabricJavaenvVersion": "2.5", + "fabricNodeenvVersion": "2.5", + "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "3.0.0-beta", + "fabricVersion": "3.0.0-beta", + "monitoring": { + "loglevel": "debug", + }, + "paths": { + "chaincodesBaseDir": "", + "fabloConfig": "", + }, + "tls": true, + "tools": {}, + }, + "hooks": { + "postGenerate": "", + }, + "orderedHeadsDistinct": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "BFT", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "orgs": [ + { + "anchorPeers": [], + "bootstrapPeers": """", + "ca": { + "address": "ca.orderer.example.com", + "caAdminNameVar": "ORDERER_CA_ADMIN_NAME", + "caAdminPassVar": "ORDERER_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7020, + "fullAddress": "ca.orderer.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.orderer.example.com", + }, + "cryptoConfigFileName": "crypto-config-orderer", + "domain": "orderer.example.com", + "headPeer": undefined, + "mspName": "OrdererMSP", + "name": "Orderer", + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "BFT", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "peers": [], + "peersCount": 0, + "tools": {}, + }, + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], +} +`; + exports[`extend config samples/invalid-fablo-config.json 1`] = ` { "chaincodes": [ @@ -9025,6 +11166,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9036,6 +11178,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9048,6 +11191,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9061,6 +11205,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9342,6 +11487,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9353,6 +11499,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9365,6 +11512,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9378,6 +11526,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9488,6 +11637,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "fabricJavaenvVersion": "2.3", "fabricNodeenvVersion": "2.3", "fabricRecommendedNodeVersion": "12", + "fabricToolsVersion": "2.3.3", "fabricVersion": "2.3.3", "monitoring": { "loglevel": "info", @@ -9510,6 +11660,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9530,6 +11681,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9541,6 +11693,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9553,6 +11706,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9599,6 +11753,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9611,6 +11766,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index e86497d7..21b4d641 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1539,6 +1539,7 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info FABRIC_VERSION=2.3.3 +FABRIC_TOOLS_VERSION=2.3.3 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.3 @@ -1699,8 +1700,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group1" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { @@ -1815,6 +1817,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -1823,6 +1826,7 @@ notifyOrgsAboutChannels() { printHeadline "Deleting new channel config blocks" "U1F52A" deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" + } printStartSuccessInfo() { @@ -1860,9 +1864,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: @@ -1889,7 +1891,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -1927,22 +1929,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -2000,7 +2003,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2069,6 +2072,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2193,7 +2197,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2229,7 +2233,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2262,12 +2266,12 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -2275,13 +2279,15 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -2297,18 +2303,18 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -3047,11 +3053,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3065,7 +3069,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block @@ -3074,7 +3077,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -3110,11 +3112,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3135,7 +3135,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index b207f8f5..4e9b88f9 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -117,6 +117,7 @@ Orderer: &Group1Defaults OrdererType: solo Addresses: - orderer0.group1.orderer.example.com:7030 + BatchTimeout: 2s BatchSize: MaxMessageCount: 10 @@ -1449,6 +1450,7 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info FABRIC_VERSION=2.5.9 +FABRIC_TOOLS_VERSION=2.5.9 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.5.9 @@ -1649,8 +1651,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group1" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { @@ -1668,7 +1671,7 @@ installChannels() { printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoin 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoin 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" } @@ -1770,6 +1773,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -1778,6 +1782,7 @@ notifyOrgsAboutChannels() { printHeadline "Deleting new channel config blocks" "U1F52A" deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" + } printStartSuccessInfo() { @@ -1823,9 +1828,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: @@ -1851,7 +1854,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -1881,11 +1884,14 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -1919,7 +1925,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -1959,6 +1965,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2002,6 +2009,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2057,7 +2065,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2093,7 +2101,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2126,12 +2134,12 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -2139,13 +2147,15 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -2161,18 +2171,18 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -2911,11 +2921,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -2929,7 +2937,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block @@ -2938,7 +2945,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -2974,11 +2980,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -2999,7 +3003,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 33bc82dc..f6cf5a4f 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -168,6 +168,7 @@ Orderer: &Group1Defaults OrdererType: solo Addresses: - orderer0.group1.orderer.example.com:7030 + BatchTimeout: 2s BatchSize: MaxMessageCount: 10 @@ -2110,6 +2111,7 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info FABRIC_VERSION=2.4.7 +FABRIC_TOOLS_VERSION=2.4.7 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.7 @@ -2364,8 +2366,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group1" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { @@ -2383,9 +2386,9 @@ installChannels() { printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoin 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoin 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org2/peer0" "U1F638" + printItalics "Joining 'my-channel1' on Org2/peer0" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoin 'my-channel1' 'Org2MSP' 'peer0.org2.example.com:7061' 'crypto/users/Admin@org2.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" } @@ -2563,6 +2566,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" createNewChannelUpdateTx "my-channel1" "Org2MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -2574,6 +2578,7 @@ notifyOrgsAboutChannels() { printHeadline "Deleting new channel config blocks" "U1F52A" deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" deleteNewChannelUpdateTx "my-channel1" "Org2MSP" "cli.org2.example.com" + } printStartSuccessInfo() { @@ -2651,9 +2656,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: @@ -2679,7 +2682,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2712,11 +2715,14 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -2750,7 +2756,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2793,6 +2799,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2836,6 +2843,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2885,7 +2893,7 @@ services: cli.org2.example.com: container_name: cli.org2.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2928,6 +2936,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2983,7 +2992,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -3019,7 +3028,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -3052,12 +3061,12 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -3065,13 +3074,15 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -3087,18 +3098,18 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -3837,11 +3848,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3855,7 +3864,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block @@ -3864,7 +3872,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -3900,11 +3907,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3925,7 +3930,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 1f2d6803..48ec3246 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -214,6 +214,7 @@ Orderer: &Group2Defaults OrdererType: solo Addresses: - orderer0.group2.orderer2.com:7050 + BatchTimeout: 2s BatchSize: MaxMessageCount: 1 @@ -3033,6 +3034,7 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=2.4.3 +FABRIC_TOOLS_VERSION=2.4.3 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.3 @@ -3474,8 +3476,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group2" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group2Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { @@ -3497,21 +3500,21 @@ installChannels() { printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7061' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" - printItalics "Joining 'my-channel1' on Org2/peer0" "U1F638" + printItalics "Joining 'my-channel1' on Org2/peer0" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org2MSP' 'peer0.org2.example.com:7081' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" printHeadline "Creating 'my-channel2' on Org1/peer1" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel2' 'Org1MSP' 'peer1.org1.example.com:7062' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" - printItalics "Joining 'my-channel2' on Org2/peer1" "U1F638" + printItalics "Joining 'my-channel2' on Org2/peer1" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel2' 'Org2MSP' 'peer1.org2.example.com:7082' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" printHeadline "Creating 'my-channel3' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel3' 'Org1MSP' 'peer0.org1.example.com:7061' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer2.com-cert.pem' 'orderer0.group2.orderer2.com:7050';" - printItalics "Joining 'my-channel3' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel3' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org1MSP' 'peer1.org1.example.com:7062' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer2.com-cert.pem' 'orderer0.group2.orderer2.com:7050';" - printItalics "Joining 'my-channel3' on Org2/peer0" "U1F638" + printItalics "Joining 'my-channel3' on Org2/peer0" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org2MSP' 'peer0.org2.example.com:7081' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer2.com-cert.pem' 'orderer0.group2.orderer2.com:7050';" - printItalics "Joining 'my-channel3' on Org2/peer1" "U1F638" + printItalics "Joining 'my-channel3' on Org2/peer1" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org2MSP' 'peer1.org2.example.com:7082' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer2.com-cert.pem' 'orderer0.group2.orderer2.com:7050';" } @@ -3683,6 +3686,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" createNewChannelUpdateTx "my-channel1" "Org2MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -3706,6 +3710,7 @@ notifyOrgsAboutChannels() { deleteNewChannelUpdateTx "my-channel2" "Org2MSP" "cli.org2.example.com" deleteNewChannelUpdateTx "my-channel3" "Org1MSP" "cli.org1.example.com" deleteNewChannelUpdateTx "my-channel3" "Org2MSP" "cli.org2.example.com" + } printStartSuccessInfo() { @@ -3767,9 +3772,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: @@ -3796,7 +3799,7 @@ services: cli.orderer1.com: container_name: cli.orderer1.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -3839,22 +3842,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Orderer1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer1.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer1.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -3874,22 +3878,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7031 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Orderer1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer1.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer1.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -3909,22 +3914,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7032 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Orderer1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer1.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer1.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -3959,7 +3965,7 @@ services: cli.orderer2.com: container_name: cli.orderer2.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4002,22 +4008,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7050 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group2Genesis.block - ORDERER_GENERAL_LOCALMSPID=Orderer2MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group2.orderer2.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group2Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group2.orderer2.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4052,7 +4059,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4126,6 +4133,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4174,6 +4182,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4229,7 +4238,7 @@ services: cli.org2.example.com: container_name: cli.org2.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4282,6 +4291,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4330,6 +4340,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4390,7 +4401,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -4426,7 +4437,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -4459,12 +4470,12 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -4472,13 +4483,15 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -4494,18 +4507,18 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -5244,11 +5257,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -5262,7 +5273,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block @@ -5271,7 +5281,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -5307,11 +5316,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -5332,7 +5339,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index f6e7b7d2..7069bba2 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3329,6 +3329,7 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info FABRIC_VERSION=2.3.2 +FABRIC_TOOLS_VERSION=2.3.2 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.2 @@ -3813,8 +3814,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group1" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { @@ -3836,21 +3838,21 @@ installChannels() { printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" printHeadline "Creating 'my-channel2' on Org2/peer0" "U1F63B" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel2' 'Org2MSP' 'peer0.org2.example.com:7061' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel2' on Org2/peer1" "U1F638" + printItalics "Joining 'my-channel2' on Org2/peer1" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel2' 'Org2MSP' 'peer1.org2.example.com:7062' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" printHeadline "Creating 'my-channel3' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel3' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel3' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel3' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel3' on Org2/peer0" "U1F638" + printItalics "Joining 'my-channel3' on Org2/peer0" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org2MSP' 'peer0.org2.example.com:7061' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel3' on Org2/peer1" "U1F638" + printItalics "Joining 'my-channel3' on Org2/peer1" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org2MSP' 'peer1.org2.example.com:7062' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" } @@ -3952,6 +3954,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" createNewChannelUpdateTx "my-channel2" "Org2MSP" "MyChannel2" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -3969,6 +3972,7 @@ notifyOrgsAboutChannels() { deleteNewChannelUpdateTx "my-channel2" "Org2MSP" "cli.org2.example.com" deleteNewChannelUpdateTx "my-channel3" "Org1MSP" "cli.org1.example.com" deleteNewChannelUpdateTx "my-channel3" "Org2MSP" "cli.org2.example.com" + } printStartSuccessInfo() { @@ -4014,9 +4018,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: @@ -4043,7 +4045,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4089,22 +4091,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4124,22 +4127,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7031 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4174,7 +4178,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4221,22 +4225,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7050 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org1.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org1.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4256,22 +4261,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7051 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org1.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org1.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4300,6 +4306,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4346,6 +4353,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4399,7 +4407,7 @@ services: cli.org2.example.com: container_name: cli.org2.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4446,22 +4454,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7070 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org2MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org2.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org2.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4481,22 +4490,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7071 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org2MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org2.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org2.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4525,6 +4535,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4571,6 +4582,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4624,7 +4636,7 @@ services: cli.org3.example.com: container_name: cli.org3.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4671,22 +4683,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7090 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org3MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org3.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org3.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4706,22 +4719,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7091 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org3MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org3.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org3.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4750,6 +4764,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4796,6 +4811,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4897,7 +4913,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -4933,7 +4949,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -4966,12 +4982,12 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -4979,13 +4995,15 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -5001,18 +5019,18 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -5751,11 +5769,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -5769,7 +5785,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block @@ -5778,7 +5793,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -5814,11 +5828,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -5839,7 +5851,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap new file mode 100644 index 00000000..014e80fe --- /dev/null +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -0,0 +1,3433 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"/config +/crypto-config +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"################################################################################ +# SECTION: Capabilities +################################################################################ +Capabilities: + Channel: &ChannelCapabilities + V3_0: true + Orderer: &OrdererCapabilities + V2_0: true + Application: &ApplicationCapabilities + V2_5: true + +################################################################################ +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + + - Host: peer1.org1.example.com + Port: 7042 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: etcdraft + Addresses: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 + EtcdRaft: + Consenters: + - Host: orderer0.group1.orderer.example.com + Port: 7030 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + - Host: orderer1.group1.orderer.example.com + Port: 7031 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + + - Host: orderer2.group1.orderer.example.com + Port: 7032 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + + - Host: orderer3.group1.orderer.example.com + Port: 7033 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 10 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + 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" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Consortium: SampleConsortium + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"{ + "name": "fablo-test-network-orderer", + "description": "Connection profile for Orderer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Orderer" + }, + "organizations": { + "Orderer": { + "mspid": "OrdererMSP", + "peers": [ + "peer0.org1.example.com", + "peer1.org1.example.com" + ], + "certificateAuthorities": [ + "ca.orderer.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.orderer.example.com": { + "url": "https://localhost:7020", + "caName": "ca.orderer.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"name: fablo-test-network-orderer +description: Connection profile for Orderer in Fablo network +version: 1.0.0 +client: + organization: Orderer +organizations: + Orderer: + mspid: OrdererMSP + peers: + - peer0.org1.example.com + - peer1.org1.example.com + certificateAuthorities: + - ca.orderer.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com +certificateAuthorities: + ca.orderer.example.com: + url: https://localhost:7020 + caName: ca.orderer.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Org1 in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1" + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "peers": [ + "peer0.org1.example.com", + "peer1.org1.example.com" + ], + "certificateAuthorities": [ + "ca.org1.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org1.example.com": { + "url": "https://localhost:7040", + "caName": "ca.org1.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"name: fablo-test-network-org1 +description: Connection profile for Org1 in Fablo network +version: 1.0.0 +client: + organization: Org1 +organizations: + Org1: + mspid: Org1MSP + peers: + - peer0.org1.example.com + - peer1.org1.example.com + certificateAuthorities: + - ca.org1.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com +certificateAuthorities: + ca.org1.example.com: + url: https://localhost:7040 + caName: ca.org1.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + - Hostname: orderer1.group1 + - Hostname: orderer2.group1 + - Hostname: orderer3.group1 + Template: + Count: 0 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"PeerOrgs: + - Name: Org1 + Domain: org1.example.com + Specs: + Template: + Count: 2 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + orderer: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + notifyOrgsAboutChannels + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "\${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "\${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"FABLO_VERSION=2.0.0 +FABLO_BUILD= +FABLO_REST_VERSION=0.1.2 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 + +COUCHDB_VERSION=3.1 +FABRIC_COUCHDB_VERSION=0.4.18 + +FABLO_CONFIG= +CHAINCODES_BASE_DIR= + +COMPOSE_PROJECT_NAME= +LOGGING_LEVEL=debug + +FABRIC_VERSION=3.0.0-beta +FABRIC_TOOLS_VERSION=3.0.0-beta +FABRIC_CA_VERSION=1.5.5 +FABRIC_CA_POSTGRES_VERSION=14 +FABRIC_CCENV_VERSION=3.0.0-beta +FABRIC_BASEOS_VERSION=3.0.0-beta +FABRIC_JAVAENV_VERSION=2.5 +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=16 + +ROOT_CA_ADMIN_NAME=admin +ROOT_CA_ADMIN_PASSWORD=adminpw + +ORDERER_CA_ADMIN_NAME=admin +ORDERER_CA_ADMIN_PASSWORD=adminpw + +ORG1_CA_ADMIN_NAME=admin +ORG1_CA_ADMIN_PASSWORD=adminpw + +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +chaincodeList() { + if [ "$#" -ne 2 ]; then + echo "Expected 2 parameters for chaincode list, but got: $*" + exit 1 + + elif [ "$1" = "peer0.org1.example.com" ]; then + + peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + elif + [ "$1" = "peer1.org1.example.com" ] + then + + peerChaincodeListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + else + + echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" + exit 1 + + fi +} + +# Function to perform chaincode invoke. Accepts 5 parameters: +# 1. comma-separated peers +# 2. channel name +# 3. chaincode name +# 4. chaincode command +# 5. transient data (optional) +chaincodeInvoke() { + if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then + echo "Expected 4 or 5 parameters for chaincode list, but got: $*" + echo "Usage: fablo chaincode invoke [transient]" + exit 1 + fi + cli="" + peer_addresses="" + + peer_certs="" + + if [[ "$1" == *"peer0.org1.example.com"* ]]; then + cli="cli.org1.example.com" + peer_addresses="$peer_addresses,peer0.org1.example.com:7041" + + peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" + + fi + if [[ "$1" == *"peer1.org1.example.com"* ]]; then + cli="cli.org1.example.com" + peer_addresses="$peer_addresses,peer1.org1.example.com:7042" + + peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" + + fi + if [ -z "$peer_addresses" ]; then + echo "Unknown peers: $1" + exit 1 + fi + + if [ "$2" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + + peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" + +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" + +set -eu + +channelQuery() { + echo "-> Channel query: " + "$@" + + if [ "$#" -eq 1 ]; then + printChannelsHelp + + elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then + + peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer1" ] + then + + peerChannelListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + elif + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer1" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + else + + echo "$@" + echo "$1, $2, $3, $4, $5, $6, $7, $#" + printChannelsHelp + fi + +} + +printChannelsHelp() { + echo "Channel management commands:" + echo "" + + echo "fablo channel list org1 peer0" + echo -e "\\t List channels on 'peer0' of 'Org1'". + echo "" + + echo "fablo channel list org1 peer1" + echo -e "\\t List channels on 'peer1' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer0" + echo -e "\\t Get channel info on 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer0 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer1" + echo -e "\\t Get channel info on 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer1 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer1 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +generateArtifacts() { + printHeadline "Generating basic configs" "U1F913" + + printItalics "Generating crypto material for Orderer" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating crypto material for Org1" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + # Create directories to avoid permission errors on linux + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +startNetwork() { + printHeadline "Starting network" "U1F680" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + sleep 4 +} + +generateChannelsArtifacts() { + printHeadline "Generating config for 'my-channel1'" "U1F913" + createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +installChannels() { + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer0.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer1.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer2.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer3.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + sleep 4 # Wait for Raft cluster to establish consensus + printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" + + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" +} + +installChaincodes() { + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + local version="0.0.1" + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + else + echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + +} + +installChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +runDevModeChaincode() { + echo "Running chaincode in dev mode is supported by Fablo only for V2 channel capabilities" + exit 1 +} + +upgradeChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +notifyOrgsAboutChannels() { + + echo "" + +} + +printStartSuccessInfo() { + printHeadline "Done! Enjoy your fresh network" "U1F984" +} + +stopNetwork() { + printHeadline "Stopping network" "U1F68F" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) + sleep 4 +} + +networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + + printf "Removing chaincode containers & images... \\U1F5D1 \\n" + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + + printf "Removing generated configs... \\U1F5D1 \\n" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + + printHeadline "Done! Network was purged" "U1F5D1" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - 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] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - 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 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer1.group1.orderer.example.com: + container_name: orderer1.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7031 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - 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] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - 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 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7031:7031 + - 8031:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer2.group1.orderer.example.com: + container_name: orderer2.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7032 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - 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] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - 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 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7032:7032 + - 8032:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer3.group1.orderer.example.com: + container_name: orderer3.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7033 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - 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] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - 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 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer3.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7033:7033 + - 8033:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + peer1.org1.example.com: + container_name: peer1.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer1.org1.example.com + - CORE_PEER_ADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_LISTENADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer1.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8042:9440 + - 7042:7042 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "\${dir}"/*_sk "\${dir}"/priv-key.pem + done +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME.pb" + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run --rm \\ + --name $CONTAINER_NAME \\ + -v "$CONFIG_PATH":/fabric-config \\ + -v "$OUTPUT_PATH":/output \\ + hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ + bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" + + # shellcheck disable=SC2181 + if [ $? -ne 0 ]; then + echo "Failed to create channel configuration transaction." + exit 1 + fi + + echo "Channel configuration created at $CHANNEL_TX_PATH" + +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.pb" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.pb" + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \\ + --configPath ./fabric-config \\ + -profile "\${CONFIG_PROFILE}" \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ + -channelID "\${CHANNEL_NAME}" \\ + -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"\${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" \\ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\\e[1m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +printItalics() { + italics=$'\\e[3m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +inputLog() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +inputLogShort() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +printHelp() { + echo "Fablo is powered by SoftwareMill" + + echo "" + echo "usage: ./fabric-docker.sh " + echo "" + + echo "Commands: " + echo "" + echo "./fabric-docker.sh up" + echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." + echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" + echo "" + echo "./fabric-docker.sh down" + echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." + echo "" + echo "./fabric-docker.sh start" + echo -e "\\t Starts already created network." + echo "" + echo "./fabric-docker.sh stop" + echo -e "\\t Stops already running network." + echo "" + echo "./fabric-docker.sh reset" + echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." + echo "" + echo "./fabric-docker.sh channel --help" + echo -e "\\t Detailed help for channel management scripts." + echo "" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash +# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. +# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u + +dockerPullIfMissing() { + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" + fi +} + +node_version_check() { + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + +chaincodeBuild() { + local CHAINCODE_NAME=$1 + local CHAINCODE_LANG=$2 + local CHAINCODE_DIR_PATH=$3 + local RECOMMENDED_NODE_VERSION=$4 + + mkdir -p "$CHAINCODE_DIR_PATH" + + # pull required images upfront in case of arm64 (Apple Silicon) architecture + # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "java" ]; then + dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "golang" ]; then + dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" + fi + fi + + if [ "$CHAINCODE_LANG" = "node" ]; then + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then + echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" + echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" + fi + + echo "Buiding chaincode '$CHAINCODE_NAME'..." + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" + inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" + + # Default to using npm for installation and build + (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + + fi +} + +chaincodePackage() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodeInstall() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CA_CERT=$5 + + echo "Installing chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA_CERT: $CA_CERT" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") + fi + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeApprove() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COLLECTIONS_CONFIG=\${10} + + echo "Approving chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYINSTALLED_RESPONSE + local CC_PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + if [ -z "$CC_PACKAGE_ID" ]; then + CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" + fi + inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --package-id "$CC_PACKAGE_ID" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeCommit() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COMMIT_PEER_ADDRESSES=\${10} + local TLS_ROOT_CERT_FILES=\${11} + local COLLECTIONS_CONFIG=\${12} + + echo "Committing chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" + inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local COMMIT_PEER_PARAMS=() + if [ -n "$COMMIT_PEER_ADDRESSES" ]; then + # shellcheck disable=SC2207 + COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) + fi + + local TLS_ROOT_CERT_PARAMS=() + if [ -n "$TLS_ROOT_CERT_FILES" ]; then + # shellcheck disable=SC2207 + TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ + "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +peerChaincodeList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + + # Execute the command to list chaincodes + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" +} + +peerChaincodeListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + local CA_CERT=$4 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CA_CERT: $CA_CERT" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" +} + +# Function to perform chaincode invoke +peerChaincodeInvoke() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + 2>&1 +} +# Function to perform chaincode invoke for Tls +peerChaincodeInvokeTls() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + local PEER_CERTS="$7" + local CA_CERT="$8" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + inputLog "PEER_CERTS: $PEER_CERTS" + inputLog "CA_CERT: $CA_CERT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + $TLS_ROOT_CERT_FILES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" \\ + 2>&1 +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +peerChannelList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list +} + +peerChannelGetInfo() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" +} + +peerChannelFetchConfig() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlock() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local TARGET_FILE="$5" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} + +#=== TLS equivalents ========================================================= + +peerChannelListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CA_CERT=$3 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" +} + +peerChannelGetInfoTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + local CA_CERT=$4 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" +} + +peerChannelFetchConfigTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + local CA_CERT=$5 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlockTls() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local CA_CERT="$5" + local TARGET_FILE="$6" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + + osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}" + cd .. && rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local ORDERER_MSP_NAME=$2 + local ORDERER_ADMIN_ADDRESS=$3 + local ADMIN_TLS_SIGN_CERT=$(realpath "$4") + local ADMIN_TLS_PRIVATE_KEY=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$ORDERER_MSP_NAME + + echo "Creating channel with name (TLS): \${CHANNEL_NAME}" + echo " ORDERER_MSP_NAME: $ORDERER_MSP_NAME" + echo " ORDERER_ADMIN_ADDRESS: $ORDERER_ADMIN_ADDRESS" + echo " ADMIN_TLS_SIGN_CERT: $ADMIN_TLS_SIGN_CERT" + echo " ADMIN_TLS_PRIVATE_KEY: $ADMIN_TLS_PRIVATE_KEY" + echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" + + if [ ! -d "$DIR_NAME" ]; then + mkdir -p "$DIR_NAME" + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" + fi + + osnadmin channel join \\ + --channelID "\${CHANNEL_NAME}" \\ + --config-block "$DIR_NAME/$CHANNEL_NAME.pb" \\ + -o "\${ORDERER_ADMIN_ADDRESS}" \\ + --client-cert "\${ADMIN_TLS_SIGN_CERT}" \\ + --client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\ + --ca-file "\${TLS_CA_CERT_PATH}" + + cd .. + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" + peer channel join -b "\${CHANNEL_NAME}"_newest.block + + cd .. && rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + cd .. && rm -rf "$DIR_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +__getOrdererAndPeerNodes() { + echo " + orderer0.group1.orderer.example.com + orderer1.group1.orderer.example.com + orderer2.group1.orderer.example.com + orderer3.group1.orderer.example.com + peer0.org1.example.com + peer1.org1.example.com + " +} + +__getCASQLiteNodes() { + echo " + ca.orderer.example.com + ca.org1.example.com + " +} + +__getCAPostgresNodes() { + echo " + " +} + +__createSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" + + if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then + echo "Error: Directory '$backup_dir' already exists and is not empty!" + exit 1 + fi + + mkdir -p "$backup_dir" + cp -R ./fablo-target "$backup_dir/" + + for node in $(__getCASQLiteNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node" + docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" + done + + for node in $(__getCAPostgresNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node/pg-data" + docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Saving state of $node..." + docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" + done +} + +__cloneSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + target_dir="$1" + hook_cmd="$2" + + if [ -d "$target_dir/fablo-target" ]; then + echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." + exit 1 + fi + + cp -R ./fablo-target "$target_dir/fablo-target" + + if [ -n "$hook_cmd" ]; then + echo "Executing pre-restore hook: '$hook_cmd'" + (cd "$target_dir" && eval "$hook_cmd") + fi + + (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) + + for node in $(__getCASQLiteNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" + fi + done + + for node in $(__getCAPostgresNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" + fi + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/" "$node:/var/hyperledger/production/" + fi + done +} + +createSnapshot() { + (set -eu && __createSnapshot "$1") +} + +cloneSnapshot() { + (set -eu && __cloneSnapshot "$1" "$2") +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +# The code from this file was called after Fablo generated Hyperledger Fabric configuration +echo "Executing post-generate hook" +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +[ + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", +] +`; diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap new file mode 100644 index 00000000..1509993f --- /dev/null +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -0,0 +1,3458 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"/config +/crypto-config +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"################################################################################ +# SECTION: Capabilities +################################################################################ +Capabilities: + Channel: &ChannelCapabilities + V3_0: true + Orderer: &OrdererCapabilities + V2_0: true + Application: &ApplicationCapabilities + V2_5: true + +################################################################################ +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + + - Host: peer1.org1.example.com + Port: 7042 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: BFT + Addresses: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 + + SmartBFT: + RequestBatchMaxCount: 100 + RequestBatchMaxInterval: 50ms + RequestForwardTimeout: 2s + RequestComplainTimeout: 20s + RequestAutoRemoveTimeout: 3m0s + ViewChangeResendInterval: 5s + ViewChangeTimeout: 20s + LeaderHeartbeatTimeout: 1m0s + CollectTimeout: 1s + RequestBatchMaxBytes: 10485760 + IncomingMessageBufferSize: 200 + RequestPoolSize: 100000 + LeaderHeartbeatCount: 10 + ConsenterMapping: + - ID: 1 + Host: orderer0.group1.orderer.example.com + Port: 7030 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/signcerts/orderer0.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + - ID: 2 + Host: orderer1.group1.orderer.example.com + Port: 7031 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/signcerts/orderer1.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + + - ID: 3 + Host: orderer2.group1.orderer.example.com + Port: 7032 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/signcerts/orderer2.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + + - ID: 4 + Host: orderer3.group1.orderer.example.com + Port: 7033 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/signcerts/orderer3.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 10 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + 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" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Consortium: SampleConsortium + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"{ + "name": "fablo-test-network-orderer", + "description": "Connection profile for Orderer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Orderer" + }, + "organizations": { + "Orderer": { + "mspid": "OrdererMSP", + "peers": [ + "peer0.org1.example.com", + "peer1.org1.example.com" + ], + "certificateAuthorities": [ + "ca.orderer.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.orderer.example.com": { + "url": "https://localhost:7020", + "caName": "ca.orderer.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"name: fablo-test-network-orderer +description: Connection profile for Orderer in Fablo network +version: 1.0.0 +client: + organization: Orderer +organizations: + Orderer: + mspid: OrdererMSP + peers: + - peer0.org1.example.com + - peer1.org1.example.com + certificateAuthorities: + - ca.orderer.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com +certificateAuthorities: + ca.orderer.example.com: + url: https://localhost:7020 + caName: ca.orderer.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Org1 in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1" + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "peers": [ + "peer0.org1.example.com", + "peer1.org1.example.com" + ], + "certificateAuthorities": [ + "ca.org1.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org1.example.com": { + "url": "https://localhost:7040", + "caName": "ca.org1.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"name: fablo-test-network-org1 +description: Connection profile for Org1 in Fablo network +version: 1.0.0 +client: + organization: Org1 +organizations: + Org1: + mspid: Org1MSP + peers: + - peer0.org1.example.com + - peer1.org1.example.com + certificateAuthorities: + - ca.org1.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com +certificateAuthorities: + ca.org1.example.com: + url: https://localhost:7040 + caName: ca.org1.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + - Hostname: orderer1.group1 + - Hostname: orderer2.group1 + - Hostname: orderer3.group1 + Template: + Count: 0 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"PeerOrgs: + - Name: Org1 + Domain: org1.example.com + Specs: + Template: + Count: 2 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + orderer: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + notifyOrgsAboutChannels + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "\${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "\${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"FABLO_VERSION=2.0.0 +FABLO_BUILD= +FABLO_REST_VERSION=0.1.2 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 + +COUCHDB_VERSION=3.1 +FABRIC_COUCHDB_VERSION=0.4.18 + +FABLO_CONFIG= +CHAINCODES_BASE_DIR= + +COMPOSE_PROJECT_NAME= +LOGGING_LEVEL=debug + +FABRIC_VERSION=3.0.0-beta +FABRIC_TOOLS_VERSION=3.0.0-beta +FABRIC_CA_VERSION=1.5.5 +FABRIC_CA_POSTGRES_VERSION=14 +FABRIC_CCENV_VERSION=3.0.0-beta +FABRIC_BASEOS_VERSION=3.0.0-beta +FABRIC_JAVAENV_VERSION=2.5 +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=16 + +ROOT_CA_ADMIN_NAME=admin +ROOT_CA_ADMIN_PASSWORD=adminpw + +ORDERER_CA_ADMIN_NAME=admin +ORDERER_CA_ADMIN_PASSWORD=adminpw + +ORG1_CA_ADMIN_NAME=admin +ORG1_CA_ADMIN_PASSWORD=adminpw + +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +chaincodeList() { + if [ "$#" -ne 2 ]; then + echo "Expected 2 parameters for chaincode list, but got: $*" + exit 1 + + elif [ "$1" = "peer0.org1.example.com" ]; then + + peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + elif + [ "$1" = "peer1.org1.example.com" ] + then + + peerChaincodeListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + else + + echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" + exit 1 + + fi +} + +# Function to perform chaincode invoke. Accepts 5 parameters: +# 1. comma-separated peers +# 2. channel name +# 3. chaincode name +# 4. chaincode command +# 5. transient data (optional) +chaincodeInvoke() { + if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then + echo "Expected 4 or 5 parameters for chaincode list, but got: $*" + echo "Usage: fablo chaincode invoke [transient]" + exit 1 + fi + cli="" + peer_addresses="" + + peer_certs="" + + if [[ "$1" == *"peer0.org1.example.com"* ]]; then + cli="cli.org1.example.com" + peer_addresses="$peer_addresses,peer0.org1.example.com:7041" + + peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" + + fi + if [[ "$1" == *"peer1.org1.example.com"* ]]; then + cli="cli.org1.example.com" + peer_addresses="$peer_addresses,peer1.org1.example.com:7042" + + peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" + + fi + if [ -z "$peer_addresses" ]; then + echo "Unknown peers: $1" + exit 1 + fi + + if [ "$2" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + + peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" + +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" + +set -eu + +channelQuery() { + echo "-> Channel query: " + "$@" + + if [ "$#" -eq 1 ]; then + printChannelsHelp + + elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then + + peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer1" ] + then + + peerChannelListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + elif + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer1" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + else + + echo "$@" + echo "$1, $2, $3, $4, $5, $6, $7, $#" + printChannelsHelp + fi + +} + +printChannelsHelp() { + echo "Channel management commands:" + echo "" + + echo "fablo channel list org1 peer0" + echo -e "\\t List channels on 'peer0' of 'Org1'". + echo "" + + echo "fablo channel list org1 peer1" + echo -e "\\t List channels on 'peer1' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer0" + echo -e "\\t Get channel info on 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer0 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer1" + echo -e "\\t Get channel info on 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer1 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer1 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +generateArtifacts() { + printHeadline "Generating basic configs" "U1F913" + + printItalics "Generating crypto material for Orderer" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating crypto material for Org1" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + # Create directories to avoid permission errors on linux + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +startNetwork() { + printHeadline "Starting network" "U1F680" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + sleep 4 +} + +generateChannelsArtifacts() { + printHeadline "Generating config for 'my-channel1'" "U1F913" + createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +installChannels() { + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer0.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer1.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer2.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer3.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" + + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" +} + +installChaincodes() { + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + local version="0.0.1" + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + else + echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + +} + +installChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +runDevModeChaincode() { + echo "Running chaincode in dev mode is supported by Fablo only for V2 channel capabilities" + exit 1 +} + +upgradeChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +notifyOrgsAboutChannels() { + + echo "" + +} + +printStartSuccessInfo() { + printHeadline "Done! Enjoy your fresh network" "U1F984" +} + +stopNetwork() { + printHeadline "Stopping network" "U1F68F" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) + sleep 4 +} + +networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + + printf "Removing chaincode containers & images... \\U1F5D1 \\n" + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + + printf "Removing generated configs... \\U1F5D1 \\n" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + + printHeadline "Done! Network was purged" "U1F5D1" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - 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] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - 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 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer1.group1.orderer.example.com: + container_name: orderer1.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7031 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - 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] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - 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 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7031:7031 + - 8031:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer2.group1.orderer.example.com: + container_name: orderer2.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7032 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - 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] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - 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 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7032:7032 + - 8032:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer3.group1.orderer.example.com: + container_name: orderer3.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7033 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - 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] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - 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 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer3.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7033:7033 + - 8033:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + peer1.org1.example.com: + container_name: peer1.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer1.org1.example.com + - CORE_PEER_ADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_LISTENADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer1.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8042:9440 + - 7042:7042 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "\${dir}"/*_sk "\${dir}"/priv-key.pem + done +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME.pb" + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run --rm \\ + --name $CONTAINER_NAME \\ + -v "$CONFIG_PATH":/fabric-config \\ + -v "$OUTPUT_PATH":/output \\ + hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ + bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" + + # shellcheck disable=SC2181 + if [ $? -ne 0 ]; then + echo "Failed to create channel configuration transaction." + exit 1 + fi + + echo "Channel configuration created at $CHANNEL_TX_PATH" + +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.pb" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.pb" + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \\ + --configPath ./fabric-config \\ + -profile "\${CONFIG_PROFILE}" \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ + -channelID "\${CHANNEL_NAME}" \\ + -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"\${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" \\ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\\e[1m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +printItalics() { + italics=$'\\e[3m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +inputLog() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +inputLogShort() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +printHelp() { + echo "Fablo is powered by SoftwareMill" + + echo "" + echo "usage: ./fabric-docker.sh " + echo "" + + echo "Commands: " + echo "" + echo "./fabric-docker.sh up" + echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." + echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" + echo "" + echo "./fabric-docker.sh down" + echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." + echo "" + echo "./fabric-docker.sh start" + echo -e "\\t Starts already created network." + echo "" + echo "./fabric-docker.sh stop" + echo -e "\\t Stops already running network." + echo "" + echo "./fabric-docker.sh reset" + echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." + echo "" + echo "./fabric-docker.sh channel --help" + echo -e "\\t Detailed help for channel management scripts." + echo "" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash +# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. +# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u + +dockerPullIfMissing() { + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" + fi +} + +node_version_check() { + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + +chaincodeBuild() { + local CHAINCODE_NAME=$1 + local CHAINCODE_LANG=$2 + local CHAINCODE_DIR_PATH=$3 + local RECOMMENDED_NODE_VERSION=$4 + + mkdir -p "$CHAINCODE_DIR_PATH" + + # pull required images upfront in case of arm64 (Apple Silicon) architecture + # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "java" ]; then + dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "golang" ]; then + dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" + fi + fi + + if [ "$CHAINCODE_LANG" = "node" ]; then + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then + echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" + echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" + fi + + echo "Buiding chaincode '$CHAINCODE_NAME'..." + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" + inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" + + # Default to using npm for installation and build + (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + + fi +} + +chaincodePackage() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodeInstall() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CA_CERT=$5 + + echo "Installing chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA_CERT: $CA_CERT" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") + fi + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeApprove() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COLLECTIONS_CONFIG=\${10} + + echo "Approving chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYINSTALLED_RESPONSE + local CC_PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + if [ -z "$CC_PACKAGE_ID" ]; then + CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" + fi + inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --package-id "$CC_PACKAGE_ID" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeCommit() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COMMIT_PEER_ADDRESSES=\${10} + local TLS_ROOT_CERT_FILES=\${11} + local COLLECTIONS_CONFIG=\${12} + + echo "Committing chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" + inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local COMMIT_PEER_PARAMS=() + if [ -n "$COMMIT_PEER_ADDRESSES" ]; then + # shellcheck disable=SC2207 + COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) + fi + + local TLS_ROOT_CERT_PARAMS=() + if [ -n "$TLS_ROOT_CERT_FILES" ]; then + # shellcheck disable=SC2207 + TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ + "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +peerChaincodeList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + + # Execute the command to list chaincodes + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" +} + +peerChaincodeListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + local CA_CERT=$4 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CA_CERT: $CA_CERT" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" +} + +# Function to perform chaincode invoke +peerChaincodeInvoke() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + 2>&1 +} +# Function to perform chaincode invoke for Tls +peerChaincodeInvokeTls() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + local PEER_CERTS="$7" + local CA_CERT="$8" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + inputLog "PEER_CERTS: $PEER_CERTS" + inputLog "CA_CERT: $CA_CERT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + $TLS_ROOT_CERT_FILES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" \\ + 2>&1 +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +peerChannelList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list +} + +peerChannelGetInfo() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" +} + +peerChannelFetchConfig() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlock() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local TARGET_FILE="$5" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} + +#=== TLS equivalents ========================================================= + +peerChannelListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CA_CERT=$3 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" +} + +peerChannelGetInfoTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + local CA_CERT=$4 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" +} + +peerChannelFetchConfigTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + local CA_CERT=$5 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlockTls() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local CA_CERT="$5" + local TARGET_FILE="$6" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + + osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}" + cd .. && rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local ORDERER_MSP_NAME=$2 + local ORDERER_ADMIN_ADDRESS=$3 + local ADMIN_TLS_SIGN_CERT=$(realpath "$4") + local ADMIN_TLS_PRIVATE_KEY=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$ORDERER_MSP_NAME + + echo "Creating channel with name (TLS): \${CHANNEL_NAME}" + echo " ORDERER_MSP_NAME: $ORDERER_MSP_NAME" + echo " ORDERER_ADMIN_ADDRESS: $ORDERER_ADMIN_ADDRESS" + echo " ADMIN_TLS_SIGN_CERT: $ADMIN_TLS_SIGN_CERT" + echo " ADMIN_TLS_PRIVATE_KEY: $ADMIN_TLS_PRIVATE_KEY" + echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" + + if [ ! -d "$DIR_NAME" ]; then + mkdir -p "$DIR_NAME" + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" + fi + + osnadmin channel join \\ + --channelID "\${CHANNEL_NAME}" \\ + --config-block "$DIR_NAME/$CHANNEL_NAME.pb" \\ + -o "\${ORDERER_ADMIN_ADDRESS}" \\ + --client-cert "\${ADMIN_TLS_SIGN_CERT}" \\ + --client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\ + --ca-file "\${TLS_CA_CERT_PATH}" + + cd .. + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" + peer channel join -b "\${CHANNEL_NAME}"_newest.block + + cd .. && rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + cd .. && rm -rf "$DIR_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +__getOrdererAndPeerNodes() { + echo " + orderer0.group1.orderer.example.com + orderer1.group1.orderer.example.com + orderer2.group1.orderer.example.com + orderer3.group1.orderer.example.com + peer0.org1.example.com + peer1.org1.example.com + " +} + +__getCASQLiteNodes() { + echo " + ca.orderer.example.com + ca.org1.example.com + " +} + +__getCAPostgresNodes() { + echo " + " +} + +__createSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" + + if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then + echo "Error: Directory '$backup_dir' already exists and is not empty!" + exit 1 + fi + + mkdir -p "$backup_dir" + cp -R ./fablo-target "$backup_dir/" + + for node in $(__getCASQLiteNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node" + docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" + done + + for node in $(__getCAPostgresNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node/pg-data" + docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Saving state of $node..." + docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" + done +} + +__cloneSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + target_dir="$1" + hook_cmd="$2" + + if [ -d "$target_dir/fablo-target" ]; then + echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." + exit 1 + fi + + cp -R ./fablo-target "$target_dir/fablo-target" + + if [ -n "$hook_cmd" ]; then + echo "Executing pre-restore hook: '$hook_cmd'" + (cd "$target_dir" && eval "$hook_cmd") + fi + + (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) + + for node in $(__getCASQLiteNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" + fi + done + + for node in $(__getCAPostgresNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" + fi + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/" "$node:/var/hyperledger/production/" + fi + done +} + +createSnapshot() { + (set -eu && __createSnapshot "$1") +} + +cloneSnapshot() { + (set -eu && __cloneSnapshot "$1" "$2") +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +# The code from this file was called after Fablo generated Hyperledger Fabric configuration +echo "Executing post-generate hook" +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +[ + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", +] +`; diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 10cdeed9..c769e096 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -11,6 +11,7 @@ Validation warnings count: 0 "monitoring": { "loglevel": "debug" }, + "fabricToolsVersion": "2.4.3", "fabricCaVersion": "1.5.5", "fabricCcenvVersion": "2.4.3", "fabricBaseosVersion": "2.4.3", @@ -49,6 +50,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -59,6 +61,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -69,6 +72,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -81,6 +85,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -92,6 +97,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -113,6 +119,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -125,6 +132,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -136,6 +144,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -149,6 +158,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -159,6 +169,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -204,6 +215,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -214,6 +226,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -224,6 +237,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -236,6 +250,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -284,6 +299,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -296,6 +312,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -686,6 +703,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -696,6 +714,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -706,6 +725,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -718,6 +738,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -729,6 +750,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -740,6 +762,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -1025,6 +1048,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -1035,6 +1059,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -1045,6 +1070,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -1057,6 +1083,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -1068,6 +1095,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -1079,6 +1107,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -1388,6 +1417,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -1400,6 +1430,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -1411,6 +1442,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -1422,6 +1454,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" }, @@ -1726,6 +1759,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -1736,6 +1770,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -1746,6 +1781,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -1758,6 +1794,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -1769,6 +1806,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -1780,6 +1818,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -2166,6 +2205,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -2176,6 +2216,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -2186,6 +2227,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -2198,6 +2240,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -2209,6 +2252,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -2220,6 +2264,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -2432,6 +2477,7 @@ Validation warnings count: 0 "tls": false, "engine": "docker", "peerDevMode": false, + "fabricToolsVersion": "2.5.9", "fabricCaVersion": "1.5.5", "fabricCcenvVersion": "2.5.9", "fabricBaseosVersion": "2.5.9", @@ -2472,6 +2518,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2484,6 +2531,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2495,6 +2543,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2508,6 +2557,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2553,6 +2603,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2565,6 +2616,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2771,6 +2823,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2783,6 +2836,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2794,6 +2848,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2805,6 +2860,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" }, diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index 6923640c..1613693a 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -420,6 +420,7 @@ exports[`schema should match snapshot 1`] = ` "enum": [ "solo", "raft", + "BFT", ], "title": "Orderer type", "type": "string", diff --git a/e2e/fablo-config-hlf3-1orgs-1chaincode.json.test.ts b/e2e/fablo-config-hlf3-1orgs-1chaincode.json.test.ts new file mode 100644 index 00000000..e67e776d --- /dev/null +++ b/e2e/fablo-config-hlf3-1orgs-1chaincode.json.test.ts @@ -0,0 +1,7 @@ +import performTests from "./performTests"; + +const config = "samples/fablo-config-hlf3-1orgs-1chaincode.json"; + +describe(config, () => { + performTests(config); +}); diff --git a/e2e/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts b/e2e/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts new file mode 100644 index 00000000..ccd6d764 --- /dev/null +++ b/e2e/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts @@ -0,0 +1,7 @@ +import performTests from "./performTests"; + +const config = "samples/fablo-config-hlf3-bft-1orgs-1chaincode.json"; + +describe(config, () => { + performTests(config); +}); diff --git a/package-lock.json b/package-lock.json index 9a76bbd9..41f0172b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "@typescript-eslint/eslint-plugin": "^4.22.0", "@typescript-eslint/parser": "^4.22.0", "copyfiles": "2.4.1", - "ejs-lint": "^1.2.0", + "ejs-lint": "^2.0.1", "eslint": "^7.24.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-prettier": "^8.2.0", @@ -4676,37 +4676,127 @@ "dev": true }, "node_modules/ejs-lint": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-1.2.2.tgz", - "integrity": "sha512-ESR/MePvJJJfkK3EUAYlPKe2JM2nRDc4uFkGgbB5Prr06nluN7JozNVFL3Ze7LV7xNY7JPWEi5H3i4hOl6mxXw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-2.0.1.tgz", + "integrity": "sha512-GrH+UuYaOlhS/cnCJEY5EANnFvWe6zyf0h6uOAKG2/EiG2Ch9S8vnX3CwAMP9Q1xlCagPNzwRDJG8MVCV4IJLg==", "dev": true, "dependencies": { - "chalk": "^4.0.0", - "ejs": "3.1.7", + "chalk": "^5.0.0", + "ejs": "3.1.10", "ejs-include-regex": "^1.0.0", - "globby": "^11.0.0", + "globby": "^13.0.0", "read-input": "^0.3.1", - "slash": "^3.0.0", + "slash": "^5.0.0", "syntax-error": "^1.1.6", - "yargs": "^16.0.0" + "yargs": "^17.0.0" }, "bin": { "ejslint": "cli.js" } }, - "node_modules/ejs-lint/node_modules/ejs": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz", - "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==", + "node_modules/ejs-lint/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ejs-lint/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", "dev": true, "dependencies": { - "jake": "^10.8.5" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" }, - "bin": { - "ejs": "bin/cli.js" + "engines": { + "node": ">=12" + } + }, + "node_modules/ejs-lint/node_modules/globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "dev": true, + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" }, "engines": { - "node": ">=0.10.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ejs-lint/node_modules/globby/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ejs-lint/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/ejs-lint/node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ejs-lint/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ejs-lint/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" } }, "node_modules/electron-to-chromium": { @@ -17996,29 +18086,91 @@ "dev": true }, "ejs-lint": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-1.2.2.tgz", - "integrity": "sha512-ESR/MePvJJJfkK3EUAYlPKe2JM2nRDc4uFkGgbB5Prr06nluN7JozNVFL3Ze7LV7xNY7JPWEi5H3i4hOl6mxXw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-2.0.1.tgz", + "integrity": "sha512-GrH+UuYaOlhS/cnCJEY5EANnFvWe6zyf0h6uOAKG2/EiG2Ch9S8vnX3CwAMP9Q1xlCagPNzwRDJG8MVCV4IJLg==", "dev": true, "requires": { - "chalk": "^4.0.0", - "ejs": "3.1.7", + "chalk": "^5.0.0", + "ejs": "3.1.10", "ejs-include-regex": "^1.0.0", - "globby": "^11.0.0", + "globby": "^13.0.0", "read-input": "^0.3.1", - "slash": "^3.0.0", + "slash": "^5.0.0", "syntax-error": "^1.1.6", - "yargs": "^16.0.0" + "yargs": "^17.0.0" }, "dependencies": { - "ejs": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz", - "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==", + "chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", "dev": true, "requires": { - "jake": "^10.8.5" + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "dependencies": { + "slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true + } } + }, + "ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true + }, + "slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "dev": true + }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true } } }, diff --git a/package.json b/package.json index b3f81f51..8450d227 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@typescript-eslint/eslint-plugin": "^4.22.0", "@typescript-eslint/parser": "^4.22.0", "copyfiles": "2.4.1", - "ejs-lint": "^1.2.0", + "ejs-lint": "^2.0.1", "eslint": "^7.24.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-prettier": "^8.2.0", diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json new file mode 100644 index 00000000..467c2920 --- /dev/null +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -0,0 +1,59 @@ +{ + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "global": { + "fabricVersion": "3.0.0-beta", + "tls": true, + "monitoring": { + "loglevel": "debug" + } + }, + "orgs": [ + { + "organization": { + "name": "Orderer", + "domain": "orderer.example.com" + }, + "orderers": [ + { + "groupName": "group1", + "type": "raft", + "instances": 4 + } + ] + }, + { + "organization": { + "name": "Org1", + "domain": "org1.example.com" + }, + "peer": { + "instances": 2, + "db": "LevelDb" + } + } + ], + "channels": [ + { + "name": "my-channel1", + "orgs": [ + { + "name": "Org1", + "peers": [ + "peer0", + "peer1" + ] + } + ] + } + ], + "chaincodes": [ + { + "name": "chaincode1", + "version": "0.0.1", + "lang": "node", + "channel": "my-channel1", + "directory": "./chaincodes/chaincode-kv-node" + } + ] + } + \ No newline at end of file diff --git a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json new file mode 100644 index 00000000..8f90718a --- /dev/null +++ b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json @@ -0,0 +1,60 @@ +{ + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "global": { + "fabricVersion": "3.0.0-beta", + "tls": true, + "monitoring": { + "loglevel": "debug" + } + }, + "orgs": [ + { + "organization": { + "name": "Orderer", + "domain": "orderer.example.com" + }, + "orderers": [ + { + "groupName": "group1", + "type": "BFT", + "instances": 4 + } + + ] + }, + { + "organization": { + "name": "Org1", + "domain": "org1.example.com" + }, + "peer": { + "instances": 2, + "db": "LevelDb" + } + } + ], + "channels": [ + { + "name": "my-channel1", + "orgs": [ + { + "name": "Org1", + "peers": [ + "peer0", + "peer1" + ] + } + ] + } + ], + "chaincodes": [ + { + "name": "chaincode1", + "version": "0.0.1", + "lang": "node", + "channel": "my-channel1", + "directory": "./chaincodes/chaincode-kv-node" + } + ] + } + \ No newline at end of file diff --git a/src/extend-config/extendGlobal.ts b/src/extend-config/extendGlobal.ts index 9cd63d37..0bd8abda 100644 --- a/src/extend-config/extendGlobal.ts +++ b/src/extend-config/extendGlobal.ts @@ -22,13 +22,18 @@ const getVersions = (fabricVersion: string): FabricVersions => { "2.4.1": "2.4.2", }; + const below3_0_0 = (v: string) => (v.startsWith("3.") ? "2.5" : v); + + const beta3_0_0 = (v: string) => (v.startsWith("3.0.") ? "3.0.0-beta" : v); + return { fabricVersion, + fabricToolsVersion: beta3_0_0(fabricVersion), fabricCaVersion: version(fabricVersion).isGreaterOrEqual("1.4.10") ? "1.5.5" : fabricVersion, fabricCcenvVersion: fabricVersion, fabricBaseosVersion: version(fabricVersion).isGreaterOrEqual("2.0") ? fabricVersion : "0.4.9", - fabricJavaenvVersion: majorMinor, - fabricNodeenvVersion: fabricNodeenvExceptions[fabricVersion] ?? majorMinor, + fabricJavaenvVersion: below3_0_0(majorMinor), + fabricNodeenvVersion: fabricNodeenvExceptions[fabricVersion] ?? below3_0_0(majorMinor), fabricRecommendedNodeVersion: version(fabricVersion).isGreaterOrEqual("2.4") ? "16" : "12", }; }; diff --git a/src/extend-config/extendOrgsConfig.ts b/src/extend-config/extendOrgsConfig.ts index 264aa911..c2661f20 100644 --- a/src/extend-config/extendOrgsConfig.ts +++ b/src/extend-config/extendOrgsConfig.ts @@ -61,6 +61,7 @@ const extendOrderersConfig = ( orgMspName, domain: ordererOrgDomainJson, consensus, + adminPort: 7053, port, fullAddress: `${address}:${port}`, }; diff --git a/src/repositoryUtils.test.ts b/src/repositoryUtils.test.ts index b50b6455..bbd7ba2f 100644 --- a/src/repositoryUtils.test.ts +++ b/src/repositoryUtils.test.ts @@ -19,5 +19,9 @@ describe("repositoryUtils", () => { expect(version("1.4.0").isGreaterOrEqual("1.4.1")).toBe(false); expect(version("1.4.0").isGreaterOrEqual("1.3.0")).toBe(true); expect(version("1.4.0").isGreaterOrEqual("2.1.0")).toBe(false); + expect(version("3.0.0").isGreaterOrEqual("3.0.0-beta")).toBe(true); + expect(version("3.0.0-beta").isGreaterOrEqual("3.0.0")).toBe(true); + expect(version("3.0.0").isGreaterOrEqual("3.0.0")).toBe(true); + expect(version("3.0.0").isGreaterOrEqual("3.0.1")).toBe(false); }); }); diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 560eb1e8..081ea489 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -216,17 +216,12 @@ export default class SetupDockerGenerator extends Generator { this.fs.copyTpl(this.templatePath("fabric-docker.sh"), this.destinationPath("fabric-docker.sh")); this.fs.copyTpl( - this.templatePath("fabric-docker/scripts/cli/channel_fns.sh"), + this.templatePath(`fabric-docker/scripts/cli/channel_fns-${capabilities.isV3 ? "v3" : "v2"}.sh`), this.destinationPath("fabric-docker/scripts/cli/channel_fns.sh"), ); this.fs.copyTpl( - this.templatePath("fabric-docker/scripts/cli/channel_fns.sh"), - this.destinationPath("fabric-docker/scripts/cli/channel_fns.sh"), - ); - - this.fs.copyTpl( - this.templatePath("fabric-docker/scripts/base-functions.sh"), + this.templatePath(`fabric-docker/scripts/base-functions-${capabilities.isV3 ? "v3" : "v2"}.sh`), this.destinationPath("fabric-docker/scripts/base-functions.sh"), ); @@ -241,7 +236,7 @@ export default class SetupDockerGenerator extends Generator { ); this.fs.copyTpl( - this.templatePath(`fabric-docker/scripts/chaincode-functions-${capabilities.isV2 ? "v2" : "v1.4"}.sh`), + this.templatePath(`fabric-docker/scripts/chaincode-functions-${capabilities.isV2 ? "v2" : "v2"}.sh`), this.destinationPath("fabric-docker/scripts/chaincode-functions.sh"), ); } diff --git a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs index 8f7ddc6f..73a4334f 100755 --- a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs +++ b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs @@ -6,3 +6,28 @@ ClientTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt ServerTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt <% })} -%> + +<% if (ordererGroup.consensus == "BFT") { %> + SmartBFT: + RequestBatchMaxCount: 100 + RequestBatchMaxInterval: 50ms + RequestForwardTimeout: 2s + RequestComplainTimeout: 20s + RequestAutoRemoveTimeout: 3m0s + ViewChangeResendInterval: 5s + ViewChangeTimeout: 20s + LeaderHeartbeatTimeout: 1m0s + CollectTimeout: 1s + RequestBatchMaxBytes: 10485760 + IncomingMessageBufferSize: 200 + RequestPoolSize: 100000 + LeaderHeartbeatCount: 10 + ConsenterMapping:<% ordererGroup.orderers.forEach(function(orderer, index) { %> + - ID: <%= index+1 %> + Host: <%= orderer.address %> + Port: <%= orderer.port %> + MSPID: <%= orderer.orgMspName %> + Identity: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/msp/signcerts/<%= orderer.address %>-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt +<% })} -%> diff --git a/src/setup-docker/templates/fabric-config/configtx.yaml b/src/setup-docker/templates/fabric-config/configtx.yaml index c3f81a43..95c5d4d0 100755 --- a/src/setup-docker/templates/fabric-config/configtx.yaml +++ b/src/setup-docker/templates/fabric-config/configtx.yaml @@ -158,19 +158,23 @@ Profiles: <%_ channel.ordererGroup.hostingOrgs.forEach(function(hostingOrg) { _%> - *<%= hostingOrg %> <%_ }) _%> + <%_ if (!global.capabilities.isV3) { _%> Capabilities: <<: *ApplicationCapabilities + <%_ } _%> Consortium: SampleConsortium + <%_ if (!global.capabilities.isV3) { _%> Consortiums: SampleConsortium: Organizations: <%_ channel.orgs.forEach(function(org){ _%> - *<%= org.name %> <%_ }) _%> + <%_ } _%> Application: <<: *ApplicationDefaults Organizations: <%_ channel.orgs.forEach(function(org){ _%> - *<%= org.name %> <%_ }) _%> - <%_ }) _%> + <%_ }) _%> \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/.env b/src/setup-docker/templates/fabric-docker/.env index 90880f6a..9cdbdae4 100755 --- a/src/setup-docker/templates/fabric-docker/.env +++ b/src/setup-docker/templates/fabric-docker/.env @@ -13,6 +13,7 @@ COMPOSE_PROJECT_NAME=<%= composeNetworkName %> LOGGING_LEVEL=<%= global.monitoring.loglevel %> FABRIC_VERSION=<%= global.fabricVersion %> +FABRIC_TOOLS_VERSION=<%= global.fabricToolsVersion %> FABRIC_CA_VERSION=<%= global.fabricCaVersion %> FABRIC_CA_POSTGRES_VERSION=<%= fabricCaPostgresVersion %> FABRIC_CCENV_VERSION=<%= global.fabricCcenvVersion %> diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 648f046d..b22588f2 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -13,12 +13,16 @@ generateArtifacts() { <% }) -%> <%_ ordererGroups.forEach((ordererGroup) => { _%> - printItalics "Generating genesis block for group <%= ordererGroup.name %>" "U1F3E0" - genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "<%= ordererGroup.profileName %>" + <% if(!global.capabilities.isV3) {%> + printItalics "Generating genesis block for group <%= ordererGroup.name %>" "U1F3E0" + genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "<%= ordererGroup.profileName %>" + <% } %> + <%_ }) _%> - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { @@ -41,13 +45,47 @@ generateChannelsArtifacts() { installChannels() { <% if (!channels || !channels.length) { -%> echo "No channels" + <% } else if (global.capabilities.isV3) { -%> + <% channels.forEach((channel) => { -%> + <% channel.ordererGroup.orderers.forEach((orderer) => { -%> + <% const org = orgs.find((org) => org.name === orderer.orgName); -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';" + <% }) -%> + <% if (channel.ordererGroup.consensus !== "BFT") { -%> + sleep 4 # Wait for Raft cluster to establish consensus + <% } -%> + <% channel.orgs.forEach((org, orgNo) => { -%> + <% org.peers.forEach((peer, peerNo) => { -%> + <% if (orgNo == 0 && peerNo == 0) { -%> + printHeadline "Creating '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F63B" + <% if (!global.tls) { -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" + <% } else { -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" + <% } %> + <% } else { -%> + printItalics "Joining '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F638" + <% if (!global.tls) { -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" + <% } else { -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" + <% } -%> + <% } -%> + <% }) -%> + <% }) -%> + <% }) -%> <% } else { -%> <% channels.forEach((channel) => { -%> <% channel.orgs.forEach((org, orgNo) => { -%> <% org.peers.forEach((peer, peerNo) => { -%> - <% if(orgNo == 0 && peerNo == 0) { -%> + <% if (orgNo == 0 && peerNo == 0) { -%> printHeadline "Creating '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F63B" - <% if(!global.tls) { -%> + <% if (!global.tls) { -%> docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; createChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" <% } else { -%> @@ -55,8 +93,8 @@ installChannels() { "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" <% } %> <% } else { -%> - printItalics "Joining '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F638" - <% if(!global.tls) { -%> + printItalics "Joining '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F638" + <% if (!global.tls) { -%> docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" <% } else { -%> @@ -76,13 +114,11 @@ installChaincodes() { <% } else { -%> <% chaincodes.forEach((chaincode) => { -%> if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then - <% if (global.capabilities.isV2) { -%> - <% if (global.peerDevMode) { -%> - <%- include('commands-generated/chaincode-dev-v2.sh', { chaincode }); -%> - <% } else { -%> - local version="<%= chaincode.version %>" - <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); -%> - <% } -%> + <% if (global.peerDevMode) { -%> + <%- include('commands-generated/chaincode-dev-v2.sh', { chaincode }); -%> + <% } else { -%> + local version="<%= chaincode.version %>" + <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); -%> <% } -%> else echo "Warning! Skipping chaincode '<%= chaincode.name %>' installation. Chaincode directory is empty." @@ -102,9 +138,7 @@ installChaincode() { <% chaincodes.forEach((chaincode) => { -%> if [ "$chaincodeName" = "<%= chaincode.name %>" ]; then if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then - <% if (global.capabilities.isV2) { -%> - <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); %> - <% } -%> + <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); %> else echo "Warning! Skipping chaincode '<%= chaincode.name %>' install. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/<%= chaincode.directory %>'" @@ -140,11 +174,7 @@ upgradeChaincode() { <% chaincodes.forEach((chaincode) => { -%> if [ "$chaincodeName" = "<%= chaincode.name %>" ]; then if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then - <% if (global.capabilities.isV2) { -%> - <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); %> - <% } else { -%> - <%- include('commands-generated/chaincode-upgrade-v2.sh', { chaincode, global }); %> - <% } -%> + <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); %> else echo "Warning! Skipping chaincode '<%= chaincode.name %>' upgrade. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/<%= chaincode.directory %>'" @@ -154,6 +184,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + <% if(!global.capabilities.isV3) { %> printHeadline "Creating new channel config blocks" "U1F537" <% channels.forEach((channel) => { -%> <% channel.orgs.forEach((org) => { -%> @@ -169,22 +200,22 @@ notifyOrgsAboutChannels() { printHeadline "Notyfing orgs about channels" "U1F4E2" <% channels.forEach((channel) => { -%> <% channel.orgs.forEach((org) => { -%> - <% if(!global.tls) { -%> - notifyOrgAboutNewChannel <% -%> + <% if(!global.tls) { -%> + notifyOrgAboutNewChannel <% -%> "<%= channel.name %>" <% -%> "<%= org.mspName %>" <% -%> "<%= org.cli.address %>" <% -%> "peer0.<%= org.domain %>" <% -%> "<%= channel.ordererHead.fullAddress %>" - <% } else { -%> - notifyOrgAboutNewChannelTls <% -%> + <% } else { -%> + notifyOrgAboutNewChannelTls <% -%> "<%= channel.name %>" <% -%> "<%= org.mspName %>" <% -%> "<%= org.cli.address %>" <% -%> "peer0.<%= org.domain %>" <% -%> "<%= channel.ordererHead.fullAddress %>" <% -%> "crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem" - <% } -%> + <% } -%> <% }) -%> <% }) %> @@ -194,6 +225,11 @@ notifyOrgsAboutChannels() { deleteNewChannelUpdateTx "<%= channel.name %>" "<%= org.mspName %>" "<%= org.cli.address %>" <% }) -%> <% }) -%> + + <% } else { %> + echo "" + <% } %> + } printStartSuccessInfo() { diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 2ec40b3d..9b6232f6 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -1,5 +1,3 @@ -version: '2.2' - networks: basic: @@ -58,7 +56,7 @@ services: <%= org.cli.address %>: container_name: <%= org.cli.address %> - image: hyperledger/fabric-tools:${FABRIC_VERSION} + image: hyperledger/fabric-tools:${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -188,28 +186,39 @@ services: - FABRIC_LOGGING_SPEC=${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=<%= orderer.port %> - - ORDERER_GENERAL_GENESISMETHOD=file - <%_ if(global.capabilities.isV2) { _%> - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> - <%_ } else { _%> - - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> - <%_ } _%> - - ORDERER_GENERAL_LOCALMSPID=<%= org.mspName %> + - ORDERER_GENERAL_LOCALMSPID=<%= orderer.orgMspName %> - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go <%_ if(global.tls) { _%> - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=<%= orderer.address %>:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - 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] <%_ } _%> + <%_ if(global.capabilities.isV2) { _%> + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> + <%_ } _%> + <%_ if(global.capabilities.isV3) { _%> + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - 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:<%= orderer.adminPort %> + <%_ } _%> + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=<%= orderer.address %>:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -242,6 +251,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=${LOGGING_LEVEL} diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh similarity index 92% rename from src/setup-docker/templates/fabric-docker/scripts/base-functions.sh rename to src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index e089bb32..fc2f02f6 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -22,7 +22,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -58,7 +58,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -91,12 +91,12 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -104,13 +104,15 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -126,18 +128,18 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME configtxgen \ --configPath ./fabric-config \ -profile "${CONFIG_PROFILE}" \ - -outputAnchorPeersUpdate ./config/"${MSP_NAME}"anchors.tx \ + -outputAnchorPeersUpdate "${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}"\ -channelID "${CHANNEL_NAME}" \ -asOrg "${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh new file mode 100644 index 00000000..da91a34b --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -0,0 +1,267 @@ +#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "${dir}"/*_sk "${dir}"/priv-key.pem + done +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME.pb" + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run --rm \ + --name $CONTAINER_NAME \ + -v "$CONFIG_PATH":/fabric-config \ + -v "$OUTPUT_PATH":/output \ + hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" \ + bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile ${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID ${CHANNEL_NAME}" + + # shellcheck disable=SC2181 + if [ $? -ne 0 ]; then + echo "Failed to create channel configuration transaction." + exit 1 + fi + + echo "Channel configuration created at $CHANNEL_TX_PATH" + +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.pb" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.pb" + + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \ + --configPath ./fabric-config \ + -profile "${CONFIG_PROFILE}" \ + -outputAnchorPeersUpdate "${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}"\ + -channelID "${CHANNEL_NAME}" \ + -asOrg "${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \ + "$CLI_NAME" peer channel update \ + -c "$CHANNEL_NAME" \ + -o "$ORDERER_URL" \ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \ + "$CLI_NAME" peer channel update \ + -c "$CHANNEL_NAME" \ + -o "$ORDERER_URL" \ + -f "$ANCHOR_PEER_UPDATE_PATH" \ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\e[1m' + end=$'\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "${bold}============ %b %s %b ==============${end}\n" "\\$EMOJI" "$TEXT" "\\$EMOJI" +} + +printItalics() { + italics=$'\e[3m' + end=$'\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "${italics}==== %b %s %b ====${end}\n" "\\$EMOJI" "$TEXT" "\\$EMOJI" +} + +inputLog() { + end=$'\e[0m' + darkGray=$'\e[90m' + + echo "${darkGray} $1 ${end}" +} + +inputLogShort() { + end=$'\e[0m' + darkGray=$'\e[90m' + + echo "${darkGray} $1 ${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh similarity index 99% rename from src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh rename to src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh index f96d6e4c..46da0021 100755 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh @@ -4,11 +4,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -22,7 +20,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "${CHANNEL_NAME}".block @@ -31,7 +28,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -56,22 +52,21 @@ createChannelAndJoinTls() { echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" mkdir "$DIR_NAME" && cd "$DIR_NAME" - + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" peer channel join -b "${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" + rm -rf "$DIR_NAME" } fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -92,7 +87,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh new file mode 100644 index 00000000..247e26e1 --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh @@ -0,0 +1,118 @@ +#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: ${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + + osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" + cd .. && rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local ORDERER_MSP_NAME=$2 + local ORDERER_ADMIN_ADDRESS=$3 + local ADMIN_TLS_SIGN_CERT=$(realpath "$4") + local ADMIN_TLS_PRIVATE_KEY=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$ORDERER_MSP_NAME + + echo "Creating channel with name (TLS): ${CHANNEL_NAME}" + echo " ORDERER_MSP_NAME: $ORDERER_MSP_NAME" + echo " ORDERER_ADMIN_ADDRESS: $ORDERER_ADMIN_ADDRESS" + echo " ADMIN_TLS_SIGN_CERT: $ADMIN_TLS_SIGN_CERT" + echo " ADMIN_TLS_PRIVATE_KEY: $ADMIN_TLS_PRIVATE_KEY" + echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" + + if [ ! -d "$DIR_NAME" ]; then + mkdir -p "$DIR_NAME" + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" + fi + + osnadmin channel join \ + --channelID "${CHANNEL_NAME}" \ + --config-block "$DIR_NAME/$CHANNEL_NAME.pb" \ + -o "${ORDERER_ADMIN_ADDRESS}" \ + --client-cert "${ADMIN_TLS_SIGN_CERT}" \ + --client-key "${ADMIN_TLS_PRIVATE_KEY}" \ + --ca-file "${TLS_CA_CERT_PATH}" + + cd .. + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: ${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" + peer channel join -b "${CHANNEL_NAME}"_newest.block + + cd .. && rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): ${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + cd .. && rm -rf "$DIR_NAME" +} diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index a4cc35f1..65de5bc1 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -1,5 +1,6 @@ export interface FabricVersions { fabricVersion: string; + fabricToolsVersion: string; fabricCaVersion: string; fabricCcenvVersion: string; fabricBaseosVersion: string; @@ -47,6 +48,7 @@ export interface OrdererConfig { name: string; domain: string; address: string; + adminPort: number; port: number; fullAddress: string; orgName: string; @@ -159,7 +161,7 @@ export interface ChaincodeConfig { export interface OrdererGroup { name: string; - consensus: "solo" | "etcdraft"; + consensus: "solo" | "etcdraft" | "BFT"; profileName: string; genesisBlockName: string; configtxOrdererDefaults: string; diff --git a/src/types/FabloConfigJson.ts b/src/types/FabloConfigJson.ts index b2bb11ee..bc50f916 100644 --- a/src/types/FabloConfigJson.ts +++ b/src/types/FabloConfigJson.ts @@ -21,7 +21,7 @@ export interface CAJson { export interface OrdererJson { groupName: string; prefix: string; - type: "solo" | "raft"; + type: "solo" | "raft" | "BFT"; instances: number; } diff --git a/src/validate/index.ts b/src/validate/index.ts index 3d8a3b88..fd7044f5 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -90,6 +90,7 @@ class ValidateGenerator extends Generator { this._validateIfConfigFileExists(this.options.fabloConfig); const networkConfig = parseFabloConfig(this.fs.read(this.options.fabloConfigPath)); + this._validateFabricVersion(networkConfig.global); this._validateJsonSchema(networkConfig); this._validateSupportedFabloVersion(networkConfig.$schema); this._validateOrgs(networkConfig.orgs); @@ -122,6 +123,26 @@ class ValidateGenerator extends Generator { this._verifyFabricVersion(networkConfig.global); } + private _validateFabricVersion(global: GlobalJson) { + // 1. we support fabric up to 3.0.0-beta + if (version(global.fabricVersion).isGreaterOrEqual("3.0.0") && global.fabricVersion !== "3.0.0-beta") { + const objectToEmit = { + category: validationCategories.CRITICAL, + message: `Fabric ${global.fabricVersion} is not supported. Fablo supports only Fabric up to 3.0.0-beta.`, + }; + this.emit(validationErrorType.CRITICAL, objectToEmit); + } + + // 2. we support Fabric starting from 2.0.0 + if (!version(global.fabricVersion).isGreaterOrEqual("2.0.0")) { + const objectToEmit = { + category: validationCategories.CRITICAL, + message: `Fabric ${global.fabricVersion} is not supported. Fablo supports only Fabric starting from 2.0.0.`, + }; + this.emit(validationErrorType.CRITICAL, objectToEmit); + } + } + async shortSummary() { console.log(`Validation errors count: ${this.errors.count()}`); console.log(`Validation warnings count: ${this.warnings.count()}`);