Skip to content

Network Plugin

Yash Nabar edited this page Sep 13, 2023 · 1 revision

The Network plugin is a plugin for Corda CLI plugin host to set up and manage application networks using corda-cli.

Before you start

To use the Network plugin, you will need a working copy of corda-cli with the plugin installed. To do this, you can either download it from the R3 Developer Portal or build it from source.

Download from the R3 Developer Portal

  1. Follow the instructions on the Installing the Corda CLI page.
  2. Run commands using the corda-cli.sh script.

Build from source

  1. Clone the corda-cli-plugin-host repository from GitHub:
git clone https://github.com/corda/corda-cli-plugin-host.git
cd corda-cli-plugin-host
  1. Build the project using Gradle:
./gradlew build
  1. Locate the corda-cli.sh script in the corda-cli-plugin-host/build/generatedScripts/ directory.

  2. Build the plugin JAR from the corda-runtime-os repository from GitHub:

./gradlew :tools:plugins:network:build
  1. Move the generated JAR to the corda-cli-plugin-host/build/plugins/ directory.

  2. Run commands using the corda-cli.sh script.

Note: The commands below expect the REST endpoints of the target Corda cluster to be available at https://localhost:8888. To allow insecure server connections with SSL, use --insecure.

Setting up a dynamic application network

The dynamic command is for operations related to dynamic networks, including MGM and member onboarding.

Onboard MGM

The onboard-mgm command creates a virtual node for an MGM and initiates the onboarding process, through which an application network is created. The session and ECDH keys are auto-generated by the Network plugin during registration. The group policy is also exported to be used for creating Member CPI(s).

./corda-cli.sh network dynamic onboard-mgm "O=MGM, L=London, C=GB" -s <save-group-policy-as> --wait --user=admin --password=admin --target=https://localhost:8888

Use ./corda-cli.sh network dynamic onboard-mgm --help to view all available options.

Onboard a member

The onboard-member command is for onboarding members onto a dynamic network. It creates a virtual node for the member, and starts the registration process by auto-generating session and ledger keys.

To onboard a member using a CPB and group policy:

./corda-cli.sh network dynamic onboard-member "O=Alice, L=London, C=GB" --cpb-file <path-to-your-CPB-file> --group-policy-file <path-to-your-group-policy> --wait --user=admin --password=admin --target=https://localhost:8888

To onboard a member using the hash of a previously uploaded CPI:

./corda-cli.sh network dynamic onboard-member "O=Alice, L=London, C=GB" --cpi-hash <cpi-hash> --wait --user=admin --password=admin --target=https://localhost:8888

To onboard a member as a notary:

./corda-cli.sh network dynamic onboard-member "O=Alice, L=London, C=GB" --cpi-hash <cpi-hash> --role "notary" --set "corda.notary.service.name"="C=GB, L=London, O=Notary" --wait --user=admin --password=admin --target=https://localhost:8888

Use ./corda-cli.sh network dynamic onboard-member --help to view all available options.

Get Registrations

The get-registrations command is for checking the status of registration requests.

To view all requests for a holding identity:

./corda-cli.sh network get-registrations -h <holding-id> --user=admin --password=admin --target=https://localhost:8888

To view a specific registration request, use --request-id:

./corda-cli.sh network get-registrations -h <holding-id> --request-id <request-id> --user=admin --password=admin --target=https://localhost:8888

Note: You can use --name and --group if the holding ID is not known. If only --name is specified, the last created group will be used by default.

Discovering other members of the network and viewing the group parameters

The lookup command is for looking up group parameters or peers on the network.

Note: You can use --name and --group if the holding ID is not known. If only --name is specified, the last created group will be used by default.

Discover Members

To look up all members visible to a holding identity:

./corda-cli.sh network lookup members -h <holding-id> --user=admin --password=admin --target=https://localhost:8888

Use ./corda-cli.sh network lookup members --help to view all available options, including status and X.500 attribute filters.

View Group Parameters

To look up group parameters for a holding identity:

./corda-cli.sh network lookup group-parameters -h <holding-id> --user=admin --password=admin --target=https://localhost:8888