diff --git a/chaincode/fabcar/typescript/src/djinn.ts b/chaincode/fabcar/typescript/src/djinn.ts index 94dc5d74..a84167ba 100644 --- a/chaincode/fabcar/typescript/src/djinn.ts +++ b/chaincode/fabcar/typescript/src/djinn.ts @@ -27,7 +27,7 @@ export class Djinn extends Contract { const ageToValidate = Number(age); // Validate age validation.isValid = (minimumAge <= ageToValidate); - + validation.age = Number(age); await ctx.stub.putState('VALIDATION' + validation.id, Buffer.from(JSON.stringify(validation.toString()))); } diff --git a/chaincode/fabcar/typescript/src/validation.ts b/chaincode/fabcar/typescript/src/validation.ts index e18da047..703d6993 100644 --- a/chaincode/fabcar/typescript/src/validation.ts +++ b/chaincode/fabcar/typescript/src/validation.ts @@ -1,8 +1,9 @@ export class Validation { public executeDate: Date = new Date(); public id: number; + public age: number; public isValid: boolean; public toString(): string { - return '{id: ' + this.id + '; executeDate: ' + this.executeDate + '; isValid: ' + this.isValid + '}' ; + return '{id: ' + this.id + '; executeDate: ' + this.executeDate + '; age: ' + this.age + '; isValid: ' + this.isValid + '}' ; } } diff --git a/commercial-paper/.gitignore b/commercial-paper/.gitignore index 65971ce8..e69de29b 100644 --- a/commercial-paper/.gitignore +++ b/commercial-paper/.gitignore @@ -1,4 +0,0 @@ -cp.tar.gz -**/.gradle -**/gateway/connection-org1.yaml -**/gateway/connection-org2.yaml diff --git a/commercial-paper/img/overview.png b/commercial-paper/img/overview.png index 9da7aced..e69de29b 100644 Binary files a/commercial-paper/img/overview.png and b/commercial-paper/img/overview.png differ diff --git a/commercial-paper/img/transaction-flow.png b/commercial-paper/img/transaction-flow.png index 855a8ce3..e69de29b 100644 Binary files a/commercial-paper/img/transaction-flow.png and b/commercial-paper/img/transaction-flow.png differ diff --git a/commercial-paper/network-clean.sh b/commercial-paper/network-clean.sh old mode 100755 new mode 100644 index 5fe6c087..e69de29b --- a/commercial-paper/network-clean.sh +++ b/commercial-paper/network-clean.sh @@ -1,26 +0,0 @@ -#!/bin/bash -# -# SPDX-License-Identifier: Apache-2.0 - -function _exit(){ - printf "Exiting:%s\n" "$1" - exit -1 -} - -# Exit on first error, print all commands. -set -ev -set -o pipefail - -# Where am I? -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -export FABRIC_CFG_PATH="${DIR}/../config" - -cd "${DIR}/../test-network/" - -docker kill cliDigiBank cliMagnetoCorp logspout || true -./network.sh down - -# remove any stopped containers -docker rm $(docker ps -aq) - diff --git a/commercial-paper/network-starter.sh b/commercial-paper/network-starter.sh old mode 100755 new mode 100644 index fd70be90..e69de29b --- a/commercial-paper/network-starter.sh +++ b/commercial-paper/network-starter.sh @@ -1,36 +0,0 @@ -#!/bin/bash -# -# SPDX-License-Identifier: Apache-2.0 - -function _exit(){ - printf "Exiting:%s\n" "$1" - exit -1 -} - -# Exit on first error, print all commands. -set -ev -set -o pipefail - -# Where am I? -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -export FABRIC_CFG_PATH="${DIR}/../config" - -cd "${DIR}/../test-network/" - -docker kill cliDigiBank cliMagnetoCorp logspout || true -./network.sh down -./network.sh up createChannel -ca -s couchdb - -# Copy the connection profiles so they are in the correct organizations. -cp "${DIR}/../test-network/organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "${DIR}/organization/digibank/gateway/" -cp "${DIR}/../test-network/organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "${DIR}/organization/magnetocorp/gateway/" - -cp "${DIR}/../test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/"* "${DIR}/../test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem" -cp "${DIR}/../test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/"* "${DIR}/../test-network/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv_sk" - -cp "${DIR}/../test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/"* "${DIR}/../test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem" -cp "${DIR}/../test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/"* "${DIR}/../test-network/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/priv_sk" - -echo Suggest that you monitor the docker containers by running -echo "./organization/magnetocorp/configuration/cli/monitordocker.sh fabric_test" diff --git a/commercial-paper/organization/digibank/.gitignore b/commercial-paper/organization/digibank/.gitignore index 7d139014..e69de29b 100644 --- a/commercial-paper/organization/digibank/.gitignore +++ b/commercial-paper/organization/digibank/.gitignore @@ -1 +0,0 @@ -identity \ No newline at end of file diff --git a/commercial-paper/organization/digibank/application-java/.gitignore b/commercial-paper/organization/digibank/application-java/.gitignore index 2f7896d1..e69de29b 100644 --- a/commercial-paper/organization/digibank/application-java/.gitignore +++ b/commercial-paper/organization/digibank/application-java/.gitignore @@ -1 +0,0 @@ -target/ diff --git a/commercial-paper/organization/digibank/application-java/.settings/org.eclipse.jdt.core.prefs b/commercial-paper/organization/digibank/application-java/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index b8947ec6..00000000 --- a/commercial-paper/organization/digibank/application-java/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/commercial-paper/organization/digibank/application-java/.settings/org.eclipse.m2e.core.prefs b/commercial-paper/organization/digibank/application-java/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1..00000000 --- a/commercial-paper/organization/digibank/application-java/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/commercial-paper/organization/digibank/application-java/pom.xml b/commercial-paper/organization/digibank/application-java/pom.xml index 71cd8e10..e69de29b 100644 --- a/commercial-paper/organization/digibank/application-java/pom.xml +++ b/commercial-paper/organization/digibank/application-java/pom.xml @@ -1,96 +0,0 @@ - - 4.0.0 - commercial-paper - commercial-paper - 0.0.1-SNAPSHOT - - - - - 1.8 - UTF-8 - UTF-8 - - - 2.1.0 - - 2.1.0 - - - - - src - - - maven-compiler-plugin - 3.8.0 - - 1.8 - 1.8 - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.0 - - - - package - - shade - - - - - false - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - - - - - - jitpack.io - https://jitpack.io - - - - - - org.hyperledger.fabric - fabric-gateway-java - ${fabric-gateway-java.version} - - - - - org.hyperledger.fabric-chaincode-java - fabric-chaincode-shim - ${fabric-chaincode-java.version} - compile - - - - - org.json - json - 20180813 - - - - diff --git a/commercial-paper/organization/digibank/application-java/src/org/digibank/AddToWallet.java b/commercial-paper/organization/digibank/application-java/src/org/digibank/AddToWallet.java index 6a3fa121..e69de29b 100644 --- a/commercial-paper/organization/digibank/application-java/src/org/digibank/AddToWallet.java +++ b/commercial-paper/organization/digibank/application-java/src/org/digibank/AddToWallet.java @@ -1,68 +0,0 @@ -/* -SPDX-License-Identifier: Apache-2.0 -*/ - -package org.digibank; - -import java.io.IOException; -import java.io.Reader; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.security.InvalidKeyException; -import java.security.PrivateKey; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import org.hyperledger.fabric.gateway.Identities; -import org.hyperledger.fabric.gateway.Identity; -import org.hyperledger.fabric.gateway.Wallet; -import org.hyperledger.fabric.gateway.Wallets; - -public class AddToWallet { - - private static X509Certificate readX509Certificate(final Path certificatePath) throws IOException, CertificateException { - try (Reader certificateReader = Files.newBufferedReader(certificatePath, StandardCharsets.UTF_8)) { - return Identities.readX509Certificate(certificateReader); - } - } - - private static PrivateKey getPrivateKey(final Path privateKeyPath) throws IOException, InvalidKeyException { - try (Reader privateKeyReader = Files.newBufferedReader(privateKeyPath, StandardCharsets.UTF_8)) { - return Identities.readPrivateKey(privateKeyReader); - } - } - - public static void main(String[] args) { - try { - // A wallet stores a collection of identities - Path walletPath = Paths.get(".", "wallet"); - Wallet wallet = Wallets.newFileSystemWallet(walletPath); - - Path credentialPath = Paths.get("..", "..", "..",".." ,"test-network", "organizations", - "peerOrganizations", "org1.example.com", "users", "User1@org1.example.com", "msp"); - System.out.println("credentialPath: " + credentialPath.toString()); - Path certificatePath = credentialPath.resolve(Paths.get("signcerts", - "User1@org1.example.com-cert.pem")); - System.out.println("certificatePem: " + certificatePath.toString()); - Path privateKeyPath = credentialPath.resolve(Paths.get("keystore", - "priv_sk")); - - X509Certificate certificate = readX509Certificate(certificatePath); - PrivateKey privateKey = getPrivateKey(privateKeyPath); - - Identity identity = Identities.newX509Identity("Org1MSP", certificate, privateKey); - - - String identityLabel = "User1@org1.example.com"; - wallet.put(identityLabel, identity); - - System.out.println("Write wallet info into " + walletPath.toString() + " successfully."); - - } catch (IOException | CertificateException | InvalidKeyException e) { - System.err.println("Error adding to wallet"); - e.printStackTrace(); - } - } - -} diff --git a/commercial-paper/organization/digibank/application-java/src/org/digibank/Buy.java b/commercial-paper/organization/digibank/application-java/src/org/digibank/Buy.java index 5e09bbd1..e69de29b 100644 --- a/commercial-paper/organization/digibank/application-java/src/org/digibank/Buy.java +++ b/commercial-paper/organization/digibank/application-java/src/org/digibank/Buy.java @@ -1,74 +0,0 @@ -/* -SPDX-License-Identifier: Apache-2.0 -*/ - -package org.digibank; - -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Map; -import java.util.concurrent.TimeoutException; - -import org.hyperledger.fabric.gateway.Contract; -import org.hyperledger.fabric.gateway.Gateway; -import org.hyperledger.fabric.gateway.GatewayException; -import org.hyperledger.fabric.gateway.Network; -import org.hyperledger.fabric.gateway.Wallet; -import org.hyperledger.fabric.gateway.Wallets; -import org.papernet.CommercialPaper; - -public class Buy { - - private static final String ENVKEY="CONTRACT_NAME"; - - public static void main(String[] args) { - Gateway.Builder builder = Gateway.createBuilder(); - - String contractName="papercontract"; - // get the name of the contract, in case it is overridden - Map envvar = System.getenv(); - if (envvar.containsKey(ENVKEY)){ - contractName=envvar.get(ENVKEY); - } - - try { - // A wallet stores a collection of identities - Path walletPath = Paths.get(".", "wallet"); - Wallet wallet = Wallets.newFileSystemWallet(walletPath); - System.out.println("Read wallet info from: " + walletPath); - - String userName = "User1@org1.example.com"; - - Path connectionProfile = Paths.get("..", "gateway", "connection-org1.yaml"); - - // Set connection options on the gateway builder - builder.identity(wallet, userName).networkConfig(connectionProfile).discovery(false); - - // Connect to gateway using application specified parameters - try(Gateway gateway = builder.connect()) { - - // Access PaperNet network - System.out.println("Use network channel: mychannel."); - Network network = gateway.getNetwork("mychannel"); - - // Get addressability to commercial paper contract - System.out.println("Use org.papernet.commercialpaper smart contract."); - Contract contract = network.getContract(contractName, "org.papernet.commercialpaper"); - - // Buy commercial paper - System.out.println("Submit commercial paper buy transaction."); - byte[] response = contract.submitTransaction("buy", "MagnetoCorp", "00001", "MagnetoCorp", "DigiBank", "4900000", "2020-05-31"); - - // Process response - System.out.println("Process buy transaction response."); - CommercialPaper paper = CommercialPaper.deserialize(response); - System.out.println(paper); - } - } catch (GatewayException | IOException | TimeoutException | InterruptedException e) { - e.printStackTrace(); - System.exit(-1); - } - } - -} diff --git a/commercial-paper/organization/digibank/application-java/src/org/digibank/Redeem.java b/commercial-paper/organization/digibank/application-java/src/org/digibank/Redeem.java index 62eb9d9e..e69de29b 100644 --- a/commercial-paper/organization/digibank/application-java/src/org/digibank/Redeem.java +++ b/commercial-paper/organization/digibank/application-java/src/org/digibank/Redeem.java @@ -1,73 +0,0 @@ -/* -SPDX-License-Identifier: Apache-2.0 -*/ - -package org.digibank; - -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Map; -import java.util.concurrent.TimeoutException; - -import org.hyperledger.fabric.gateway.Contract; -import org.hyperledger.fabric.gateway.Gateway; -import org.hyperledger.fabric.gateway.GatewayException; -import org.hyperledger.fabric.gateway.Network; -import org.hyperledger.fabric.gateway.Wallet; -import org.hyperledger.fabric.gateway.Wallets; -import org.papernet.CommercialPaper; - -public class Redeem { - - private static final String ENVKEY="CONTRACT_NAME"; - - public static void main(String[] args) { - Gateway.Builder builder = Gateway.createBuilder(); - - String contractName="papercontract"; - // get the name of the contract, in case it is overridden - Map envvar = System.getenv(); - if (envvar.containsKey(ENVKEY)){ - contractName=envvar.get(ENVKEY); - } - - try { - // A wallet stores a collection of identities - Path walletPath = Paths.get(".", "wallet"); - Wallet wallet = Wallets.newFileSystemWallet(walletPath); - - String userName = "User1@org1.example.com"; - - Path connectionProfile = Paths.get("..", "gateway", "connection-org1.yaml"); - - // Set connection options on the gateway builder - builder.identity(wallet, userName).networkConfig(connectionProfile).discovery(false); - - // Connect to gateway using application specified parameters - try(Gateway gateway = builder.connect()) { - - // Access PaperNet network - System.out.println("Use network channel: mychannel."); - Network network = gateway.getNetwork("mychannel"); - - // Get addressability to commercial paper contract - System.out.println("Use org.papernet.commercialpaper smart contract."); - Contract contract = network.getContract("papercontract", "org.papernet.commercialpaper"); - - // Redeem commercial paper - System.out.println("Submit commercial paper redeem transaction."); - byte[] response = contract.submitTransaction("redeem", "MagnetoCorp", "00001", "DigiBank", "2020-11-30"); - - // Process response - System.out.println("Process redeem transaction response."); - CommercialPaper paper = CommercialPaper.deserialize(response); - System.out.println(paper); - } - } catch (GatewayException | IOException | TimeoutException | InterruptedException e) { - e.printStackTrace(); - System.exit(-1); - } - } - -} diff --git a/commercial-paper/organization/digibank/application/.eslintrc.js b/commercial-paper/organization/digibank/application/.eslintrc.js index 22fbefc8..e69de29b 100644 --- a/commercial-paper/organization/digibank/application/.eslintrc.js +++ b/commercial-paper/organization/digibank/application/.eslintrc.js @@ -1,37 +0,0 @@ -/* -SPDX-License-Identifier: Apache-2.0 -*/ - -module.exports = { - env: { - node: true, - mocha: true - }, - parserOptions: { - ecmaVersion: 8, - sourceType: 'script' - }, - extends: "eslint:recommended", - rules: { - indent: ['error', 4], - 'linebreak-style': ['error', 'unix'], - quotes: ['error', 'single'], - semi: ['error', 'always'], - 'no-unused-vars': ['error', { args: 'none' }], - 'no-console': 'off', - curly: 'error', - eqeqeq: 'error', - 'no-throw-literal': 'error', - strict: 'error', - 'no-var': 'error', - 'dot-notation': 'error', - 'no-tabs': 'error', - 'no-trailing-spaces': 'error', - 'no-use-before-define': 'error', - 'no-useless-call': 'error', - 'no-with': 'error', - 'operator-linebreak': 'error', - yoda: 'error', - 'quote-props': ['error', 'as-needed'] - } -}; \ No newline at end of file diff --git a/commercial-paper/organization/digibank/application/.gitignore b/commercial-paper/organization/digibank/application/.gitignore index b512c09d..e69de29b 100644 --- a/commercial-paper/organization/digibank/application/.gitignore +++ b/commercial-paper/organization/digibank/application/.gitignore @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/commercial-paper/organization/digibank/application/addToWallet.js b/commercial-paper/organization/digibank/application/addToWallet.js index 9517e393..e69de29b 100644 --- a/commercial-paper/organization/digibank/application/addToWallet.js +++ b/commercial-paper/organization/digibank/application/addToWallet.js @@ -1,55 +0,0 @@ -/* - * Copyright IBM Corp. All Rights Reserved. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict'; - -// Bring key classes into scope, most importantly Fabric SDK network class -const fs = require('fs'); -const { Wallets } = require('fabric-network'); -const path = require('path'); - -const fixtures = path.resolve(__dirname, '../../../../test-network'); - -async function main() { - - // Main try/catch block - try { - - // A wallet stores a collection of identities - const wallet = await Wallets.newFileSystemWallet('../identity/user/balaji/wallet'); - - // Identity to credentials to be stored in the wallet - const credPath = path.join(fixtures, '/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com'); - const certificate = fs.readFileSync(path.join(credPath, '/msp/signcerts/User1@org1.example.com-cert.pem')).toString(); - const privateKey = fs.readFileSync(path.join(credPath, '/msp/keystore/priv_sk')).toString(); - - // Load credentials into wallet - const identityLabel = 'balaji'; - - const identity = { - credentials: { - certificate, - privateKey - }, - mspId: 'Org1MSP', - type: 'X.509' - } - - await wallet.put(identityLabel, identity); - - } catch (error) { - console.log(`Error adding to wallet. ${error}`); - console.log(error.stack); - } -} - -main().then(() => { - console.log('done'); -}).catch((e) => { - console.log(e); - console.log(e.stack); - process.exit(-1); -}); diff --git a/commercial-paper/organization/digibank/application/enrollUser.js b/commercial-paper/organization/digibank/application/enrollUser.js index 2df5d6a4..e69de29b 100644 --- a/commercial-paper/organization/digibank/application/enrollUser.js +++ b/commercial-paper/organization/digibank/application/enrollUser.js @@ -1,56 +0,0 @@ -/* - * Copyright IBM Corp. All Rights Reserved. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict'; - -const FabricCAServices = require('fabric-ca-client'); -const { Wallets } = require('fabric-network'); -const fs = require('fs'); -const yaml = require('js-yaml'); -const path = require('path'); - -async function main() { - try { - // load the network configuration - let connectionProfile = yaml.safeLoad(fs.readFileSync('../gateway/connection-org1.yaml', 'utf8')); - - // Create a new CA client for interacting with the CA. - const caInfo = connectionProfile.certificateAuthorities['ca.org1.example.com']; - const caTLSCACerts = caInfo.tlsCACerts.pem; - const ca = new FabricCAServices(caInfo.url, { trustedRoots: caTLSCACerts, verify: false }, caInfo.caName); - - // Create a new file system based wallet for managing identities. - const walletPath = path.join(process.cwd(), '../identity/user/balaji/wallet'); - const wallet = await Wallets.newFileSystemWallet(walletPath); - console.log(`Wallet path: ${walletPath}`); - - // Check to see if we've already enrolled the admin user. - const userExists = await wallet.get('balaji'); - if (userExists) { - console.log('An identity for the client user "balaji" already exists in the wallet'); - return; - } - - // Enroll the admin user, and import the new identity into the wallet. - const enrollment = await ca.enroll({ enrollmentID: 'user1', enrollmentSecret: 'user1pw' }); - const x509Identity = { - credentials: { - certificate: enrollment.certificate, - privateKey: enrollment.key.toBytes(), - }, - mspId: 'Org1MSP', - type: 'X.509', - }; - await wallet.put('balaji', x509Identity); - console.log('Successfully enrolled client user "balaji" and imported it into the wallet'); - - } catch (error) { - console.error(`Failed to enroll client user "balaji": ${error}`); - process.exit(1); - } -} - -main(); diff --git a/commercial-paper/organization/digibank/application/package.json b/commercial-paper/organization/digibank/application/package.json index 176c1ec0..e69de29b 100644 --- a/commercial-paper/organization/digibank/application/package.json +++ b/commercial-paper/organization/digibank/application/package.json @@ -1,20 +0,0 @@ -{ - "name": "nodejs", - "version": "1.0.0", - "description": "", - "main": "buy.js", - "scripts": { - "test": "rm -rf _idwallet && node addToWallet.js && node buy.js" - }, - "keywords": [], - "author": "", - "license": "Apache-2.0", - "dependencies": { - "fabric-network": "^2.2.4", - "fabric-ca-client": "^2.2.4", - "js-yaml": "^3.12.0" - }, - "devDependencies": { - "eslint": "^5.6.0" - } -} diff --git a/commercial-paper/organization/digibank/configuration/cli/monitordocker.sh b/commercial-paper/organization/digibank/configuration/cli/monitordocker.sh old mode 100755 new mode 100644 index 2cf82fbd..e69de29b --- a/commercial-paper/organization/digibank/configuration/cli/monitordocker.sh +++ b/commercial-paper/organization/digibank/configuration/cli/monitordocker.sh @@ -1,31 +0,0 @@ -#!/bin/bash - -# This script uses the logspout and http stream tools to let you watch the docker containers -# in action. -# -# More information at https://github.com/gliderlabs/logspout/tree/master/httpstream - -if [ -z "$1" ]; then - DOCKER_NETWORK=basicnetwork_basic -else - DOCKER_NETWORK="$1" -fi - -if [ -z "$2" ]; then - PORT=8000 -else - PORT="$2" -fi - -echo Starting monitoring on all containers on the network ${DOCKER_NETWORK} - -docker kill logspout 2> /dev/null 1>&2 || true -docker rm logspout 2> /dev/null 1>&2 || true - -docker run -d --name="logspout" \ - --volume=/var/run/docker.sock:/var/run/docker.sock \ - --publish=127.0.0.1:${PORT}:80 \ - --network ${DOCKER_NETWORK} \ - gliderlabs/logspout -sleep 3 -curl http://127.0.0.1:${PORT}/logs diff --git a/commercial-paper/organization/digibank/contract-java/.gitignore b/commercial-paper/organization/digibank/contract-java/.gitignore index ae1478ca..e69de29b 100644 --- a/commercial-paper/organization/digibank/contract-java/.gitignore +++ b/commercial-paper/organization/digibank/contract-java/.gitignore @@ -1,10 +0,0 @@ -# -# SPDX-License-Identifier: Apache-2.0 -# - -/.classpath -/.gradle/ -/.project -/.settings/ -/bin/ -/build/ diff --git a/commercial-paper/organization/digibank/contract-java/build.gradle b/commercial-paper/organization/digibank/contract-java/build.gradle index 65741879..e69de29b 100644 --- a/commercial-paper/organization/digibank/contract-java/build.gradle +++ b/commercial-paper/organization/digibank/contract-java/build.gradle @@ -1,37 +0,0 @@ -plugins { - id 'java-library-distribution' -} - -version '0.0.1' - -sourceCompatibility = 1.8 - -repositories { - mavenCentral() - maven { - url 'https://jitpack.io' - } - maven { - url "https://hyperledger.jfrog.io/hyperledger/fabric-maven" - } - -} - -dependencies { - compileOnly group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.+' - compile group: 'org.json', name: 'json', version: '20180813' - testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' - testImplementation 'org.assertj:assertj-core:3.11.1' - testImplementation 'org.mockito:mockito-core:2.+' -} - -test { - useJUnitPlatform() - testLogging { - events "passed", "skipped", "failed" - } -} - -tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters" -} diff --git a/commercial-paper/organization/digibank/contract-java/gradle/wrapper/gradle-wrapper.jar b/commercial-paper/organization/digibank/contract-java/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf0..e69de29b 100644 Binary files a/commercial-paper/organization/digibank/contract-java/gradle/wrapper/gradle-wrapper.jar and b/commercial-paper/organization/digibank/contract-java/gradle/wrapper/gradle-wrapper.jar differ diff --git a/commercial-paper/organization/digibank/contract-java/gradle/wrapper/gradle-wrapper.properties b/commercial-paper/organization/digibank/contract-java/gradle/wrapper/gradle-wrapper.properties index 7c4388a9..e69de29b 100644 --- a/commercial-paper/organization/digibank/contract-java/gradle/wrapper/gradle-wrapper.properties +++ b/commercial-paper/organization/digibank/contract-java/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/commercial-paper/organization/digibank/contract-java/gradlew b/commercial-paper/organization/digibank/contract-java/gradlew old mode 100755 new mode 100644 index 83f2acfd..e69de29b --- a/commercial-paper/organization/digibank/contract-java/gradlew +++ b/commercial-paper/organization/digibank/contract-java/gradlew @@ -1,188 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/commercial-paper/organization/digibank/contract-java/gradlew.bat b/commercial-paper/organization/digibank/contract-java/gradlew.bat index 24467a14..e69de29b 100644 --- a/commercial-paper/organization/digibank/contract-java/gradlew.bat +++ b/commercial-paper/organization/digibank/contract-java/gradlew.bat @@ -1,100 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/commercial-paper/organization/digibank/contract-java/settings.gradle b/commercial-paper/organization/digibank/contract-java/settings.gradle index 0c5f0723..e69de29b 100644 --- a/commercial-paper/organization/digibank/contract-java/settings.gradle +++ b/commercial-paper/organization/digibank/contract-java/settings.gradle @@ -1,2 +0,0 @@ -rootProject.name = 'papercontract' - diff --git a/commercial-paper/organization/digibank/contract-java/shadow-build.gradle b/commercial-paper/organization/digibank/contract-java/shadow-build.gradle index 160bf421..e69de29b 100644 --- a/commercial-paper/organization/digibank/contract-java/shadow-build.gradle +++ b/commercial-paper/organization/digibank/contract-java/shadow-build.gradle @@ -1,49 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - */ -plugins { - id 'com.github.johnrengelman.shadow' version '5.1.0' - id 'java' -} - - -version '0.0.1' - -sourceCompatibility = 1.8 - -repositories { - mavenCentral() - maven { - url 'https://jitpack.io' - } -} - -dependencies { - implementation group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.+' - implementation group: 'org.json', name: 'json', version: '20180813' - testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' - testImplementation 'org.assertj:assertj-core:3.11.1' - testImplementation 'org.mockito:mockito-core:2.+' -} - -test { - useJUnitPlatform() - testLogging { - events "passed", "skipped", "failed" - } -} - -shadowJar { - baseName = 'chaincode' - version = null - classifier = null - - manifest { - attributes 'Main-Class': 'org.hyperledger.fabric.contract.ContractRouter' - } -} - - -tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters" -} diff --git a/commercial-paper/organization/digibank/contract-java/src/main/java/org/example/CommercialPaperContext.java b/commercial-paper/organization/digibank/contract-java/src/main/java/org/example/CommercialPaperContext.java index 7a946f2f..e69de29b 100644 --- a/commercial-paper/organization/digibank/contract-java/src/main/java/org/example/CommercialPaperContext.java +++ b/commercial-paper/organization/digibank/contract-java/src/main/java/org/example/CommercialPaperContext.java @@ -1,15 +0,0 @@ -package org.example; - -import org.hyperledger.fabric.contract.Context; -import org.hyperledger.fabric.shim.ChaincodeStub; - -class CommercialPaperContext extends Context { - - public CommercialPaperContext(ChaincodeStub stub) { - super(stub); - this.paperList = new PaperList(this); - } - - public PaperList paperList; - -} \ No newline at end of file diff --git a/commercial-paper/organization/digibank/contract/.editorconfig b/commercial-paper/organization/digibank/contract/.editorconfig old mode 100755 new mode 100644 index 75a13be2..e69de29b --- a/commercial-paper/organization/digibank/contract/.editorconfig +++ b/commercial-paper/organization/digibank/contract/.editorconfig @@ -1,16 +0,0 @@ -# -# SPDX-License-Identifier: Apache-2.0 -# - -root = true - -[*] -indent_style = space -indent_size = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false diff --git a/commercial-paper/organization/digibank/contract/.eslintignore b/commercial-paper/organization/digibank/contract/.eslintignore index 15958470..e69de29b 100644 --- a/commercial-paper/organization/digibank/contract/.eslintignore +++ b/commercial-paper/organization/digibank/contract/.eslintignore @@ -1,5 +0,0 @@ -# -# SPDX-License-Identifier: Apache-2.0 -# - -coverage diff --git a/commercial-paper/organization/digibank/contract/.eslintrc.js b/commercial-paper/organization/digibank/contract/.eslintrc.js index 6772c660..e69de29b 100644 --- a/commercial-paper/organization/digibank/contract/.eslintrc.js +++ b/commercial-paper/organization/digibank/contract/.eslintrc.js @@ -1,37 +0,0 @@ -/* -SPDX-License-Identifier: Apache-2.0 -*/ - -module.exports = { - env: { - node: true, - mocha: true - }, - parserOptions: { - ecmaVersion: 8, - sourceType: 'script' - }, - extends: "eslint:recommended", - rules: { - indent: ['error', 4], - 'linebreak-style': ['error', 'unix'], - quotes: ['error', 'single'], - semi: ['error', 'always'], - 'no-unused-vars': ['error', { args: 'none' }], - 'no-console': 'off', - curly: 'error', - eqeqeq: 'error', - 'no-throw-literal': 'error', - strict: 'error', - 'no-var': 'error', - 'dot-notation': 'error', - 'no-tabs': 'error', - 'no-trailing-spaces': 'error', - 'no-use-before-define': 'error', - 'no-useless-call': 'error', - 'no-with': 'error', - 'operator-linebreak': 'error', - yoda: 'error', - 'quote-props': ['error', 'as-needed'] - } -}; diff --git a/commercial-paper/organization/digibank/contract/index.js b/commercial-paper/organization/digibank/contract/index.js index e0ea2c7e..e69de29b 100644 --- a/commercial-paper/organization/digibank/contract/index.js +++ b/commercial-paper/organization/digibank/contract/index.js @@ -1,10 +0,0 @@ -/* - * Copyright IBM Corp. All Rights Reserved. - * - * SPDX-License-Identifier: Apache-2.0 -*/ - -'use strict'; - -const cpcontract = require('./lib/papercontract.js'); -module.exports.contracts = [cpcontract]; diff --git a/commercial-paper/organization/digibank/digibank.sh b/commercial-paper/organization/digibank/digibank.sh old mode 100755 new mode 100644 index 1b977b12..e69de29b --- a/commercial-paper/organization/digibank/digibank.sh +++ b/commercial-paper/organization/digibank/digibank.sh @@ -1,38 +0,0 @@ -#!/bin/bash -# -# SPDX-License-Identifier: Apache-2.0 -# -TMPFILE=`mktemp` -shopt -s extglob - -function _exit(){ - printf "Exiting:%s\n" "$1" - exit -1 -} - -: ${CHANNEL_NAME:="mychannel"} -: ${DELAY:="3"} -: ${MAX_RETRY:="5"} -: ${VERBOSE:="false"} - -# Where am I? -DIR=${PWD} - -# Locate the test network -cd "${DIR}/../../../test-network" -env | sort > $TMPFILE - -OVERRIDE_ORG="1" -. ./scripts/envVar.sh - -parsePeerConnectionParameters 1 2 - -# set the fabric config path -export FABRIC_CFG_PATH="${DIR}/../../../config" -export PATH="${DIR}/../../../bin:${PWD}:$PATH" - -env | sort | comm -1 -3 $TMPFILE - | sed -E 's/(.*)=(.*)/export \1="\2"/' - -rm $TMPFILE - -cd "${DIR}" diff --git a/commercial-paper/organization/magnetocorp/.gitignore b/commercial-paper/organization/magnetocorp/.gitignore index 7d139014..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/.gitignore +++ b/commercial-paper/organization/magnetocorp/.gitignore @@ -1 +0,0 @@ -identity \ No newline at end of file diff --git a/commercial-paper/organization/magnetocorp/application-java/.gitignore b/commercial-paper/organization/magnetocorp/application-java/.gitignore index 2f7896d1..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/application-java/.gitignore +++ b/commercial-paper/organization/magnetocorp/application-java/.gitignore @@ -1 +0,0 @@ -target/ diff --git a/commercial-paper/organization/magnetocorp/application-java/.settings/org.eclipse.core.resources.prefs b/commercial-paper/organization/magnetocorp/application-java/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 7a531392..00000000 --- a/commercial-paper/organization/magnetocorp/application-java/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 -encoding/src=UTF-8 diff --git a/commercial-paper/organization/magnetocorp/application-java/.settings/org.eclipse.m2e.core.prefs b/commercial-paper/organization/magnetocorp/application-java/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1..00000000 --- a/commercial-paper/organization/magnetocorp/application-java/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/commercial-paper/organization/magnetocorp/application-java/pom.xml b/commercial-paper/organization/magnetocorp/application-java/pom.xml index 71cd8e10..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/application-java/pom.xml +++ b/commercial-paper/organization/magnetocorp/application-java/pom.xml @@ -1,96 +0,0 @@ - - 4.0.0 - commercial-paper - commercial-paper - 0.0.1-SNAPSHOT - - - - - 1.8 - UTF-8 - UTF-8 - - - 2.1.0 - - 2.1.0 - - - - - src - - - maven-compiler-plugin - 3.8.0 - - 1.8 - 1.8 - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.0 - - - - package - - shade - - - - - false - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - - - - - - jitpack.io - https://jitpack.io - - - - - - org.hyperledger.fabric - fabric-gateway-java - ${fabric-gateway-java.version} - - - - - org.hyperledger.fabric-chaincode-java - fabric-chaincode-shim - ${fabric-chaincode-java.version} - compile - - - - - org.json - json - 20180813 - - - - diff --git a/commercial-paper/organization/magnetocorp/application-java/src/org/magnetocorp/AddToWallet.java b/commercial-paper/organization/magnetocorp/application-java/src/org/magnetocorp/AddToWallet.java index 36d0c1f4..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/application-java/src/org/magnetocorp/AddToWallet.java +++ b/commercial-paper/organization/magnetocorp/application-java/src/org/magnetocorp/AddToWallet.java @@ -1,68 +0,0 @@ -/* -SPDX-License-Identifier: Apache-2.0 -*/ - -package org.magnetocorp; - -import java.io.IOException; -import java.io.Reader; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.security.InvalidKeyException; -import java.security.PrivateKey; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import org.hyperledger.fabric.gateway.Identities; -import org.hyperledger.fabric.gateway.Wallet; -import org.hyperledger.fabric.gateway.Wallets; -import org.hyperledger.fabric.gateway.Identity; - -public class AddToWallet { - - private static X509Certificate readX509Certificate(final Path certificatePath) throws IOException, CertificateException { - try (Reader certificateReader = Files.newBufferedReader(certificatePath, StandardCharsets.UTF_8)) { - return Identities.readX509Certificate(certificateReader); - } - } - - private static PrivateKey getPrivateKey(final Path privateKeyPath) throws IOException, InvalidKeyException { - try (Reader privateKeyReader = Files.newBufferedReader(privateKeyPath, StandardCharsets.UTF_8)) { - return Identities.readPrivateKey(privateKeyReader); - } - } - - public static void main(String[] args) { - try { - // A wallet stores a collection of identities - Path walletPath = Paths.get(".", "wallet"); - Wallet wallet = Wallets.newFileSystemWallet(walletPath); - - Path credentialPath = Paths.get("..", "..", "..",".." ,"test-network", "organizations", - "peerOrganizations", "org2.example.com", "users", "User1@org2.example.com", "msp"); - System.out.println("credentialPath: " + credentialPath.toString()); - Path certificatePath = credentialPath.resolve(Paths.get("signcerts", - "User1@org2.example.com-cert.pem")); - System.out.println("certificatePem: " + certificatePath.toString()); - Path privateKeyPath = credentialPath.resolve(Paths.get("keystore", - "priv_sk")); - - X509Certificate certificate = readX509Certificate(certificatePath); - PrivateKey privateKey = getPrivateKey(privateKeyPath); - - Identity identity = Identities.newX509Identity("Org2MSP", certificate, privateKey); - - - String identityLabel = "User1@org2.example.com"; - wallet.put(identityLabel, identity); - - System.out.println("Write wallet info into " + walletPath.toString() + " successfully."); - - } catch (IOException | CertificateException | InvalidKeyException e) { - System.err.println("Error adding to wallet"); - e.printStackTrace(); - } - } - -} \ No newline at end of file diff --git a/commercial-paper/organization/magnetocorp/application-java/src/org/magnetocorp/Issue.java b/commercial-paper/organization/magnetocorp/application-java/src/org/magnetocorp/Issue.java index cdc268ed..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/application-java/src/org/magnetocorp/Issue.java +++ b/commercial-paper/organization/magnetocorp/application-java/src/org/magnetocorp/Issue.java @@ -1,75 +0,0 @@ -/* -SPDX-License-Identifier: Apache-2.0 -*/ - -package org.magnetocorp; - -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Map; -import java.util.concurrent.TimeoutException; - -import org.hyperledger.fabric.gateway.Contract; -import org.hyperledger.fabric.gateway.Gateway; -import org.hyperledger.fabric.gateway.GatewayException; -import org.hyperledger.fabric.gateway.Network; -import org.hyperledger.fabric.gateway.Wallet; -import org.hyperledger.fabric.gateway.Wallets; -import org.papernet.CommercialPaper; - -public class Issue { - - private static final String ENVKEY="CONTRACT_NAME"; - - public static void main(String[] args) { - - String contractName="papercontract"; - // get the name of the contract, in case it is overridden - Map envvar = System.getenv(); - if (envvar.containsKey(ENVKEY)){ - contractName=envvar.get(ENVKEY); - } - - Gateway.Builder builder = Gateway.createBuilder(); - - try { - // A wallet stores a collection of identities - Path walletPath = Paths.get(".", "wallet"); - Wallet wallet = Wallets.newFileSystemWallet(walletPath); - System.out.println("Read wallet info from: " + walletPath.toString()); - - String userName = "User1@org2.example.com"; - - Path connectionProfile = Paths.get("..", "gateway", "connection-org2.yaml"); - - // Set connection options on the gateway builder - builder.identity(wallet, userName).networkConfig(connectionProfile).discovery(false); - - // Connect to gateway using application specified parameters - try(Gateway gateway = builder.connect()) { - - // Access PaperNet network - System.out.println("Use network channel: mychannel."); - Network network = gateway.getNetwork("mychannel"); - - // Get addressability to commercial paper contract - System.out.println("Use org.papernet.commercialpaper smart contract."); - Contract contract = network.getContract(contractName, "org.papernet.commercialpaper"); - - // Issue commercial paper - System.out.println("Submit commercial paper issue transaction."); - byte[] response = contract.submitTransaction("issue", "MagnetoCorp", "00001", "2020-05-31", "2020-11-30", "5000000"); - - // Process response - System.out.println("Process issue transaction response."); - CommercialPaper paper = CommercialPaper.deserialize(response); - System.out.println(paper); - } - } catch (GatewayException | IOException | TimeoutException | InterruptedException e) { - e.printStackTrace(); - System.exit(-1); - } - } - -} \ No newline at end of file diff --git a/commercial-paper/organization/magnetocorp/application/.eslintrc.js b/commercial-paper/organization/magnetocorp/application/.eslintrc.js index 22fbefc8..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/application/.eslintrc.js +++ b/commercial-paper/organization/magnetocorp/application/.eslintrc.js @@ -1,37 +0,0 @@ -/* -SPDX-License-Identifier: Apache-2.0 -*/ - -module.exports = { - env: { - node: true, - mocha: true - }, - parserOptions: { - ecmaVersion: 8, - sourceType: 'script' - }, - extends: "eslint:recommended", - rules: { - indent: ['error', 4], - 'linebreak-style': ['error', 'unix'], - quotes: ['error', 'single'], - semi: ['error', 'always'], - 'no-unused-vars': ['error', { args: 'none' }], - 'no-console': 'off', - curly: 'error', - eqeqeq: 'error', - 'no-throw-literal': 'error', - strict: 'error', - 'no-var': 'error', - 'dot-notation': 'error', - 'no-tabs': 'error', - 'no-trailing-spaces': 'error', - 'no-use-before-define': 'error', - 'no-useless-call': 'error', - 'no-with': 'error', - 'operator-linebreak': 'error', - yoda: 'error', - 'quote-props': ['error', 'as-needed'] - } -}; \ No newline at end of file diff --git a/commercial-paper/organization/magnetocorp/application/.gitignore b/commercial-paper/organization/magnetocorp/application/.gitignore index b512c09d..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/application/.gitignore +++ b/commercial-paper/organization/magnetocorp/application/.gitignore @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/commercial-paper/organization/magnetocorp/application/addToWallet.js b/commercial-paper/organization/magnetocorp/application/addToWallet.js index eb491238..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/application/addToWallet.js +++ b/commercial-paper/organization/magnetocorp/application/addToWallet.js @@ -1,55 +0,0 @@ -/* - * Copyright IBM Corp. All Rights Reserved. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict'; - -// Bring key classes into scope, most importantly Fabric SDK network class -const fs = require('fs'); -const { Wallets } = require('fabric-network'); -const path = require('path'); - -const fixtures = path.resolve(__dirname, '../../../../test-network'); - -async function main() { - - // Main try/catch block - try { - // A wallet stores a collection of identities - const wallet = await Wallets.newFileSystemWallet('../identity/user/isabella/wallet'); - - // Identity to credentials to be stored in the wallet - const credPath = path.join(fixtures, '/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com'); - const certificate = fs.readFileSync(path.join(credPath, '/msp/signcerts/User1@org2.example.com-cert.pem')).toString(); - const privateKey = fs.readFileSync(path.join(credPath, '/msp/keystore/priv_sk')).toString(); - - // Load credentials into wallet - const identityLabel = 'isabella'; - - const identity = { - credentials: { - certificate, - privateKey - }, - mspId: 'Org2MSP', - type: 'X.509' - } - - - await wallet.put(identityLabel,identity); - - } catch (error) { - console.log(`Error adding to wallet. ${error}`); - console.log(error.stack); - } -} - -main().then(() => { - console.log('done'); -}).catch((e) => { - console.log(e); - console.log(e.stack); - process.exit(-1); -}); diff --git a/commercial-paper/organization/magnetocorp/application/enrollUser.js b/commercial-paper/organization/magnetocorp/application/enrollUser.js index bb673f08..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/application/enrollUser.js +++ b/commercial-paper/organization/magnetocorp/application/enrollUser.js @@ -1,56 +0,0 @@ -/* - * Copyright IBM Corp. All Rights Reserved. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict'; - -const FabricCAServices = require('fabric-ca-client'); -const { Wallets } = require('fabric-network'); -const fs = require('fs'); -const yaml = require('js-yaml'); -const path = require('path'); - -async function main() { - try { - // load the network configuration - let connectionProfile = yaml.safeLoad(fs.readFileSync('../gateway/connection-org2.yaml', 'utf8')); - - // Create a new CA client for interacting with the CA. - const caInfo = connectionProfile.certificateAuthorities['ca.org2.example.com']; - const caTLSCACerts = caInfo.tlsCACerts.pem; - const ca = new FabricCAServices(caInfo.url, { trustedRoots: caTLSCACerts, verify: false }, caInfo.caName); - - // Create a new file system based wallet for managing identities. - const walletPath = path.join(process.cwd(), '../identity/user/isabella/wallet'); - const wallet = await Wallets.newFileSystemWallet(walletPath); - console.log(`Wallet path: ${walletPath}`); - - // Check to see if we've already enrolled the admin user. - const userExists = await wallet.get('isabella'); - if (userExists) { - console.log('An identity for the client user "user1" already exists in the wallet'); - return; - } - - // Enroll the admin user, and import the new identity into the wallet. - const enrollment = await ca.enroll({ enrollmentID: 'user1', enrollmentSecret: 'user1pw' }); - const x509Identity = { - credentials: { - certificate: enrollment.certificate, - privateKey: enrollment.key.toBytes(), - }, - mspId: 'Org2MSP', - type: 'X.509', - }; - await wallet.put('isabella', x509Identity); - console.log('Successfully enrolled client user "isabella" and imported it into the wallet'); - - } catch (error) { - console.error(`Failed to enroll client user "isabella": ${error}`); - process.exit(1); - } -} - -main(); diff --git a/commercial-paper/organization/magnetocorp/application/package.json b/commercial-paper/organization/magnetocorp/application/package.json index f8fac560..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/application/package.json +++ b/commercial-paper/organization/magnetocorp/application/package.json @@ -1,20 +0,0 @@ -{ - "name": "nodejs", - "version": "1.0.0", - "description": "", - "main": "issue.js", - "scripts": { - "test": "rm -rf _idwallet && node addToWallet.js && node issue.js" - }, - "keywords": [], - "author": "", - "license": "Apache-2.0", - "dependencies": { - "fabric-network": "^2.2.4", - "fabric-ca-client": "^2.2.4", - "js-yaml": "^3.12.0" - }, - "devDependencies": { - "eslint": "^5.6.0" - } -} diff --git a/commercial-paper/organization/magnetocorp/configuration/cli/docker-compose.yml b/commercial-paper/organization/magnetocorp/configuration/cli/docker-compose.yml index cdbc0511..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/configuration/cli/docker-compose.yml +++ b/commercial-paper/organization/magnetocorp/configuration/cli/docker-compose.yml @@ -1,37 +0,0 @@ -# -# Copyright IBM Corp All Rights Reserved -# -# SPDX-License-Identifier: Apache-2.0 -# -version: '2' - -networks: - basic: - external: - name: fabric_test - -services: - cliMagnetoCorp: - container_name: cliMagnetoCorp - image: hyperledger/fabric-tools:2.0.0-beta - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=info - - CORE_PEER_ID=cli - - CORE_PEER_ADDRESS=peer0.org2.example.com:9051 - - CORE_PEER_LOCALMSPID=Org2MSP - - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp - - CORE_CHAINCODE_KEEPALIVE=10 - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt - - ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem - working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ./../../../../organization/magnetocorp:/opt/gopath/src/github.com/ - - ./../../../../../test-network/organizations:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ - networks: - - test diff --git a/commercial-paper/organization/magnetocorp/configuration/cli/monitordocker.sh b/commercial-paper/organization/magnetocorp/configuration/cli/monitordocker.sh old mode 100755 new mode 100644 index 6f8ba0e4..e69de29b --- a/commercial-paper/organization/magnetocorp/configuration/cli/monitordocker.sh +++ b/commercial-paper/organization/magnetocorp/configuration/cli/monitordocker.sh @@ -1,31 +0,0 @@ -#!/bin/bash - -# This script uses the logspout and http stream tools to let you watch the docker containers -# in action. -# -# More information at https://github.com/gliderlabs/logspout/tree/master/httpstream - -if [ -z "$1" ]; then - DOCKER_NETWORK=fabric_test -else - DOCKER_NETWORK="$1" -fi - -if [ -z "$2" ]; then - PORT=8000 -else - PORT="$2" -fi - -echo Starting monitoring on all containers on the network ${DOCKER_NETWORK} - -docker kill logspout 2> /dev/null 1>&2 || true -docker rm logspout 2> /dev/null 1>&2 || true - -docker run -d --name="logspout" \ - --volume=/var/run/docker.sock:/var/run/docker.sock \ - --publish=127.0.0.1:${PORT}:80 \ - --network ${DOCKER_NETWORK} \ - gliderlabs/logspout -sleep 3 -curl http://127.0.0.1:${PORT}/logs diff --git a/commercial-paper/organization/magnetocorp/contract-java/build.gradle b/commercial-paper/organization/magnetocorp/contract-java/build.gradle index 160bf421..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/contract-java/build.gradle +++ b/commercial-paper/organization/magnetocorp/contract-java/build.gradle @@ -1,49 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - */ -plugins { - id 'com.github.johnrengelman.shadow' version '5.1.0' - id 'java' -} - - -version '0.0.1' - -sourceCompatibility = 1.8 - -repositories { - mavenCentral() - maven { - url 'https://jitpack.io' - } -} - -dependencies { - implementation group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.+' - implementation group: 'org.json', name: 'json', version: '20180813' - testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' - testImplementation 'org.assertj:assertj-core:3.11.1' - testImplementation 'org.mockito:mockito-core:2.+' -} - -test { - useJUnitPlatform() - testLogging { - events "passed", "skipped", "failed" - } -} - -shadowJar { - baseName = 'chaincode' - version = null - classifier = null - - manifest { - attributes 'Main-Class': 'org.hyperledger.fabric.contract.ContractRouter' - } -} - - -tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters" -} diff --git a/commercial-paper/organization/magnetocorp/contract-java/gradle/wrapper/gradle-wrapper.jar b/commercial-paper/organization/magnetocorp/contract-java/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf0..e69de29b 100644 Binary files a/commercial-paper/organization/magnetocorp/contract-java/gradle/wrapper/gradle-wrapper.jar and b/commercial-paper/organization/magnetocorp/contract-java/gradle/wrapper/gradle-wrapper.jar differ diff --git a/commercial-paper/organization/magnetocorp/contract-java/gradle/wrapper/gradle-wrapper.properties b/commercial-paper/organization/magnetocorp/contract-java/gradle/wrapper/gradle-wrapper.properties index 7c4388a9..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/contract-java/gradle/wrapper/gradle-wrapper.properties +++ b/commercial-paper/organization/magnetocorp/contract-java/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/commercial-paper/organization/magnetocorp/contract-java/gradlew b/commercial-paper/organization/magnetocorp/contract-java/gradlew old mode 100755 new mode 100644 index 83f2acfd..e69de29b --- a/commercial-paper/organization/magnetocorp/contract-java/gradlew +++ b/commercial-paper/organization/magnetocorp/contract-java/gradlew @@ -1,188 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/commercial-paper/organization/magnetocorp/contract-java/gradlew.bat b/commercial-paper/organization/magnetocorp/contract-java/gradlew.bat index 24467a14..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/contract-java/gradlew.bat +++ b/commercial-paper/organization/magnetocorp/contract-java/gradlew.bat @@ -1,100 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/commercial-paper/organization/magnetocorp/contract-java/settings.gradle b/commercial-paper/organization/magnetocorp/contract-java/settings.gradle index 0c5f0723..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/contract-java/settings.gradle +++ b/commercial-paper/organization/magnetocorp/contract-java/settings.gradle @@ -1,2 +0,0 @@ -rootProject.name = 'papercontract' - diff --git a/commercial-paper/organization/magnetocorp/contract-java/src/main/java/org/example/CommercialPaperContext.java b/commercial-paper/organization/magnetocorp/contract-java/src/main/java/org/example/CommercialPaperContext.java index 7a946f2f..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/contract-java/src/main/java/org/example/CommercialPaperContext.java +++ b/commercial-paper/organization/magnetocorp/contract-java/src/main/java/org/example/CommercialPaperContext.java @@ -1,15 +0,0 @@ -package org.example; - -import org.hyperledger.fabric.contract.Context; -import org.hyperledger.fabric.shim.ChaincodeStub; - -class CommercialPaperContext extends Context { - - public CommercialPaperContext(ChaincodeStub stub) { - super(stub); - this.paperList = new PaperList(this); - } - - public PaperList paperList; - -} \ No newline at end of file diff --git a/commercial-paper/organization/magnetocorp/contract/.editorconfig b/commercial-paper/organization/magnetocorp/contract/.editorconfig old mode 100755 new mode 100644 index 75a13be2..e69de29b --- a/commercial-paper/organization/magnetocorp/contract/.editorconfig +++ b/commercial-paper/organization/magnetocorp/contract/.editorconfig @@ -1,16 +0,0 @@ -# -# SPDX-License-Identifier: Apache-2.0 -# - -root = true - -[*] -indent_style = space -indent_size = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false diff --git a/commercial-paper/organization/magnetocorp/contract/.eslintignore b/commercial-paper/organization/magnetocorp/contract/.eslintignore index 15958470..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/contract/.eslintignore +++ b/commercial-paper/organization/magnetocorp/contract/.eslintignore @@ -1,5 +0,0 @@ -# -# SPDX-License-Identifier: Apache-2.0 -# - -coverage diff --git a/commercial-paper/organization/magnetocorp/contract/.eslintrc.js b/commercial-paper/organization/magnetocorp/contract/.eslintrc.js index 6772c660..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/contract/.eslintrc.js +++ b/commercial-paper/organization/magnetocorp/contract/.eslintrc.js @@ -1,37 +0,0 @@ -/* -SPDX-License-Identifier: Apache-2.0 -*/ - -module.exports = { - env: { - node: true, - mocha: true - }, - parserOptions: { - ecmaVersion: 8, - sourceType: 'script' - }, - extends: "eslint:recommended", - rules: { - indent: ['error', 4], - 'linebreak-style': ['error', 'unix'], - quotes: ['error', 'single'], - semi: ['error', 'always'], - 'no-unused-vars': ['error', { args: 'none' }], - 'no-console': 'off', - curly: 'error', - eqeqeq: 'error', - 'no-throw-literal': 'error', - strict: 'error', - 'no-var': 'error', - 'dot-notation': 'error', - 'no-tabs': 'error', - 'no-trailing-spaces': 'error', - 'no-use-before-define': 'error', - 'no-useless-call': 'error', - 'no-with': 'error', - 'operator-linebreak': 'error', - yoda: 'error', - 'quote-props': ['error', 'as-needed'] - } -}; diff --git a/commercial-paper/organization/magnetocorp/contract/index.js b/commercial-paper/organization/magnetocorp/contract/index.js index e0ea2c7e..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/contract/index.js +++ b/commercial-paper/organization/magnetocorp/contract/index.js @@ -1,10 +0,0 @@ -/* - * Copyright IBM Corp. All Rights Reserved. - * - * SPDX-License-Identifier: Apache-2.0 -*/ - -'use strict'; - -const cpcontract = require('./lib/papercontract.js'); -module.exports.contracts = [cpcontract]; diff --git a/commercial-paper/organization/magnetocorp/magnetocorp.sh b/commercial-paper/organization/magnetocorp/magnetocorp.sh old mode 100755 new mode 100644 index c061d275..e69de29b --- a/commercial-paper/organization/magnetocorp/magnetocorp.sh +++ b/commercial-paper/organization/magnetocorp/magnetocorp.sh @@ -1,38 +0,0 @@ -#!/bin/bash -# -# SPDX-License-Identifier: Apache-2.0 -TMPFILE=`mktemp` -shopt -s extglob - -function _exit(){ - printf "Exiting:%s\n" "$1" - exit -1 -} - - -: ${CHANNEL_NAME:="mychannel"} -: ${DELAY:="3"} -: ${MAX_RETRY:="5"} -: ${VERBOSE:="false"} - -# Where am I? -DIR=${PWD} - -# Locate the test-network -cd "${DIR}/../../../test-network" -env | sort > $TMPFILE - -OVERRIDE_ORG="2" -. ./scripts/envVar.sh - - -parsePeerConnectionParameters 1 2 - -# set the fabric config path -export FABRIC_CFG_PATH="${DIR}/../../../config" -export PATH="${DIR}/../../../bin:${PWD}:$PATH" - -env | sort | comm -1 -3 $TMPFILE - | sed -E 's/(.*)=(.*)/export \1="\2"/' -rm $TMPFILE - -cd "${DIR}" diff --git a/commercial-paper/organization/magnetocorp/t.js b/commercial-paper/organization/magnetocorp/t.js index 031abd31..e69de29b 100644 --- a/commercial-paper/organization/magnetocorp/t.js +++ b/commercial-paper/organization/magnetocorp/t.js @@ -1 +0,0 @@ -console.log(process.argv); \ No newline at end of file