mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-25 19:15:10 +00:00
Remove file transfer files from commercial paper
Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com>
This commit is contained in:
parent
cda88df4f6
commit
e1d1951c5b
7 changed files with 37 additions and 142 deletions
|
|
@ -18,7 +18,7 @@ steps:
|
||||||
displayName: Vendor DigiBank Dependencies
|
displayName: Vendor DigiBank Dependencies
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
./network.sh up createChannel -s couchdb -i ${FABRIC_VERSION} # FABRIC_VERSION is set in ci/azure-pipelines.yml
|
./network.sh up createChannel -ca -s couchdb -i ${FABRIC_VERSION} # FABRIC_VERSION is set in ci/azure-pipelines.yml
|
||||||
|
|
||||||
# Copy the connection profiles so they are in the correct organizations.
|
# Copy the connection profiles so they are in the correct organizations.
|
||||||
cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/"
|
cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/"
|
||||||
|
|
@ -80,7 +80,7 @@ steps:
|
||||||
displayName: Install Magnetocorp Application
|
displayName: Install Magnetocorp Application
|
||||||
- script: |
|
- script: |
|
||||||
set -ex
|
set -ex
|
||||||
node addToWallet.js
|
node enrollUser.js
|
||||||
node issue.js
|
node issue.js
|
||||||
workingDirectory: commercial-paper/organization/magnetocorp/application
|
workingDirectory: commercial-paper/organization/magnetocorp/application
|
||||||
displayName: MagnetoCorp Issue Paper
|
displayName: MagnetoCorp Issue Paper
|
||||||
|
|
@ -90,7 +90,7 @@ steps:
|
||||||
displayName: Install DigiBank Application
|
displayName: Install DigiBank Application
|
||||||
- script: |
|
- script: |
|
||||||
set -ex
|
set -ex
|
||||||
node addToWallet.js
|
node enrollUser.js
|
||||||
node buy.js
|
node buy.js
|
||||||
node redeem.js
|
node redeem.js
|
||||||
workingDirectory: commercial-paper/organization/digibank/application
|
workingDirectory: commercial-paper/organization/digibank/application
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,12 @@ steps:
|
||||||
displayName: Build MagnetoCorp Java Contract
|
displayName: Build MagnetoCorp Java Contract
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
./network.sh up createChannel -s couchdb -i ${FABRIC_VERSION} # FABRIC_VERSION is set in ci/azure-pipelines.yml
|
./network.sh up createChannel -ca -s couchdb -i ${FABRIC_VERSION} # FABRIC_VERSION is set in ci/azure-pipelines.yml
|
||||||
|
|
||||||
# Copy the connection profiles so they are in the correct organizations.
|
# Copy the connection profiles so they are in the correct organizations.
|
||||||
cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/"
|
cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/"
|
||||||
cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/"
|
cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/"
|
||||||
|
|
||||||
workingDirectory: test-network
|
workingDirectory: test-network
|
||||||
displayName: Start Fabric
|
displayName: Start Fabric
|
||||||
- script: |
|
- script: |
|
||||||
|
|
@ -75,7 +76,7 @@ steps:
|
||||||
displayName: Install MagnetoCorp Application
|
displayName: Install MagnetoCorp Application
|
||||||
- script: |
|
- script: |
|
||||||
set -ex
|
set -ex
|
||||||
node addToWallet.js
|
node enrollUser.js
|
||||||
node issue.js
|
node issue.js
|
||||||
workingDirectory: commercial-paper/organization/magnetocorp/application
|
workingDirectory: commercial-paper/organization/magnetocorp/application
|
||||||
displayName: MagnetoCorp Issue Paper
|
displayName: MagnetoCorp Issue Paper
|
||||||
|
|
@ -85,7 +86,7 @@ steps:
|
||||||
displayName: Install DigiBank Application
|
displayName: Install DigiBank Application
|
||||||
- script: |
|
- script: |
|
||||||
set -ex
|
set -ex
|
||||||
node addToWallet.js
|
node enrollUser.js
|
||||||
node buy.js
|
node buy.js
|
||||||
node redeem.js
|
node redeem.js
|
||||||
workingDirectory: commercial-paper/organization/digibank/application
|
workingDirectory: commercial-paper/organization/digibank/application
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,12 @@
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- script: |
|
- script: |
|
||||||
./network.sh up createChannel -s couchdb -i ${FABRIC_VERSION} # FABRIC_VERSION is set in ci/azure-pipelines.yml
|
./network.sh up createChannel -ca -s couchdb -i ${FABRIC_VERSION} # FABRIC_VERSION is set in ci/azure-pipelines.yml
|
||||||
|
|
||||||
# Copy the connection profiles so they are in the correct organizations.
|
# Copy the connection profiles so they are in the correct organizations.
|
||||||
cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/"
|
cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/"
|
||||||
cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/"
|
cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/"
|
||||||
|
|
||||||
workingDirectory: test-network
|
workingDirectory: test-network
|
||||||
displayName: Start Fabric
|
displayName: Start Fabric
|
||||||
- script: |
|
- script: |
|
||||||
|
|
@ -65,7 +66,7 @@ steps:
|
||||||
displayName: Install MagnetoCorp Application
|
displayName: Install MagnetoCorp Application
|
||||||
- script: |
|
- script: |
|
||||||
set -ex
|
set -ex
|
||||||
node addToWallet.js
|
node enrollUser.js
|
||||||
node issue.js
|
node issue.js
|
||||||
workingDirectory: commercial-paper/organization/magnetocorp/application
|
workingDirectory: commercial-paper/organization/magnetocorp/application
|
||||||
displayName: MagnetoCorp Issue Paper
|
displayName: MagnetoCorp Issue Paper
|
||||||
|
|
@ -75,7 +76,7 @@ steps:
|
||||||
displayName: Install DigiBank Application
|
displayName: Install DigiBank Application
|
||||||
- script: |
|
- script: |
|
||||||
set -ex
|
set -ex
|
||||||
node addToWallet.js
|
node enrollUser.js
|
||||||
node buy.js
|
node buy.js
|
||||||
node redeem.js
|
node redeem.js
|
||||||
workingDirectory: commercial-paper/organization/digibank/application
|
workingDirectory: commercial-paper/organization/digibank/application
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ This is running as *MagnetoCorp* These commands are to be run in the
|
||||||
*Add the Identity to be used*
|
*Add the Identity to be used*
|
||||||
|
|
||||||
```
|
```
|
||||||
node addToWallet.js
|
node enrollUser.js
|
||||||
# or
|
# or
|
||||||
java -cp target/commercial-paper-0.0.1-SNAPSHOT.jar org.magnetocorp.AddToWallet
|
java -cp target/commercial-paper-0.0.1-SNAPSHOT.jar org.magnetocorp.AddToWallet
|
||||||
```
|
```
|
||||||
|
|
@ -252,7 +252,7 @@ You can now run the applications to buy and redeem the paper. Change to either t
|
||||||
*Add the Identity to be used*
|
*Add the Identity to be used*
|
||||||
|
|
||||||
```
|
```
|
||||||
node addToWallet.js
|
node enrollUser.js
|
||||||
# or
|
# or
|
||||||
java -cp target/commercial-paper-0.0.1-SNAPSHOT.jar org.digibank.AddToWallet
|
java -cp target/commercial-paper-0.0.1-SNAPSHOT.jar org.digibank.AddToWallet
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,14 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
export FABRIC_CFG_PATH="${DIR}/../config"
|
export FABRIC_CFG_PATH="${DIR}/../config"
|
||||||
|
|
||||||
cd "${DIR}/../test-network/"
|
pushd "${DIR}/../test-network/"
|
||||||
|
|
||||||
docker kill cliDigiBank cliMagnetoCorp logspout || true
|
docker kill cliDigiBank cliMagnetoCorp logspout || true
|
||||||
./network.sh down
|
./network.sh down
|
||||||
|
popd
|
||||||
|
|
||||||
|
rm -rf organization/magnetocorp/identity/
|
||||||
|
rm -rf organization/digibank/identity/
|
||||||
|
|
||||||
# remove any stopped containers
|
# remove any stopped containers
|
||||||
docker rm $(docker ps -aq)
|
docker rm $(docker ps -aq)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
|
||||||
});
|
|
||||||
|
|
@ -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);
|
|
||||||
});
|
|
||||||
Loading…
Reference in a new issue