Blockchain applications
To achieve cross-chain between Fabric, Quorum and Corda, the integration framework of the super ledger 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 islands between blockchains has always been an unsolved problem.
In the field of public chains, Bitcoin and Ethereum are the two largest public chains, so many cross-chain protocols mainly solve the communication problem between these two major blockchains.
In the field of alliance chains, IBM's Fabric, JP Morgan's Quorum, and R3's Corda are the most commonly used blockchain frameworks for enterprises. How do you achieve communication between these alliance chains?
Last year, Accenture announced that they developed and tested two solutions, which are designed to enable integration of two or more major alliance chain ecosystems. Since then, the Hyperledger (Super Ledger) alliance has developed a new solution specifically created for licensed blockchains without a central linker node, and this new blockchain integration framework is called Hyperledger Lab.
The design principles of this blockchain integration framework are as follows:
Direct transmission between ledgers of different alliance chains;
Pluggable models and components;
Flexible requirements and data protocols;
Use pre-existing roles;
image1 This blockchain integration framework introduces an "interoperability verifier" overlay network for each interoperable blockchain (herein referred to as the alliance chain).
The interoperability verifier will jointly process the export request from the local node by verifying the ledger version of the local node (steps 1 to 3). Each request is answered by the verifier's (configurable) minimum quorum number (steps 4 and 5). Even if some validators are closed or not involved, the network can continue to work, provided that a minimum number of quorums can be guaranteed. Any secure off-chain communication system can pass messages authenticated by the transmission verifier of the distributed ledger (step 6). The proof from the external distributed ledger can be verified by the recipient locally or using on-chain logic (usually a smart contract) based on the public key of the external distributed ledger's transmission verifier (steps 7 and 8).
The following tutorial demonstrates how to transfer simple assets between Fabric, Quorum, and Corda networks.
1. Deployment prerequisites
Docker
Docker-compose
Node.js npm>=5.6, node >= 8.9
Fabric1.4
JDK 8
Note: 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
1. Installation Procedure
Since this example runs on Hyperledger Fabric and Quorum, we first need to install and run a local network of these two structures. Considering that we need to run two or more DLT networks, the preferred setting for the demonstration is in a Docker container, and we currently do not support manual installation. We will deploy 2 docking blockchains (4 nodes per chain plus alliances), we recommend deploying the environment on different machines: for example, deploying the Fabric blockchain and related alliances on one machine, in another Quorum blockchain and related alliances are deployed on one machine.
Navigate to the examples folder: cd examples/simple-asset-transfer Install npm dependencies: npm i
Navigate to the example Fabric API folder: cd example/simple-asset-transfer/fabric/api install npm dependency: npm i
Navigate to the sample Quorum API folder: cd example/simple-asset-transfer/quorum/api install npm dependency: npm i
For available commands, check 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 composed 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, then you can change it in the Fabric api configuration file Fabric/api/config.json. Note: Some bash scripts will directly refer to the application running on port 4000. If you change the Fabric SDK port, you may need to terminate the application yourself after completion.
The Fabric network and SDK will start in the background. You can use npm run fabric:log to display the Fabric node output and cat fabric/logs/start.log to display the SDK output.
Alternatively, you can use the configuration in Fabric/artifacts to follow the Fabric documentation and deploy contracts from ``fabric/contracts`.
1, 2 Fabric Alliance
To enable the validator's overlay network, we need to build the docker image locally: npm run fed:build
Then, you can run an alliance of 4 validators: npm run fed:fabric The alliance validator relies on Fabric nodes and connectors to perform blockchain operations and verification. The default configuration is set to find the operation of the Fabric SDK locally on port 4000 Examples. If you want to run the Fabric SDK on a different port or other computer, modify federations/docker-compose-Fabric.yml accordingly, find 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, and you can use npm run fed:fabric:log to display the fabric alliance verifier 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 start. You must wait for it before starting the following commands. When Tessera is ready, you can list your docker containers docker ps and wait for them all to 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 use ports 5050, 5051, 5052, and 5053 by default. You can use the quorum in the Quorum api docker-compose file Change it in /api/docker-compose.yml to find APP_PORT: 505 for each service.
The Quorum network and SDK will start in the background. You can use npm run quorum:log and npm run Quorum api:log to display the Quorum node and Quorum API output, respectively.
1, 4 Quorum Alliance
Similar to the Fabric Alliance, in order to enable the validator's overlay network, we need to build a docker image locally: npm run fed: build. If you plan to deploy two federations on the same computer, you do not need to regenerate the image.
Then, you can run an alliance of 4 validators: npm run fed: quorum Quorum alliance validators rely on Fabric nodes and connectors to perform blockchain operations and verification. The default configuration is set to find the Fabric SDK locally on port 5050 Running instance. If you want to run the Fabric SDK on a different port or other computer, modify federations/docker-compose-Fabric.yml accordingly, find 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 build 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 may consume 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 consisting 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 created a docker image, then you do not need to rebuild it. After building, run the script: npm run fed:build
You can then run a federation of 4 validators: npm run fed: corda Corda federation validators rely on connectors to trigger Corda flow and validation.
The federation will start in the background, and you can use npm run fed:corda:log to display the Corda federation validator output.
Second, the scene
All scenarios are connected to the three blockchains mentioned above and their alliances. If you use the default port to run everything locally, you can go forward and use the following command to start one of the scenarios. 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
Obtain the public keys of all validators from the Corda, Quorum and Fabric blockchains, and share them among participating blockchains.
Step 1 Call askForPubKey for each active Corda verifier and collect them;
Step 2 Call askForPubKey for each active Quorum verifier and collect them;
Step 3 Call askForPubKey for each active Fabric verifier and collect them;
Call addForeignValidator to store Corda + Quorum's public key in the Fabric smart contract;
Call addForeignValidator to store Corda + Fabric's public key in the Quorum smart contract;
Call addForeignValidator to store the Fabric + Quorum public key in the Corda ledger;
Note: If the public key is already stored, the last step will fail and multiple startup scripts will automatically cause this problem.
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 these steps:
Step 1 Call createAsset to generate a standard asset with a pseudo-random ID on the "export chain";
Step 2 Call lockAsset to cancel the assets of the target public key (optional) on the specified "export chain";
Step 2.5 (optional) call getAsset to verify the asset status on the "export chain";
Step 3 Call askForSignature for asset retirement and collect the signature of the verifier (there should be 4);
Step 4 Call verifySignature to check the certificate generated on the "import chain";
Step 5: call copyAsset to create a copy of the exported asset on the "import chain";
3. Test
There are two versions of the test: local unit tests and test calls to the running blockchain environment. To run local unit tests, you can use npm run test in the simple-asset-transfer folder. To run extended tests, you can use npm run test:bc. Note: Similar to the scenario, test:bc is connected to both Fabric and Quorum blockchain. If you use the default port to run everything locally, you can continue, otherwise, you will have to modify the configuration file located in the tests folder to match the correct URL for each network.
4. Future work
Integrate Hyperledger Indy to manage the identity of interoperability verifiers for different blockchains;
Enable more complex interoperability use cases (for example, atomic swaps or asset synchronization);
Test scalability and performance;
Integrate more alliance chain platforms (such as Hyperledger Sawtooth, Digital Asset, etc.);
To achieve confidential communication within the overlay network, the verifier network should match the confidential settings of the local ledger;
Replace the current signature scheme with the BLS signature scheme to optimize the proof size (Hyperledger Ursa in this regard