Implementing cross-chaining between Fabric, Quorum, and Corda, the integration framework for superbooks is like this

The current number of blockchain platforms is growing rapidly, which is undoubtedly a good thing for the industry, but the problem of information silos between blockchains has always been an unsolved problem.

In the field of public chain, Bitcoin and Ethereum are the two largest public chains, so many cross-chain agreements mainly solve the communication problem between these two blockchains.

In the field of alliance chain, IBM's Fabric, JPMorgan's Quorum and R3's Corda are the most used blockchain frameworks in the enterprise. How to realize the communication between these alliance chains?

Last year, Accenture announced that they developed and tested two solutions designed to enable integration of two or more major federated chain ecosystems. Since then, the Hyperledger Alliance has developed a new solution specifically for the licensed blockchain without a central connector node, and this new blockchain integration framework is called the Hyperledger Lab .

The design principle of this blockchain integration framework is this:

  1. Direct transmission between different alliance chain books;
  2. Pluggable models and components;
  3. Flexible requirements and data protocols;
  4. Use pre-existing roles;

Image1 This blockchain integration framework introduces an "interoperability verifier" overlay network for each interoperable blockchain (here referred to as a federated chain).

The interoperability verifier will work together to process the export request from the local node by verifying the local version of the ledger version (steps 1 through 3). Each request is answered by a certifier (configurable) minimum quorum number (steps 4 and 5). Even if some certifiers are closed or not participating, the network can continue to work, provided that the minimum quorum number is guaranteed. Any secure out-of-band communication system can deliver a message authenticated by the transport certifier of the distributed ledger (step 6). The proof from the external distributed ledger can be verified by the recipient locally or using chain logic (usually a smart contract) based on the public key of the transport verifier of the external distributed ledger (steps 7 and 8).

The following tutorial demonstrates how to transfer simple assets between Fabric, Quorum, and Corda networks.

First, deployment prerequisites

  1. Docker
  2. Docker-compose
  3. Node.js npm>=5.6,node >= 8.9
  4. Fabric1.4
  5. JDK 8

Note: The Fabric SDK has stricter engine requirements (npm<6.0 and node<9.0)

The script and the following commands have only been tested on Ubuntu 18.04

First, the installation program

Since the example runs on the Hyperledger Fabric and Quorum, we first need to install and run the local network for both structures. Considering that we need to run 2 or more DLT networks, the preferred settings for the demo are in the Docker container, and we don't currently support manual installation. We will deploy two docking blockchains (4 nodes per node plus federation), and we recommend deploying the environment on different machines: for example, deploying a fabric blockchain and related federation on one machine, in another The Quorum blockchain and related alliances are deployed on one machine.

Navigate to the sample folder: cd examples/simple-asset-transfer Install npm dependencies: npm i

Navigate to the sample Fabric API folder: cd example/simple-asset-transfer/fabric/api Install npm Dependencies: npm i

Navigate to the sample Quorum API folder: cd example/simple-asset-transfer/quorum/api Install npm dependencies: npm i

For an available command, check out example package.json, which is in the simple-asset-transfer folder: cat package.json .

1, 1 Fabric blockchain

To run the fabric blockchain, you can use the following script: npm run fabric

This will automatically pull the necessary image for the fabric node and run an environment consisting of 4 nodes divided by 2 organizations in the same channel, and the Fabric SDK listening on port 4000. If you already have a process listening on port 4000, you can change it in the Fabric api configuration file Fabric/api/config.json . Note: Some bash scripts will directly reference the application running on port 4000. If you change the Fabric SDK port, you may need to terminate the application yourself.

The Fabric network and SDK will be launched in the background. You can use npm run fabric:log display the fabric output of the cat fabric/logs/start.log and display the SDK output using cat fabric/logs/start.log .

Alternatively, you can use the configuration in Fabric/artifacts to follow the Fabric documentation and deploy the ``fabric/contracts` from ``fabric/contracts` contracts`.

1, 2 Fabric Alliance

To enable the certifier's overlay network, we need to build the docker image locally: npm run fed:build

Then, you can run a network of 4 certifiers: npm run fed:fabric certifier relies on fabric nodes and connectors to perform blockchain operations and validation. The default configuration is set to look for the operation of the Fabric SDK locally on port 4000. Example. If you want to run the Fabric SDK on a different port or on another computer, modify federations/docker-compose-Fabric.yml , look up the URL for each service: “http://172.20.0.1:4000” and modify the string To point to the correct endpoint.

The Alliance will start in the background, you can use npm run fed:fabric:log display the Fabric Alliance certifier output.

1, 3 Quorum blockchain

To run the Quorum blockchain, you can use the following script: npm run quorum

This will use Tessera and RAFT to run a 7-node Quorum network. Tessera may take a few minutes to fully boot, you must wait for it before starting the following command. When Tessera is ready, you can list your docker container docker ps and wait for them to all become "healthy".

Then, you can build npm run quorum:api:build , and then run the custom Quorum API npm run quorum:api , the Quorum API will default to ports 5050, 5051, 5052 and 5053, you can use the Quorum api docker-compose file quorum/api/docker-compose.yml Change it in quorum/api/docker-compose.yml and look for APP_PORT: 505 for each service APP_PORT: 505 .

The Quorum network and SDK will be launched in the background. You can use the npm run quorum:log and npm run Quorum api:log to display the Quorum node and Quorum API output respectively.

1, 4 Quorum Alliance

As with the Fabric Alliance, in order to enable the certifier's overlay network, we need to build the docker image locally: npm run fed:build . If you plan to deploy two federations on the same computer, you don't have to regenerate the image.

Then, you can run a federation of 4 certifiers: npm run fed:quorum Quoum certifier relies on fabric nodes and connectors to perform blockchain operations and validation. The default configuration is set to look up the Fabric SDK locally on port 5050. Running instance. If you want to run the Fabric SDK on a different port or on another computer, modify federations/docker-compose-Fabric.yml , look up the URL for each service: “http://172.20.0.1:5050” and modify the string To point to the correct endpoint.

1, 5 Corda blockchain

First you need to set up and deploy a Corda network. To do this, you need to run the following script: npm run corda:build

The process of loading the necessary components and assembling the Corda node can take you a few minutes. After successfully deploying the Corda node and web server, you can run the Corda network.

To run the Corda blockchain, you can use the following script: npm run Corda

This will run a Corda network of 5 nodes and 4 web servers. The deployment process takes about a few minutes.

1, 6 Corda Alliance

As mentioned above, if you have already built a docker image, then you don't need to rebuild it. After the setup is complete, run the script: npm run fed:build

Then, you can run a federation of four verifiers: npm run fed:corda Corda Corda federation verifiers rely on connectors to trigger Corda streams and validation.

The Alliance will start in the background, you can use npm run fed:corda:log to display the Corda Alliance certifier output.

Second, the scene

All scenes are connected to the three blockchains mentioned above and their alliances. If you run everything locally using the default port, you can go ahead and launch one of the scenarios with the following command. Otherwise, you will have to modify the configuration files located in the scenarios folder /simple-asset-transfer folder to match the correct url for each network.

Scenario 1: share-pub-key (shared public key): npm run scenario:share

Get all the certifier's public keys from the Corda, Quorum, and Fabric blockchains and share them among the participating blockchains.

  1. Step 1 calls askForPubKey for each active Corda verifier and collects them;
  2. Step 2 calls askForPubKey for each active quorum certifier and collects them;
  3. Step 3 calls askForPubKey for each active fabric certifier and collects them;
  4. Call addForeignValidator to store Corda + Quorum's public key in the Fabric smart contract;
  5. Call addForeignValidator store the public key of Corda + Fabric in the Quorum smart contract;
  6. Call addForeignValidator store the public key of Fabric + Quorum in the Corda addForeignValidator ;

Note: If the public key is already stored, the last step will fail and multiple startup scripts will automatically cause this issue.

Scenario 2: fabric to quorum : npm run scenario:FtQ

Scenario 3: quorum to fabric : npm run scenario:QtF

Scenario 4: corda to quorum : npm run scenario:CtQ

Scenario 5: corda to fabric : npm run scenario:CtF

Scenario 6: fabric to corda : npm run scenario:FtC

Scenario 7: quorum to corda : npm run scenario:QtC

The above application scenarios require the following steps:

  1. Step 1 calls createAsset to generate a standard asset with a pseudo-random ID on the "export chain";
  2. Step 2 calls lockAsset to unregister the asset of the target public key (optional) on the specified "export chain";
  3. Step 2.5 (Optional) Call getAsset to verify the state of the asset on the Export Chain;
  4. Step 3 calls askForSignature for the retirement of the asset and collects the verifier's signature (there should be 4);
  5. Step 4 calls verifySignature check the certificate generated on the "import chain";
  6. Step 5 calls copyAsset to create a copy of the exported asset on the "import chain";

Third, the test

There are two versions of the test: the local unit test and the test call are running in the blockchain environment. To run a local unit test, you can use npm run test in the simple-asset-transfer folder. To run the extended test, you can use npm run test:bc . Note: Similar to the scenario, test:bc is connected to both the Fabric and Quorum blockchains. If you run everything locally using the default port, you can continue, otherwise you will have to modify the configuration files located in the tests folder to match the correct url for each network.

Fourth, the future work

  1. Integrate Hyperledger Indy to manage the interoperability certifier identity of different blockchains;
  2. Implement more complex interoperability use cases (for example, atomic swaps or asset synchronization);
  3. Test scalability and performance;
  4. Integrate more alliance chain platforms (such as Hyperledger Sawtooth, Digital Asset, etc.);
  5. To implement secure communication within the overlay network, the verifier network should match the privacy settings of the local ledger;
  6. Replace the current signature scheme with the BLS signature scheme to optimize the proof size (Hyperledger Ursa is the leader in this regard);

Relevant information:

1, https://www.hyperledger.org/blog/2019/11/20/accenture-open-sources-blockchain-integration-framework-as-a-hyperledger-lab

2, https://github.com/hyperledger-labs/blockchain-integration-framework/blob/master/docs/tutorials/simple-asset-transfer.md

3, https://github.com/hyperledger-labs/blockchain-integration-framework