Skip to content

Gateway

James Taylor edited this page Feb 1, 2021 · 13 revisions

Rough notes for Gateway development

Enable Gateway

Enable the Gateway feature flag in core.yaml by adding the following:

peer:
    gateway:
        enabled: true

Alternatively, using yq:

docker run --rm -v "${PWD}":/workdir mikefarah/yq eval '.peer.gateway.enabled = true' --inplace core.yaml

Using microfab

microfab is the containerized Hyperledger Fabric runtime which is used in the IBP VSCode extension, which is a nice option for running a lightweight Gateway development environment.

There are currently no Fabric releases which includes Gateway support so you'll need to build the latest Fabric binaries.

With the latest Fabric code, create all the required binaries and configuration files by running the following commands:

make "release/linux-amd64"
mkdir -p "release/linux-amd64/config"
cp sampleconfig/*yaml "release/linux-amd64/config"
curl -sSL https://github.com/hyperledger/fabric-ca/releases/download/v1.4.9/hyperledger-fabric-ca-linux-amd64-1.4.9.tar.gz | tar xzf - -C "release/linux-amd64/config"

Update the core.yaml file to enable the Gateway. The ledger.snapshots.rootDir setting also needs to be updated to /opt/microfab/data/snapshots to work in microfab. Edit the file manually, or us the following yq command:

docker run --rm -v "${PWD}/release/linux-amd64/config":/workdir mikefarah/yq eval '.peer.gateway.enabled = true | .ledger.snapshots.rootDir = "/opt/microfab/data/snapshots"' --inplace core.yaml

Set the MICROFAB_CONFIG environment variable and start microfab:

docker run --name microfab --rm -v ${PWD}/release/linux-amd64:/opt/fabric -p 8080:8080 -e MICROFAB_CONFIG ibmcom/ibp-microfab

Or for moar orgs...

export MICROFAB_CONFIG='{
    "ordering_organization": {
        "name": "Orderer"
    },
    "endorsing_organizations":[
        {
            "name": "Org1"
        },
        {
            "name": "Org2"
        },
        {
            "name": "Org3"
        }
    ],
    "channels":[
        {
            "name": "mychannel",
            "endorsing_organizations":[
                "Org1",
                "Org2",
                "Org3"
            ]
        }
    ],
    "capability_level":"V2_0"
}'

Clone this wiki locally