Skip to content

Commit

Permalink
chore: updating from private repo
Browse files Browse the repository at this point in the history
This commit was produced by copying over the files/folders recursively
from the private Accenture repository which was on the commit:
------------------------------------------------------------------------
Commit: fce7bfb281d719fe41b15f90fb721ed525a9dba6
Parents: 80e17819bd280d48867dc1efc53c5ef57293c346
Author: hugo.borne-pons <hugo.borne-pons@accenture.com>
Date: Thu Oct 24 2019 05:21:20 GMT-0700 (Pacific Daylight Time)
Committer: hugo.borne-pons
------------------------------------------------------------------------
  • Loading branch information
petermetz committed Oct 25, 2019
1 parent 9ead7e8 commit f88845b
Show file tree
Hide file tree
Showing 232 changed files with 32,931 additions and 2,294 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,4 @@ We want to implement plugins and on-chain logic for more platforms (e.g. Digital
3 mihails gulajevs
2 dimitrijs rulovs
2 unknown
1 peter somogyvari
1 peter somogyvari
93 changes: 60 additions & 33 deletions docs/tutorials/simple-asset-transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ We implemented an example using our Fabric and Quorum plugins to showcase a simp
- [Docker-compose](https://docs.docker.com/compose/install/)
- [Node.js](https://nodejs.org/en/download/) npm >= 5.6 & node >= 8.9
- [Fabric1.4](https://hyperledger-fabric.readthedocs.io/en/release-1.4/)
- [JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)

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

Expand All @@ -17,8 +18,13 @@ The scripts and following commands have only been tested on Ubuntu 18.04

Since the example runs on Hyperledger Fabric and Quorum, we'll first need to install and run local networks for both. Considering that we need to run 2 or more DLTs, the preferred setup for the demo is in Docker containers and we don't provide support for manual install just yet. We are gonna deploy 2 dockerised Blockchains with 4 nodes each plus the federations, it can prove power intensive for a single machine, we recommend deploying the environments in different machines: e.g. Fabric Blockchain and federation on one machine and Quorum Blockchain and federation in another one.

Navigate to the example folder: ``cd example/simple-asset-transfer``
Navigate to the example 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 dependencies: ``npm i``
Navigate to the example Quorum API folder: ``cd example/simple-asset-transfer/quorum/api``
Install npm dependencies: ``npm i``

Check example package.json for available commands. In simple-asset-transfer folder: ``cat package.json``

#### Fabric Blockchain
Expand Down Expand Up @@ -66,40 +72,61 @@ Then, you can run a federation of 4 validators:
``npm run fed:quorum``
Federation validators are relying on Fabric nodes and connectors to perform Blockchain actions and verifications, the default config is set to look for a running instance of the Fabric SDK locally on port 5050. If you are running the Fabric SDK on a different port or another machine you want to modify the ``federations/docker-compose-fabric.yml`` accordingly, look for ``URL: "http://172.20.0.1:5050"`` for each of the services and modify the string to point to the correct endpoint.

#### Corda Blockchain

First you need to build and deploy a Corda network. For this you need to run the following script:
``npm run corda:build``

This process can take several minutes to load the necessary components and assemble the Corda nodes. After successfully deploying the Corda nodes and web servers, 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 launch will take you a couple of minutes.

#### Corda Federation

As mentioned above, you do not need to rebuild the docker image if you have already done it. Otherwise run next script:
``npm run fed:build``

Then, you can run a federation of 4 validators:
``npm run fed:corda``
Federation validators are relying on connectors to trigger Corda flows and verifications.

The federation will start in the background, you can use ``npm run fed:corda:log`` to show the Corda federation validator outputs.

### Scenarios

All scenarios are connecting to both Fabric, Quorum Blockchains and their respective federations. If you run everything locally with the default port you can go forward and launch one of the scenarios with the following commands. Otherwise, you will have to modify the config file located in the scenarios folder under simple-asset-transfer folder, to match the proper url for each of the networks.

- Share-pub-key
``npm run scenario:share``
Fetch all Quorum Validators' public keys and store them into Fabric smart contract then fetch all Fabric Validators' public key and store them into Quorum smart contract

Step1. Call ``askForPubKey`` for each of the alive Quorum validators and gather the public keys
Step2. Call ``addForeignValidator`` using one Fabric Node for each of the gathered public key
Step3. Call ``askForPubKey`` for each of the alive Fabric validators and gather the public keys
Step4. Call ``addForeignValidator`` using one Quorum Node for each of the gathered public key
Note: Step4. will be rejected by the EVM and fail if the public keys have already been stored in the smart contract. Launching the scripts multiple times will automatically cause this problem

- fabric-to-quorum
``npm run scenario:FtQ``
Create an asset on Fabric Blockchain and retire it, then ask a proof of retirement from the validators and send the proof on the Quorum Blockchain for on-chain verifications of the signature

Step1. Call ``createAsset`` to generate a standard asset with a pseudo-random ID on Fabric chain
Step2. Call ``lockAsset`` to retire the asset specifying a target public key (optional) on Fabric chain
Step2'. Call ``getAsset`` to verify the state of the asset on Fabric chain
Step3. Call ``askForSignature`` for the retirement of the asset and gather the signatures of the validators (should be 4 of them)
Step4. Call ``verifySignature`` to check the generated proof on Quorum chain

- quorum-to-fabric
``npm run scenario:QtF``

Create an asset on Quorum Blockchain and retire it, then ask a proof of retirement from the validators and send the proof on the Quorum Blockchain for on-chain verifications of the signature

Step1. Call ``createAsset`` to generate a standard asset with a pseudo-random ID on Quorum chain
Step2. Call ``lockAsset`` to retire the asset specifying a target public key (optional) on Quorum chain
Step2'. Call ``getAsset`` to verify the state of the asset on Quorum chain
Step3. Call ``askForSignature`` for the retirement of the asset and gather the signatures of the validators (should be 4 of them)
Step4. Call ``verifySignature`` to check the generated proof on Fabric chain
All scenarios are connected to all three Blockchains and their federations. If you run everything locally with the default port you can go forward and launch one of the scenarios with the following commands. Otherwise, you will have to modify the config file located in the scenarios folder under simple-asset-transfer folder, to match the proper url for each of the networks.

* **share-pub-key** ``npm run scenario:share``

Fetch all Validators' public keys from Corda, Quorum and Fabric Blockchains and share them between participating Blockchains.

- Step 1 Call ``askForPubKey`` for each of the alive Corda validators and gather them
- Step 2 Call ``askForPubKey`` for each of the alive Quorum validators and gather them
- Step 3 Call ``askForPubKey`` for each of the alive Fabric validators and gather them
- Step 4 Call ``addForeignValidator`` to store Corda + Quorum public keys to Fabric smart contract
- Step 5 Call ``addForeignValidator`` to store Corda + Fabric pubic keys into and Quorum smart contract
- Step 6 Call ``addForeignValidator`` to store Fabric + Quorum public keys to Corda ledger

Note: Last steps be fail if the public keys have already been stored. Launching the scripts multiple times will automatically cause this problem

* **fabric-to-quorum** ``npm run scenario:FtQ``
* **quorum-to-fabric** ``npm run scenario:QtF``
* **corda-to-quorum** ``npm run scenario:CtQ``
* **corda-to-fabric** ``npm run scenario:CtF``
* **fabric-to-corda** ``npm run scenario:FtC``
* **quorum-to-corda** ``npm run scenario:QtC``

This list of scenarios that create an asset on one of Blockchains ('export chain') and retire it, then ask a proof of retirement from the validators and send the proof in another Blockchain ('import chain') for on-chain verifications of the signature

- Step 1 Call ``createAsset`` to generate a standard asset with a pseudo-random ID on 'export chain'
- Step 2 Call ``lockAsset`` to retire the asset specifying a target public key (optional) on 'export chain'
- Step 2.5 (optional) Call ``getAsset`` to verify the state of the asset on 'export chain'
- Step 3 Call ``askForSignature`` for the retirement of the asset and gather the signatures of the validators (should be 4 of them)
- Step 4 Call ``verifySignature`` to check the generated proof on 'import chain'
- Step 5 Call ``copyAsset`` to creating a copy of the exported asset on 'import chain'

### Tests

Expand Down
6 changes: 6 additions & 0 deletions docs/tutorials/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ When running the Fabric client from the Fabric SDK against your Fabric ledger, y
nano node-module/fabric-client/config/default.json
```
increase ``"request-timeout" : 45000,`` l.2

### Installing non-default npm version

Installing Node.js will also install NPM, however it is recommended that you confirm the version of NPM installed. You can upgrade/downgrade the npm tool with the following command:

npm install npm@5.6.0 -g
2 changes: 1 addition & 1 deletion examples/simple-asset-transfer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:8
FROM node:8-slim

ADD . /federation
WORKDIR /federation
Expand Down
8 changes: 6 additions & 2 deletions examples/simple-asset-transfer/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const Validator = require(`@hyperledger/blockchain-integration-framework`).Valid
const { genKeyFile } = require(`@hyperledger/blockchain-integration-framework`).cryptoUtils;
const ConnectorFabric = require(`./fabric/connector`);
const ConnectorQuorum = require(`./quorum/connector`);
const ConnectorCorda = require(`./corda/connector`);

(async () => {
const keypair = await genKeyFile(`/federation/keypair`);
Expand All @@ -24,16 +25,19 @@ const ConnectorQuorum = require(`./quorum/connector`);
password: process.env.PASSWORD,
url: process.env.URL,
port: process.env.PORT,
}
};

let connector;
switch(validatorOptions.dlType) {
switch (validatorOptions.dlType) {
case `FABRIC`:
connector = new ConnectorFabric(connectorOptions);
break;
case `QUORUM`:
connector = new ConnectorQuorum(connectorOptions);
break;
case `CORDA`:
connector = new ConnectorCorda(connectorOptions);
break;
default:
throw new Error(`undefined dlType`);
}
Expand Down
79 changes: 79 additions & 0 deletions examples/simple-asset-transfer/corda/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Eclipse, ctags, Mac metadata, log files
.classpath
.project
.settings
tags
.DS_Store
*.log
*.log.gz
*.orig

.gradle

# General build files
**/build/*
!docs/build/*

lib/dokka.jar

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio

*.iml

## Directory-based project format:
#.idea

# if you remove the above rule, at least ignore the following:

# Specific files to avoid churn
.idea/*.xml
.idea/copyright
.idea/jsLibraryMappings.xml

# User-specific stuff:
.idea/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
/out/
workflows/out/
contracts/out/
clients/out/
testing/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties

# docs related
docs/virtualenv/

# if you use the installQuasar task
lib

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f88845b

Please sign in to comment.