From 42f9cb5d98ffc7a889719db1742cf08cac3bc714 Mon Sep 17 00:00:00 2001 From: Takuma TAKEUCHI Date: Tue, 8 Dec 2020 08:44:10 +0900 Subject: [PATCH] feat(validator, tools): validators including execSyncFunction and test-tools for sample app Signed-off-by: Takuma TAKEUCHI --- examples/cartrade/BusinessLogicCartrade.ts | 10 +- examples/cartrade/README.md | 55 +++----- examples/cartrade/TransactionEthereum.ts | 5 +- ...ba34711c73899d182951ec634fcc918855738-priv | 5 + examples/cartrade/build/wallet/admin/admin | 1 + ...8e1df521c6ba8b78e43a2eedc7fe152c3d407-priv | 5 + ...f8e1df521c6ba8b78e43a2eedc7fe152c3d407-pub | 4 + ...ba34711c73899d182951ec634fcc918855738-priv | 5 + ...2ba34711c73899d182951ec634fcc918855738-pub | 4 + examples/cartrade/build/wallet/user1/user1 | 1 + examples/cartrade/package.json | 118 +++--------------- examples/cartrade/script-build-all.sh | 19 +++ examples/cartrade/script-build-cartrade.sh | 4 + .../cartrade/script-post-cartrade-sample.sh | 1 + examples/cartrade/script-start-cartrade.sh | 7 ++ examples/cartrade/script-start-ledgers.sh | 8 ++ .../script-start-validator-ethereum.sh | 5 + .../cartrade/script-start-validator-fabric.sh | 5 + packages/script-build-packages.sh | 4 + .../docker/fabric14-fabcar-testnet/.gitignore | 4 + .../docker/fabric14-fabcar-testnet/README.md | 79 ++++++++++++ .../script-start-docker.sh | 9 ++ .../docker/fabric14-fabcar-testnet/wallet.tar | Bin 0 -> 20480 bytes ...ba34711c73899d182951ec634fcc918855738-priv | 5 + .../wallet/admin/admin | 1 + ...8e1df521c6ba8b78e43a2eedc7fe152c3d407-priv | 5 + ...f8e1df521c6ba8b78e43a2eedc7fe152c3d407-pub | 4 + ...ba34711c73899d182951ec634fcc918855738-priv | 5 + ...2ba34711c73899d182951ec634fcc918855738-pub | 4 + .../wallet/user1/user1 | 1 + tools/docker/geth-testnet/.gitignore | 5 + tools/docker/geth-testnet/README.md | 102 +++++++++++++++ .../geth-testnet/data-geth1/genesis.json | 20 +++ ...--ec709e1774f0ce4aba47b52a499f9abaaa159f71 | 1 + ...--36e146d5afab61ab125ee671708eeb380aea05b6 | 1 + ...--06fc56347d91c6ad2dae0c3ba38eb12ab0d72e97 | 1 + ...--9d624f7995e8bd70251f8265f2f9f2b49f169c55 | 1 + ...--2666a32bf7594ab5395d766dcfbf03d557dab538 | 1 + tools/docker/geth-testnet/docker-compose.yml | 42 +++++++ tools/docker/geth-testnet/docker-init.yml | 15 +++ .../geth-testnet/script-start-docker.sh | 3 + tools/docker/geth-testnet/script/delete.sh | 6 + tools/docker/geth-testnet/script/down.sh | 4 + .../docker/geth-testnet/script/init-chain.sh | 3 + tools/docker/geth-testnet/script/logview.sh | 3 + tools/docker/geth-testnet/script/up.sh | 4 + 46 files changed, 448 insertions(+), 147 deletions(-) create mode 100644 examples/cartrade/build/wallet/admin/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv create mode 100644 examples/cartrade/build/wallet/admin/admin create mode 100644 examples/cartrade/build/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-priv create mode 100644 examples/cartrade/build/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-pub create mode 100644 examples/cartrade/build/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv create mode 100644 examples/cartrade/build/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-pub create mode 100644 examples/cartrade/build/wallet/user1/user1 create mode 100755 examples/cartrade/script-build-all.sh create mode 100755 examples/cartrade/script-build-cartrade.sh create mode 100755 examples/cartrade/script-post-cartrade-sample.sh create mode 100755 examples/cartrade/script-start-cartrade.sh create mode 100755 examples/cartrade/script-start-ledgers.sh create mode 100755 examples/cartrade/script-start-validator-ethereum.sh create mode 100755 examples/cartrade/script-start-validator-fabric.sh create mode 100755 packages/script-build-packages.sh create mode 100644 tools/docker/fabric14-fabcar-testnet/.gitignore create mode 100644 tools/docker/fabric14-fabcar-testnet/README.md create mode 100755 tools/docker/fabric14-fabcar-testnet/script-start-docker.sh create mode 100644 tools/docker/fabric14-fabcar-testnet/wallet.tar create mode 100644 tools/docker/fabric14-fabcar-testnet/wallet/admin/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv create mode 100644 tools/docker/fabric14-fabcar-testnet/wallet/admin/admin create mode 100644 tools/docker/fabric14-fabcar-testnet/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-priv create mode 100644 tools/docker/fabric14-fabcar-testnet/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-pub create mode 100644 tools/docker/fabric14-fabcar-testnet/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv create mode 100644 tools/docker/fabric14-fabcar-testnet/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-pub create mode 100644 tools/docker/fabric14-fabcar-testnet/wallet/user1/user1 create mode 100644 tools/docker/geth-testnet/.gitignore create mode 100644 tools/docker/geth-testnet/README.md create mode 100644 tools/docker/geth-testnet/data-geth1/genesis.json create mode 100644 tools/docker/geth-testnet/data-geth1/keystore/account0--ec709e1774f0ce4aba47b52a499f9abaaa159f71 create mode 100644 tools/docker/geth-testnet/data-geth1/keystore/account1--36e146d5afab61ab125ee671708eeb380aea05b6 create mode 100644 tools/docker/geth-testnet/data-geth1/keystore/account2--06fc56347d91c6ad2dae0c3ba38eb12ab0d72e97 create mode 100644 tools/docker/geth-testnet/data-geth1/keystore/account3--9d624f7995e8bd70251f8265f2f9f2b49f169c55 create mode 100644 tools/docker/geth-testnet/data-geth1/keystore/account4--2666a32bf7594ab5395d766dcfbf03d557dab538 create mode 100644 tools/docker/geth-testnet/docker-compose.yml create mode 100644 tools/docker/geth-testnet/docker-init.yml create mode 100755 tools/docker/geth-testnet/script-start-docker.sh create mode 100755 tools/docker/geth-testnet/script/delete.sh create mode 100755 tools/docker/geth-testnet/script/down.sh create mode 100755 tools/docker/geth-testnet/script/init-chain.sh create mode 100755 tools/docker/geth-testnet/script/logview.sh create mode 100755 tools/docker/geth-testnet/script/up.sh diff --git a/examples/cartrade/BusinessLogicCartrade.ts b/examples/cartrade/BusinessLogicCartrade.ts index d955ba603d2..570a36b40b8 100644 --- a/examples/cartrade/BusinessLogicCartrade.ts +++ b/examples/cartrade/BusinessLogicCartrade.ts @@ -172,12 +172,14 @@ export class BusinessLogicCartrade extends BusinessLogicBase { const transactionData: TransactionData = new TransactionData("transfer", "ledger002", result.txId); this.transactionInfoManagement.setTransactionData(tradeInfo, transactionData); - // Set LedgerOperation - // logger.debug('secondTransaction data : ' + JSON.stringify(result.data)); - const ledgerOperation: LedgerOperation = new LedgerOperation("sendSignedProposal", "", result.data); + // Set Parameter + //logger.debug('secondTransaction data : ' + JSON.stringify(result.data)); + const contract = {"channelName": "mychannel"}; + const method = {"method": "sendSignedProposal"}; + const args = {"args": [result.data]}; // Run Verifier (Fabric) - verifierFabric.requestLedgerOperation(ledgerOperation); + verifierFabric.requestLedgerOperationNeo(contract, method, args); }) .catch(err => { logger.error(err); diff --git a/examples/cartrade/README.md b/examples/cartrade/README.md index eb400dae779..c965e0850df 100644 --- a/examples/cartrade/README.md +++ b/examples/cartrade/README.md @@ -1,46 +1,23 @@ # example-cartrade -## Premise -- Launch two Validators (For Ethereum and Fabric) - - for Ethereum: - - `/packages/ledger-plugin/go-ethereum-ts/validator` - - "validatorUrl": `https://localhost:5050`, - 1. cd `/packages/ledger-plugin/go-ethereum-ts/validator/src` - 1. npm install - 1. npm run build - 1. npm run start - - for Fabric: - - `/packages/ledger-plugin/fabric/validator` - - "validatorUrl": `https://localhost:5040`, - -- The following drivers are operating normally (* It is also necessary to check the operation.). - - for Ethereum: - - `/packages/ledger-plugin/go-ethereum/validator/unit-test/validatorDriver_getNumericBalance.js` - - for Fabric: - - `/packages/ledger-plugin/fabric/validator/unit-test/queryCar.js` - - `/packages/ledger-plugin/fabric/validator/unit-test/validatorDriver_signTransactionOffline.js` - ## Boot method -1. cd `/packages` -1. npm install -1. Modify the following information for your environment + +1. Before booting, please modify the following information for your environment - applicationHostInfo.hostName (URL of the host on the Location header) on `/packages/config/default.json` - applicationHostInfo.hostPort (The port number of Routing-interface http server) on `/packages/config/default.json` -1. npm run package-build -1. cd BIF-trial/examples/cartrade -1. npm install -1. Modify the following information for your environment - - corrected escrow account information, etc. on `/examples/cartrade/config/default.json` - - cartradeInfo.fabric.submitter.certificate (certificate for admin) - - cartradeInfo.fabric.submitter.pkey (admin private key) - - carriadeInfo.ethereum.fromAddressPkey (private key of fromAddress) - - cartradeInfo.ethereum.escrowAddress (Address of the escrow account) - - carriadeInfo.ethereum.escrowAddressPkey (secret key of the escrow account) - - **NOTE**: The parameters which do not modified on `/examples/cartrade/config/usersetting.json` are specified by the parameters on `/packages/config/default.json` -1. npm run cartrade-build - - **NOTE**: The above operation `npm run cartrade-build` is operated for building a symbolic link of node_modules. So this operation only needs to be done once, and there is no need to do it a second time or later. -1. npm run start - - cartrade application boots on port 5034. + +1. Start ledgers: + - `./script-start-ledgers.sh` +1. Build validators, packages, and the cartrade app: + - `./script-build-all.sh` +1. Start validators and the cartrade app + - Please open three consoles and execute the following:. + - Start the validator for Fabric: + `./script-start-validator-fabric.sh` + - Start the validator for Ethereum: + `./script-start-validator-ethereum.sh` + - Start the cartrade app: + `./script-start-cartrade.sh` ## How to use this application - Run with curl, etc. Currently only POST is available. @@ -80,7 +57,7 @@ - Example output ``` ##queryCar Params: CAR1 - Transaction has been evaluated, result is: {"colour":"red","make":"Ford","model":"Mustang","owner":"fuser02"} + Transaction has been evaluated, result is: {"colour":"red","make":"Ford","model":"Mustang","owner":"user02"} ``` - How to change the ownership of the car by hand - ``/packages/ledger-plugin/fabric/validator/unit-test/validatorDriver_signTransactionOffline.js`` \ No newline at end of file diff --git a/examples/cartrade/TransactionEthereum.ts b/examples/cartrade/TransactionEthereum.ts index 3a9a35583d9..f538fcf8806 100644 --- a/examples/cartrade/TransactionEthereum.ts +++ b/examples/cartrade/TransactionEthereum.ts @@ -49,11 +49,13 @@ export function makeRawTransaction(txParam: { fromAddress: string, fromAddressPk // const gasPrice: string = web3.eth.getGasPrice(); const latestNonce = getLatestNonce(txParam.fromAddress); + logger.debug(`#####(A) _nonce: ${_nonce}, latestNonce: ${latestNonce}`); logger.debug(`####makeRawTransaction(): fromAddress: ${txParam.fromAddress}, txnCount: ${web3.utils.toHex(txnCount)}, latestNonce: ${web3.utils.toHex(latestNonce)}`); if (txnCount <= latestNonce) { txnCount = latestNonce + 1; logger.debug(`####makeRawTransaction(): Adjust txnCount, fromAddress: ${txParam.fromAddress}, txnCount: ${web3.utils.toHex(txnCount)}, latestNonce: ${web3.utils.toHex(latestNonce)}`); } + logger.debug(`#####(B) _nonce: ${_nonce}, latestNonce: ${latestNonce}, txnCount: ${txnCount}`); setLatestNonce(txParam.fromAddress, txnCount); const privKey: Buffer = Buffer.from(txParam.fromAddressPkey, 'hex'); @@ -97,7 +99,8 @@ function getLatestNonce(fromAddress: string): number { if (mapFromAddressNonce.has(fromAddress)) { return mapFromAddressNonce.get(fromAddress); } - return 0; + //return 0; + return -1; } function setLatestNonce(fromAddress: string, nonce: number): void { diff --git a/examples/cartrade/build/wallet/admin/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv b/examples/cartrade/build/wallet/admin/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv new file mode 100644 index 00000000000..db8746bcf64 --- /dev/null +++ b/examples/cartrade/build/wallet/admin/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgpPt9pQjjYIPHH28L +xAwI0ZAv5gVp0FlpVXuAeHfkstWhRANCAAQ2Q0fFCgt+iVPeXF25tvbi+CoMIImg +QL/WXFrUH3BXYTHtm1F4nw7E303lKuMYWH2ZPujqiceNqgeea0kZLNGP +-----END PRIVATE KEY----- diff --git a/examples/cartrade/build/wallet/admin/admin b/examples/cartrade/build/wallet/admin/admin new file mode 100644 index 00000000000..a8c651f7321 --- /dev/null +++ b/examples/cartrade/build/wallet/admin/admin @@ -0,0 +1 @@ +{"name":"admin","mspid":"Org1MSP","roles":null,"affiliation":"","enrollmentSecret":"","enrollment":{"signingIdentity":"fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407","identity":{"certificate":"-----BEGIN CERTIFICATE-----\nMIICAjCCAaigAwIBAgIUYcAcX63XaN2Omym6hEXF+Kxzx2QwCgYIKoZIzj0EAwIw\nczELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh\nbiBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMT\nE2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMjAwNzI3MTAzNDAwWhcNMjEwNzI3MTAz\nOTAwWjAhMQ8wDQYDVQQLEwZjbGllbnQxDjAMBgNVBAMTBWFkbWluMFkwEwYHKoZI\nzj0CAQYIKoZIzj0DAQcDQgAE0TjOYDQfDbAOU3wYNvxgeaTE/r88BieO5V4yu/6E\nJk4yBHscyaRCnrLZ9eqyFa5+3G5V0mA7hbTw48mdeMArsKNsMGowDgYDVR0PAQH/\nBAQDAgeAMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFBMOvw1wPpaBeZIpqc3AFbGs\nY0KMMCsGA1UdIwQkMCKAIEI5qg3NdtruuLoM2nAYUdFFBNMarRst3dusalc2Xkl8\nMAoGCCqGSM49BAMCA0gAMEUCIQDXvckX5bZ5mGPHpQ49aKSFsGJkwrX1BnW7DwA+\n4suQPQIgVGKIiQBQDGlOQHkt9lqno/yFiFZSjzZSS24LFIJNKU4=\n-----END CERTIFICATE-----\n"}}} \ No newline at end of file diff --git a/examples/cartrade/build/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-priv b/examples/cartrade/build/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-priv new file mode 100644 index 00000000000..c71cc9de30b --- /dev/null +++ b/examples/cartrade/build/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-priv @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgQ3pbxM94ZzHPEHW7 +5TQ1N/WfCLSgqY97dfyF34WiJz2hRANCAATROM5gNB8NsA5TfBg2/GB5pMT+vzwG +J47lXjK7/oQmTjIEexzJpEKestn16rIVrn7cblXSYDuFtPDjyZ14wCuw +-----END PRIVATE KEY----- diff --git a/examples/cartrade/build/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-pub b/examples/cartrade/build/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-pub new file mode 100644 index 00000000000..8ac97fcc4bc --- /dev/null +++ b/examples/cartrade/build/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-pub @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE0TjOYDQfDbAOU3wYNvxgeaTE/r88 +BieO5V4yu/6EJk4yBHscyaRCnrLZ9eqyFa5+3G5V0mA7hbTw48mdeMArsA== +-----END PUBLIC KEY----- diff --git a/examples/cartrade/build/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv b/examples/cartrade/build/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv new file mode 100644 index 00000000000..db8746bcf64 --- /dev/null +++ b/examples/cartrade/build/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgpPt9pQjjYIPHH28L +xAwI0ZAv5gVp0FlpVXuAeHfkstWhRANCAAQ2Q0fFCgt+iVPeXF25tvbi+CoMIImg +QL/WXFrUH3BXYTHtm1F4nw7E303lKuMYWH2ZPujqiceNqgeea0kZLNGP +-----END PRIVATE KEY----- diff --git a/examples/cartrade/build/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-pub b/examples/cartrade/build/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-pub new file mode 100644 index 00000000000..194b017195e --- /dev/null +++ b/examples/cartrade/build/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-pub @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAENkNHxQoLfolT3lxdubb24vgqDCCJ +oEC/1lxa1B9wV2Ex7ZtReJ8OxN9N5SrjGFh9mT7o6onHjaoHnmtJGSzRjw== +-----END PUBLIC KEY----- diff --git a/examples/cartrade/build/wallet/user1/user1 b/examples/cartrade/build/wallet/user1/user1 new file mode 100644 index 00000000000..e6496f62158 --- /dev/null +++ b/examples/cartrade/build/wallet/user1/user1 @@ -0,0 +1 @@ +{"name":"user1","mspid":"Org1MSP","roles":null,"affiliation":"","enrollmentSecret":"","enrollment":{"signingIdentity":"86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738","identity":{"certificate":"-----BEGIN CERTIFICATE-----\nMIICjzCCAjWgAwIBAgIUZ7tZrUc30ljAj/wqwn6YQdicE2owCgYIKoZIzj0EAwIw\nczELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh\nbiBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMT\nE2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMjAwNzI3MTAzNDAwWhcNMjEwNzI3MTAz\nOTAwWjBCMTAwDQYDVQQLEwZjbGllbnQwCwYDVQQLEwRvcmcxMBIGA1UECxMLZGVw\nYXJ0bWVudDExDjAMBgNVBAMTBXVzZXIxMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD\nQgAENkNHxQoLfolT3lxdubb24vgqDCCJoEC/1lxa1B9wV2Ex7ZtReJ8OxN9N5Srj\nGFh9mT7o6onHjaoHnmtJGSzRj6OB1zCB1DAOBgNVHQ8BAf8EBAMCB4AwDAYDVR0T\nAQH/BAIwADAdBgNVHQ4EFgQUCuQpahuX4zI/56Yuz0SzraMNSxswKwYDVR0jBCQw\nIoAgQjmqDc122u64ugzacBhR0UUE0xqtGy3d26xqVzZeSXwwaAYIKgMEBQYHCAEE\nXHsiYXR0cnMiOnsiaGYuQWZmaWxpYXRpb24iOiJvcmcxLmRlcGFydG1lbnQxIiwi\naGYuRW5yb2xsbWVudElEIjoidXNlcjEiLCJoZi5UeXBlIjoiY2xpZW50In19MAoG\nCCqGSM49BAMCA0gAMEUCIQC1sqCa6OPKOugucF0BLPaXJe/YdA2FVa73gClqL3Yc\nxQIgfQHuZvgeQHol51W3HNIQ1OaqSOqJdtrRZ1rFOdDmvJs=\n-----END CERTIFICATE-----\n"}}} \ No newline at end of file diff --git a/examples/cartrade/package.json b/examples/cartrade/package.json index 20aa5720ea5..04cfc0625a4 100644 --- a/examples/cartrade/package.json +++ b/examples/cartrade/package.json @@ -1,98 +1,18 @@ { - "name": "@hyperledger-labs/cactus", + "name": "cartrade", "private": true, "scripts": { - "run-ci": "./tools/ci.sh", - "configure": "lerna clean --yes && lerna bootstrap && npm-run-all build generate-api-server-config", - "generate-api-server-config": "node ./tools/generate-api-server-config.js", - "start:api-server": "node ./packages/cactus-cmd-api-server/dist/lib/main/typescript/cmd/cactus-api.js --config-file=.config.json", - "start:cockpit": "lerna run --scope '*/cactus-cockpit' --stream serve:proxy", - "export-open-api-spec": "ts-node -e 'import(\"./packages/cactus-cmd-api-server/src/main/typescript/openapi-spec\").then((x) => x.exportToFileSystemAsJson());'", - "pregenerate-sdk": "npm-run-all export-open-api-spec", - "generate-sdk": "openapi-generator generate --input-spec cactus-openapi-spec.json -g typescript-axios -o packages/cactus-sdk/src/main/typescript/generated/openapi/typescript-axios/", - "clean": "lerna exec --stream --ignore '*/*cockpit' -- del-cli dist/** && del-cli packages/cactus-sdk/src/main/typescript/generated/openapi/typescript-axios/*", - "lint": "lerna exec --stream --ignore '*/*cockpit' -- cross-env DEBUG= tslint --project tsconfig.json", - "tsc": "lerna run tsc", - "build": "npm-run-all build:dev build:prod", - "build:prod": "npm-run-all build:prod:backend webpack:prod:web build:prod:frontend", - "build:prod:backend": "npm-run-all webpack:prod:node", - "build:prod:frontend": "lerna run build:prod:frontend", - "build:dev": "npm-run-all build:dev:backend webpack:dev:web build:dev:frontend", - "build:dev:backend": "npm-run-all lint clean generate-sdk tsc webpack:dev:node", - "build:dev:frontend": "lerna run build:dev:frontend", - "build:dev:cmd-api-server": "lerna exec --stream --scope '*/*api-server' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --env=dev --target=node --config ../../webpack.config.js'", - "build:dev:common": "lerna exec --stream --scope '*/*common' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --env=dev --target=node --config ../../webpack.config.js'", - "build:dev:core-api": "lerna exec --stream --scope '*/*core-api' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --env=dev --target=node --config ../../webpack.config.js'", - "build:dev:test-tooling": "lerna exec --stream --scope '*/*test-tooling' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --env=dev --target=node --config ../../webpack.config.js'", - "build:dev:plugin-ledger-connector-quorum": "lerna exec --stream --scope '*/*connector-quorum' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --env=dev --target=node --config ../../webpack.config.js'", - "build:dev:plugin-consortium-manual": "lerna exec --stream --scope '*/*manual-consortium' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --env=dev --target=node --config ../../webpack.config.js'", - "build:dev:sdk": "lerna exec --stream --scope '*/*sdk' -- 'del-cli dist/** && tsc --project ./tsconfig.json && webpack --env=dev --target=node --config ../../webpack.config.js'", - "webpack": "npm-run-all webpack:dev webpack:prod", - "webpack:dev": "lerna run webpack:dev", - "webpack:dev:web": "lerna run webpack:dev:web", - "webpack:dev:node": "lerna run webpack:dev:node", - "webpack:prod": "lerna run webpack:prod", - "webpack:prod:web": "lerna run webpack:prod:web", - "webpack:prod:node": "lerna run webpack:prod:node", - "test:all": "tap --jobs=1 --timeout=600 \"packages/cactus-*/src/test/typescript/{unit,integration}/\"", - "test:unit": "tap --timeout=600 \"packages/cactus-*/src/test/typescript/unit/\"", - "test:browser": "karma start karma.conf.js", - "test:integration": "tap --jobs=1 --timeout=600 \"packages/cactus-*/src/test/typescript/integration/\"", - "changelog": "conventional-changelog --infile CHANGELOG.md --outfile CHANGELOG.md && git add CHANGELOG.md", - "commit": "git-cz --signoff", - "prettier": "prettier --write --config .prettierrc.json \"./**/*.{ts,js}\"", - "version": "lerna version --no-push --conventional-commits --sign-git-commit --sign-git-tag", - "cartrade-start": "node ../../dist/packages/routing-interface/www.js", - "cartrade-debug": "nodemon --inspect ../../dist/packages/routing-interface/www.js", - "cartrade-build": "npm run cartrade-build-ts && npm run cartrade-copy-static-assets && npm run cartrade-copy-blp-config && npm run cartrade-replace-blp-config-path", - "cartrade-build-ts": "tsc -p ./tsconfig.json", - "cartrade-tslint": "tslint -c tslint.json -p tsconfig.json './*.ts'", - "cartrade-copy-static-assets": "ts-node copyStaticAssets.ts", - "cartrade-copy-blp-config": "ts-node copyBLPConfig.ts", - "cartrade-replace-blp-config-path": "ts-node replaceBLPConfigPath.ts", - "cartrade-init-cartrade": "ln -s ../examples/cartrade/node_modules ../../dist/node_modules" + "start": "node ../../dist/packages/routing-interface/www.js", + "debug": "nodemon --inspect ../../dist/packages/routing-interface/www.js", + "build": "npm run build-ts && npm run copy-static-assets && npm run copy-blp-config && npm run replace-blp-config-path", + "build-ts": "tsc -p ./tsconfig.json", + "tslint": "tslint -c tslint.json -p tsconfig.json './*.ts'", + "copy-static-assets": "ts-node copyStaticAssets.ts", + "copy-blp-config": "ts-node copyBLPConfig.ts", + "replace-blp-config-path": "ts-node replaceBLPConfigPath.ts", + "init-cartrade": "ln -s ../examples/cartrade/node_modules ../../dist/node_modules" }, - "devDependencies": { - "@commitlint/cli": "8.1.0", - "@commitlint/config-conventional": "8.0.0", - "@openapitools/openapi-generator-cli": "1.0.10-4.2.3", - "@types/node-fetch": "2.5.4", - "@types/tape": "4.13.0", - "@types/uuid": "3.4.6", - "cache-loader": "4.1.0", - "commitizen": "4.0.3", - "conventional-changelog-cli": "2.0.28", - "cross-env": "5.2.0", - "cz-conventional-changelog": "3.0.2", - "del-cli": "3.0.0", - "electron": "9.1.1", - "eslint-config-standard": "12.0.0", - "eslint-plugin-import": "2.17.3", - "eslint-plugin-node": "9.1.0", - "eslint-plugin-promise": "4.1.1", - "eslint-plugin-standard": "4.0.0", - "husky": "4.2.5", - "inquirer": "7.1.0", - "karma": "5.1.0", - "karma-chrome-launcher": "3.1.0", - "karma-electron": "6.3.1", - "karma-tap": "4.2.0", - "karma-webpack": "4.0.2", - "lerna": "3.20.2", - "lint-staged": "10.2.2", - "npm-run-all": "4.1.5", - "prettier": "2.0.5", - "secp256k1": "4.0.0", - "source-map-loader": "0.2.4", - "tap": "14.10.6", - "tape": "5.0.1", - "ts-loader": "6.2.1", - "ts-node": "8.9.1", - "tslint": "6.0.0", - "typescript": "3.9.3", - "webpack": "4.41.6", - "webpack-bundle-analyzer": "3.6.0", - "webpack-cli": "3.3.11", + "dependencies": { "@types/node": "^14.0.24", "body-parser": "^1.19.0", "cookie-parser": "~1.4.4", @@ -108,19 +28,11 @@ "morgan": "~1.9.1", "shelljs": "^0.8.4", "socket.io": "^2.0.4", + "ts-node": "8.9.1", "web3": "^1.2.9" }, - "config": { - "commitizen": { - "path": "./node_modules/cz-conventional-changelog" - } - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "./**/*.{ts,js}": "prettier --write --config .prettierrc.json" + "devDependencies": { + "tslint": "6.0.0", + "typescript": "3.9.3" } } diff --git a/examples/cartrade/script-build-all.sh b/examples/cartrade/script-build-all.sh new file mode 100755 index 00000000000..5c95a6431af --- /dev/null +++ b/examples/cartrade/script-build-all.sh @@ -0,0 +1,19 @@ +## Build validator for Fabric +cd ../../packages/ledger-plugin/fabric/validator/src/ +./script-build-validator.sh +cp -a ../../../../../examples/cartrade/build/wallet/ . +cd ../../../../../ + +## build validator for Ethereum +cd ./packages/ledger-plugin/go-ethereum/validator/src/ +./script-build-validator.sh +cd ../../../../../ + +## build packages +cd ./packages/ +./script-build-packages.sh +cd .. + +## build cartrade apps +cd ./examples/cartrade +./script-build-cartrade.sh \ No newline at end of file diff --git a/examples/cartrade/script-build-cartrade.sh b/examples/cartrade/script-build-cartrade.sh new file mode 100755 index 00000000000..3fb57901aed --- /dev/null +++ b/examples/cartrade/script-build-cartrade.sh @@ -0,0 +1,4 @@ +## Build a cartrade app +echo "[process] Build a cartrade app" +npm install +npm run build diff --git a/examples/cartrade/script-post-cartrade-sample.sh b/examples/cartrade/script-post-cartrade-sample.sh new file mode 100755 index 00000000000..10b3572a51f --- /dev/null +++ b/examples/cartrade/script-post-cartrade-sample.sh @@ -0,0 +1 @@ +curl localhost:5034/api/v1/bl/trades/ -XPOST -H "Content-Type: application/json" -d '{"businessLogicID":"guks32pf","tradeParams":["0xec709e1774f0ce4aba47b52a499f9abaaa159f71", "0x9d624f7995e8bd70251f8265f2f9f2b49f169c55", "user01", "user02", 50, "CAR1"],"authParams":["param"]}' \ No newline at end of file diff --git a/examples/cartrade/script-start-cartrade.sh b/examples/cartrade/script-start-cartrade.sh new file mode 100755 index 00000000000..aaa5694a283 --- /dev/null +++ b/examples/cartrade/script-start-cartrade.sh @@ -0,0 +1,7 @@ +cd ../../ + +## Start cartrade app +echo "[process] Start the routing interface and the cartrade app" +cd ./examples/cartrade +npm run init-cartrade # for making a symbolic link for node_modules. This command only needs to be run once. +npm run start \ No newline at end of file diff --git a/examples/cartrade/script-start-ledgers.sh b/examples/cartrade/script-start-ledgers.sh new file mode 100755 index 00000000000..83231a80dc4 --- /dev/null +++ b/examples/cartrade/script-start-ledgers.sh @@ -0,0 +1,8 @@ +## Start docker environment for Fabric testnet +cd ../../tools/docker/fabric14-fabcar-testnet +./script-start-docker.sh +cd ../../.. + +## Start docker environment for Go-Ethereum testnet +cd ../../tools/docker/geth-testnet +./script-start-docker.sh \ No newline at end of file diff --git a/examples/cartrade/script-start-validator-ethereum.sh b/examples/cartrade/script-start-validator-ethereum.sh new file mode 100755 index 00000000000..33f2a76446b --- /dev/null +++ b/examples/cartrade/script-start-validator-ethereum.sh @@ -0,0 +1,5 @@ +cd .. + +echo "[process] Start the validator for Go-Ethereum" +cd ./packages/ledger-plugin/go-ethereum/validator/src +npm run start \ No newline at end of file diff --git a/examples/cartrade/script-start-validator-fabric.sh b/examples/cartrade/script-start-validator-fabric.sh new file mode 100755 index 00000000000..eb24a340405 --- /dev/null +++ b/examples/cartrade/script-start-validator-fabric.sh @@ -0,0 +1,5 @@ +cd .. + +echo "[process] Start the validator for Fabric" +cd ./packages/ledger-plugin/fabric/validator/src +npm run start \ No newline at end of file diff --git a/packages/script-build-packages.sh b/packages/script-build-packages.sh new file mode 100755 index 00000000000..9a5ee0f179d --- /dev/null +++ b/packages/script-build-packages.sh @@ -0,0 +1,4 @@ +## Build packages +echo "[process] Build packages" +npm install +num run build \ No newline at end of file diff --git a/tools/docker/fabric14-fabcar-testnet/.gitignore b/tools/docker/fabric14-fabcar-testnet/.gitignore new file mode 100644 index 00000000000..af7d30cd7d7 --- /dev/null +++ b/tools/docker/fabric14-fabcar-testnet/.gitignore @@ -0,0 +1,4 @@ +chaincode/hyperledger +fabcar/javascript/wallet +fabcar/javascript/node_modules + diff --git a/tools/docker/fabric14-fabcar-testnet/README.md b/tools/docker/fabric14-fabcar-testnet/README.md new file mode 100644 index 00000000000..fa663345ae1 --- /dev/null +++ b/tools/docker/fabric14-fabcar-testnet/README.md @@ -0,0 +1,79 @@ + +# Fabric-docker of validator for Hyperledger fabric + +## Abstract +- Modules for the unit-test of validator for Hyperledger fabric + +## a) clone the directories + curl -sSL https://bit.ly/2ysbOFE | bash -s -- 1.4.0 1.4.0 +Then, `fabric-samples` directory is made in the current directory, including `basic-network`, `bin`, `chaincode/fabcar`, and `fabcar`. + +- c.f.: https://hyperledger-fabric.readthedocs.io/en/master/install.html#install-samples-binaries-and-docker-images +- If you are behind an proxy environment, use the command that `curl -x http://yourProxyURL:yourProxyPortNumber` instead of `curl` + +## b) Initialization +### 1) Start + + cd fabcar + ./startFabric.sh + +Ensure that the next containers are started. + + $ docker ps + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + ec8289e32f06 dev-peer0.org1.example.com-fabcar-1.0-5c906e402ed29f20260ae42283216aa75549c571e2e380f3615826365d8269ba "chaincode -peer.add..." 2 hours ago Up 2 hours dev-peer0.org1.example.com-fabcar-1.0 + a468d622234a hyperledger/fabric-tools "/bin/bash" 2 hours ago Up 2 hours cli + 80e28ca9fbcf hyperledger/fabric-peer "peer node start" 2 hours ago Up 2 hours 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com + 8391db445423 hyperledger/fabric-ca "sh -c 'fabric-ca-se..." 2 hours ago Up 2 hours 0.0.0.0:7054->7054/tcp ca.example.com + 3a06daddc298 hyperledger/fabric-orderer "orderer" 2 hours ago Up 2 hours 0.0.0.0:7050->7050/tcp orderer.example.com + b722f3d14f6e hyperledger/fabric-couchdb "tini -- /docker-ent..." 2 hours ago Up 2 hours 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb + +### 2) Registering an administrator user and general users + +Change to the following directory: + + $ cd (installation path)/fabcar/javascript + +Install the modules + + $ npm install + +Execute the following script to register the administrator user and general users + + $ node enrollAdmin.js + $ node registerUser.js + +Verify that the user's private key information (i.e. `wallet`) has been generated. + + $ cd (installation path)/fabcar/javascript/wallet + + $ ls -la + Total 0 + drwxrwxr-x. 4 XXXX XXXX 48 X X XX:XX . + drwxrwxr-x. 4 XXXX XXXX 243 X X XX:XX .. + drwxrwxr-x. 2 XXXX XXXX 249 X X XX:XX admin + drwxrwxr-x. 2 XXXX XXXX 172 X X XX:XX user1 + +### 3) Creating and unpacking `wallet.tar`, which is required by Validator and Driver + +Copy user's private key information (`wallet`) for use with Validator and Driver. + + $ cd (installation path)/fabcar/javascript/ + $ tar cvf wallet.tar wallet + +Copy and extract wallet.tar to the following target directory: + +[Target Directory] + +- /packages/ledger-plugin/fabric/validator/src/dependent/ +- /packages/ledger-plugin/fabric/validator/unit-test/ + +[Deployment Method] + + $ tar xvf wallet.tar + diff --git a/tools/docker/fabric14-fabcar-testnet/script-start-docker.sh b/tools/docker/fabric14-fabcar-testnet/script-start-docker.sh new file mode 100755 index 00000000000..379f522ec11 --- /dev/null +++ b/tools/docker/fabric14-fabcar-testnet/script-start-docker.sh @@ -0,0 +1,9 @@ +echo "[process] start docker environment for Fabric testnet" +curl -sSL https://bit.ly/2ysbOFE | bash -s -- 1.4.1 1.4.1 +cp -a wallet fabric-samples/fabcar/javascript +cd fabric-samples/fabcar +./startFabric.sh +cd javascript +npm install +node enrollAdmin.js +node registerUser.js \ No newline at end of file diff --git a/tools/docker/fabric14-fabcar-testnet/wallet.tar b/tools/docker/fabric14-fabcar-testnet/wallet.tar new file mode 100644 index 0000000000000000000000000000000000000000..bd9eb969662964ce9562d52a18393b1405550029 GIT binary patch literal 20480 zcmeI2S(Bnj5XbwuBlCqH}W5kkLdTke5wmsZk(gg0bY^!ZEZI2=?!t-2*S$a54 zIHXHq%N4)X=7G8iBdeHyihsJw6GV%o$(wuZ^-$Nh{Lkb6_xfO= zD699wkvszvc;AD@*?M=Y$f5*%2ozQk+0$MeD^#bt7CG+A=Nw9`h~-u;vp~~)jojIV z(xJ>!8bWE#+}+X>4Og4Li;M)Rue!^maI=S zMV8(vlZRuOi+8tOiiz~F$27OvW)jNKE6VN;_PivG@zz0}9b(3@BYkY}nUD_o@MPjt z&Sm-C?fE63%D?eq*Plke>WEj4|IB^^L>=RQ7ytE||04eJ7KY;g4U|_morB~{{7>1w z%w2}Ru+Cv_NWHBomm$Uh&5*x*=7Hw$nhzj02?qwREqNOZretoY$HMol32YwP?Ymnx z@CNjZI%Ulk?5?R3D<#g!8gcQVZ+5)>NwDY#Qlw|t1~4mol2h%C>nY%nfR7(91Nh~W zT^+;!cED%xf35hisnW_9D>X|zub$2+9KGH|T4ewB-y#=+4<7G$ofYtGh1tjN_>$Z^05 zd{EadzC1M?;OH$LrPlbVaTDm!`Ldq4qs?GG2`kZtA~rvQ*k^;?aw0m~Xt zV3ol!$MfONVm(vd?Hv*bwwNqp1M4XYmz=*X=h|A~dO(IUz4uAgO%GYt-zr25jHxRK ztg2XtQIe8wmRONP=$Gjs8*wP@G^%6u#zG=? z*ZD!m*?7+IIe1vaRFY{!P4;JEPYyIzf6_oyz%+-=Qo1=4b!vy-)?y>!?bC}uD0t0iQ(ANVi=FKJi@lfYCniO4B75< zT)a(mXxwvJB(-#$4&H9lbk%Z={a>yB5HyKXsQ!DyT~{|<q zX!q}Kiz;PeCOFdmY=;TaZl-6zla}iwoqyT?X@rI?1@E>LmKKoTRPUZxmxi7KK370l&n5mUsvJXVU+u7Sey;V^Tfy|Id^ED+Lhc|M&1e%Kz^{`RBdImE-^W^}omZ z4`Y!2_b!v>GX7txY?s@;zuN4nYgH<=ZGX9qCS+8&nQar)(ckkN*S)*lLavENg@v=7 zd`7^6G1HOPZ4U~yqtfF;C3?V6znlK|y_M$o>3?Ba>3`w;N&hpM)I3Zb z5{p6*HuHTRw+zh<97t^cJ?WTxwEg9(_-fwh@ibNlBG8 zd|>UzgMGJBQ%5F#5C$&4Id+q4DVVQw8nPe)hyWsh2p|H803v`0AOeU0B7g`W0*C-2 yfCwN0hyWsh2p|H803v`0AOeU0B7g`W0*C-2fCwN0hyWsh2p|H803z^TCh!MjeqHte literal 0 HcmV?d00001 diff --git a/tools/docker/fabric14-fabcar-testnet/wallet/admin/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv b/tools/docker/fabric14-fabcar-testnet/wallet/admin/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv new file mode 100644 index 00000000000..db8746bcf64 --- /dev/null +++ b/tools/docker/fabric14-fabcar-testnet/wallet/admin/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgpPt9pQjjYIPHH28L +xAwI0ZAv5gVp0FlpVXuAeHfkstWhRANCAAQ2Q0fFCgt+iVPeXF25tvbi+CoMIImg +QL/WXFrUH3BXYTHtm1F4nw7E303lKuMYWH2ZPujqiceNqgeea0kZLNGP +-----END PRIVATE KEY----- diff --git a/tools/docker/fabric14-fabcar-testnet/wallet/admin/admin b/tools/docker/fabric14-fabcar-testnet/wallet/admin/admin new file mode 100644 index 00000000000..a8c651f7321 --- /dev/null +++ b/tools/docker/fabric14-fabcar-testnet/wallet/admin/admin @@ -0,0 +1 @@ +{"name":"admin","mspid":"Org1MSP","roles":null,"affiliation":"","enrollmentSecret":"","enrollment":{"signingIdentity":"fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407","identity":{"certificate":"-----BEGIN CERTIFICATE-----\nMIICAjCCAaigAwIBAgIUYcAcX63XaN2Omym6hEXF+Kxzx2QwCgYIKoZIzj0EAwIw\nczELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh\nbiBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMT\nE2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMjAwNzI3MTAzNDAwWhcNMjEwNzI3MTAz\nOTAwWjAhMQ8wDQYDVQQLEwZjbGllbnQxDjAMBgNVBAMTBWFkbWluMFkwEwYHKoZI\nzj0CAQYIKoZIzj0DAQcDQgAE0TjOYDQfDbAOU3wYNvxgeaTE/r88BieO5V4yu/6E\nJk4yBHscyaRCnrLZ9eqyFa5+3G5V0mA7hbTw48mdeMArsKNsMGowDgYDVR0PAQH/\nBAQDAgeAMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFBMOvw1wPpaBeZIpqc3AFbGs\nY0KMMCsGA1UdIwQkMCKAIEI5qg3NdtruuLoM2nAYUdFFBNMarRst3dusalc2Xkl8\nMAoGCCqGSM49BAMCA0gAMEUCIQDXvckX5bZ5mGPHpQ49aKSFsGJkwrX1BnW7DwA+\n4suQPQIgVGKIiQBQDGlOQHkt9lqno/yFiFZSjzZSS24LFIJNKU4=\n-----END CERTIFICATE-----\n"}}} \ No newline at end of file diff --git a/tools/docker/fabric14-fabcar-testnet/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-priv b/tools/docker/fabric14-fabcar-testnet/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-priv new file mode 100644 index 00000000000..c71cc9de30b --- /dev/null +++ b/tools/docker/fabric14-fabcar-testnet/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-priv @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgQ3pbxM94ZzHPEHW7 +5TQ1N/WfCLSgqY97dfyF34WiJz2hRANCAATROM5gNB8NsA5TfBg2/GB5pMT+vzwG +J47lXjK7/oQmTjIEexzJpEKestn16rIVrn7cblXSYDuFtPDjyZ14wCuw +-----END PRIVATE KEY----- diff --git a/tools/docker/fabric14-fabcar-testnet/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-pub b/tools/docker/fabric14-fabcar-testnet/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-pub new file mode 100644 index 00000000000..8ac97fcc4bc --- /dev/null +++ b/tools/docker/fabric14-fabcar-testnet/wallet/admin/fde5542b37efe547102f4fe8d0f8e1df521c6ba8b78e43a2eedc7fe152c3d407-pub @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE0TjOYDQfDbAOU3wYNvxgeaTE/r88 +BieO5V4yu/6EJk4yBHscyaRCnrLZ9eqyFa5+3G5V0mA7hbTw48mdeMArsA== +-----END PUBLIC KEY----- diff --git a/tools/docker/fabric14-fabcar-testnet/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv b/tools/docker/fabric14-fabcar-testnet/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv new file mode 100644 index 00000000000..db8746bcf64 --- /dev/null +++ b/tools/docker/fabric14-fabcar-testnet/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-priv @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgpPt9pQjjYIPHH28L +xAwI0ZAv5gVp0FlpVXuAeHfkstWhRANCAAQ2Q0fFCgt+iVPeXF25tvbi+CoMIImg +QL/WXFrUH3BXYTHtm1F4nw7E303lKuMYWH2ZPujqiceNqgeea0kZLNGP +-----END PRIVATE KEY----- diff --git a/tools/docker/fabric14-fabcar-testnet/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-pub b/tools/docker/fabric14-fabcar-testnet/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-pub new file mode 100644 index 00000000000..194b017195e --- /dev/null +++ b/tools/docker/fabric14-fabcar-testnet/wallet/user1/86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738-pub @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAENkNHxQoLfolT3lxdubb24vgqDCCJ +oEC/1lxa1B9wV2Ex7ZtReJ8OxN9N5SrjGFh9mT7o6onHjaoHnmtJGSzRjw== +-----END PUBLIC KEY----- diff --git a/tools/docker/fabric14-fabcar-testnet/wallet/user1/user1 b/tools/docker/fabric14-fabcar-testnet/wallet/user1/user1 new file mode 100644 index 00000000000..e6496f62158 --- /dev/null +++ b/tools/docker/fabric14-fabcar-testnet/wallet/user1/user1 @@ -0,0 +1 @@ +{"name":"user1","mspid":"Org1MSP","roles":null,"affiliation":"","enrollmentSecret":"","enrollment":{"signingIdentity":"86ed77857b77523010fa77e3ae2ba34711c73899d182951ec634fcc918855738","identity":{"certificate":"-----BEGIN CERTIFICATE-----\nMIICjzCCAjWgAwIBAgIUZ7tZrUc30ljAj/wqwn6YQdicE2owCgYIKoZIzj0EAwIw\nczELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh\nbiBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMT\nE2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMjAwNzI3MTAzNDAwWhcNMjEwNzI3MTAz\nOTAwWjBCMTAwDQYDVQQLEwZjbGllbnQwCwYDVQQLEwRvcmcxMBIGA1UECxMLZGVw\nYXJ0bWVudDExDjAMBgNVBAMTBXVzZXIxMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD\nQgAENkNHxQoLfolT3lxdubb24vgqDCCJoEC/1lxa1B9wV2Ex7ZtReJ8OxN9N5Srj\nGFh9mT7o6onHjaoHnmtJGSzRj6OB1zCB1DAOBgNVHQ8BAf8EBAMCB4AwDAYDVR0T\nAQH/BAIwADAdBgNVHQ4EFgQUCuQpahuX4zI/56Yuz0SzraMNSxswKwYDVR0jBCQw\nIoAgQjmqDc122u64ugzacBhR0UUE0xqtGy3d26xqVzZeSXwwaAYIKgMEBQYHCAEE\nXHsiYXR0cnMiOnsiaGYuQWZmaWxpYXRpb24iOiJvcmcxLmRlcGFydG1lbnQxIiwi\naGYuRW5yb2xsbWVudElEIjoidXNlcjEiLCJoZi5UeXBlIjoiY2xpZW50In19MAoG\nCCqGSM49BAMCA0gAMEUCIQC1sqCa6OPKOugucF0BLPaXJe/YdA2FVa73gClqL3Yc\nxQIgfQHuZvgeQHol51W3HNIQ1OaqSOqJdtrRZ1rFOdDmvJs=\n-----END CERTIFICATE-----\n"}}} \ No newline at end of file diff --git a/tools/docker/geth-testnet/.gitignore b/tools/docker/geth-testnet/.gitignore new file mode 100644 index 00000000000..53a9595130c --- /dev/null +++ b/tools/docker/geth-testnet/.gitignore @@ -0,0 +1,5 @@ +data-ec1 +data-ec2 +genesis/genesis-ec1.json +genesis/genesis-ec2.json + diff --git a/tools/docker/geth-testnet/README.md b/tools/docker/geth-testnet/README.md new file mode 100644 index 00000000000..cc027e713b4 --- /dev/null +++ b/tools/docker/geth-testnet/README.md @@ -0,0 +1,102 @@ + +# BIF-trial(geth-docker) + +## Explanation +- "geth-docker" is a module required to run "Validator" +- Immediately after applying -geth-docker, it is necessary to perform "a) initialization" +- How to start/stop will be explained follow + +## a) Initialization +### 1) Account creation +
+./init-account.sh
+
+ +Please keep in your memo the addresses (ec1-accounts[0],[1],..,[4] and ec2-accounts[0],[1],..,[4]), + +* Sample output +
+ make-account-ec1-accounts[0]
+ Creating network "ecenv_default" with the default driver
+ INFO [05-29|08:33:35.658] Maximum peer count                       ETH=25 LES=0 total=25
+ Address: {782646267c64d536983a64af9d9a5ab80e036989}
+ 
+ make-account-ec1-accounts[1]
+ INFO [05-29|08:33:42.143] Maximum peer count                       ETH=25 LES=0 total=25
+ Address: {38f6d41b35d1af26865a0c13d41e8aa342e62e61}
+ 
+ make-account-ec1-accounts[2]
+ INFO [05-29|08:33:48.534] Maximum peer count                       ETH=25 LES=0 total=25
+ Address: {895b383457a714e051357dfc36bb3b6ddf84f01f}
+ 
+ make-account-ec1-accounts[3]
+ INFO [05-29|08:33:54.731] Maximum peer count                       ETH=25 LES=0 total=25
+ Address: {caf99b30857e0d29cd866e27fb39b2e7d2b2dc17}
+ 
+ make-account-ec1-accounts[4]
+ INFO [05-29|08:34:01.282] Maximum peer count                       ETH=25 LES=0 total=25
+ Address: {1b75166f65a852216306af320783e4b22986d3e3}
+ 
+ make-account-ec2-accounts[0]
+ INFO [05-29|08:34:08.021] Maximum peer count                       ETH=25 LES=0 total=25
+ Address: {8f2244f75a4c53684c5827ec19615dc89c2ad21c}
+ 
+ make-account-ec2-accounts[1]
+ INFO [05-29|08:34:14.414] Maximum peer count                       ETH=25 LES=0 total=25
+ Address: {add19019ee1ea604b3fcb55a11b97d0fc81cc221}
+ 
+ make-account-ec2-accounts[2]
+ INFO [05-29|08:34:21.292] Maximum peer count                       ETH=25 LES=0 total=25
+ Address: {ab66982e4eb732f0e17c56586e530f94ee9411ce}
+ 
+ make-account-ec2-accounts[3]
+ INFO [05-29|08:34:27.947] Maximum peer count                       ETH=25 LES=0 total=25
+ Address: {4809b6329ef15bcd1b5b730e0f148ae751cfd9f6}
+ 
+ make-account-ec2-accounts[4]
+ INFO [05-29|08:34:34.360] Maximum peer count                       ETH=25 LES=0 total=25
+ Address: {421c9db39b64575c511f94990acfd4394dd5f1c3}
+
+ +### 2) Editing initial block information +* Change the "ADDRESS" in genesis/genesis-ec1.json(and genesis-ec2.json) to the address for ec1-accounts[0]. + + * Specify ec1-accounts [0] account for "genesis / genesis-ec1.json" + * Specify ec2-accounts [0] account for "genesis / genesis-ec2.json" + +* Sample output + +
+ "alloc"      : {
+ 	"ADDRESS":
+ 	{"balance":"100000000000000000000000000"}
+ },
+                  |
+                  v
+ "alloc"      : {
+ 	"782646267c64d536983a64af9d9a5ab80e036989":
+ 	{"balance":"100000000000000000000000000"}
+ },
+
+ +### 3) Initializing end-chains: +
+./init-chain.sh
+
+ +## b) Launching geth-containers +
+./up.sh
+
+ + +## c) Stop geth-containers +
+./down.sh
+
+ diff --git a/tools/docker/geth-testnet/data-geth1/genesis.json b/tools/docker/geth-testnet/data-geth1/genesis.json new file mode 100644 index 00000000000..748c4497246 --- /dev/null +++ b/tools/docker/geth-testnet/data-geth1/genesis.json @@ -0,0 +1,20 @@ +{ + "config": { + "chainId": 10, + "homesteadBlock": 0, + "eip155Block": 0, + "eip158Block": 0 + }, + "alloc" : { + "ec709e1774f0ce4aba47b52a499f9abaaa159f71": + {"balance":"100000000000000000000000000"} + }, + "coinbase" : "0x3333333333333333333333333333333333333333", + "difficulty" : "0x4000", + "extraData" : "", + "gasLimit" : "0x8000000", + "nonce" : "0x0000000000000042", + "mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp" : "0x00" +} diff --git a/tools/docker/geth-testnet/data-geth1/keystore/account0--ec709e1774f0ce4aba47b52a499f9abaaa159f71 b/tools/docker/geth-testnet/data-geth1/keystore/account0--ec709e1774f0ce4aba47b52a499f9abaaa159f71 new file mode 100644 index 00000000000..ba04d04cb15 --- /dev/null +++ b/tools/docker/geth-testnet/data-geth1/keystore/account0--ec709e1774f0ce4aba47b52a499f9abaaa159f71 @@ -0,0 +1 @@ +{"address":"ec709e1774f0ce4aba47b52a499f9abaaa159f71","crypto":{"cipher":"aes-128-ctr","ciphertext":"5d0b240da56e7ab181f0b1349e9a5ed65020f64ba80aacf14de68b96995e2f25","cipherparams":{"iv":"21dedd4d655bd7231dab9d0a082d4fbf"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"3c3b369bfcc48643cc9bc9b5fe80713955a7b6020b5822e6e55b60c41f76a601"},"mac":"32577172ce416a7c9c2038e78a10b0c5da4bf2f6ba5180ea579cff56249f1905"},"id":"6f1171f8-efa4-4aae-a120-e53220dfab8d","version":3} \ No newline at end of file diff --git a/tools/docker/geth-testnet/data-geth1/keystore/account1--36e146d5afab61ab125ee671708eeb380aea05b6 b/tools/docker/geth-testnet/data-geth1/keystore/account1--36e146d5afab61ab125ee671708eeb380aea05b6 new file mode 100644 index 00000000000..757f481e2f6 --- /dev/null +++ b/tools/docker/geth-testnet/data-geth1/keystore/account1--36e146d5afab61ab125ee671708eeb380aea05b6 @@ -0,0 +1 @@ +{"address":"36e146d5afab61ab125ee671708eeb380aea05b6","crypto":{"cipher":"aes-128-ctr","ciphertext":"a6796fca35c6197160757010cc26982e7b5c5b58169885ee89d21fcb85813286","cipherparams":{"iv":"8abd09f4df3917270a9bedfa51ba13e9"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"43167adaf62439d750e048ea315d761cbba812fc4c64969e76332559c848c44d"},"mac":"e7750405e5ac02240ebc633ed68e870712fee5cee270eb99f157904bcfe23bba"},"id":"810c7acd-1555-4334-b170-d09770199d24","version":3} \ No newline at end of file diff --git a/tools/docker/geth-testnet/data-geth1/keystore/account2--06fc56347d91c6ad2dae0c3ba38eb12ab0d72e97 b/tools/docker/geth-testnet/data-geth1/keystore/account2--06fc56347d91c6ad2dae0c3ba38eb12ab0d72e97 new file mode 100644 index 00000000000..83fb646d383 --- /dev/null +++ b/tools/docker/geth-testnet/data-geth1/keystore/account2--06fc56347d91c6ad2dae0c3ba38eb12ab0d72e97 @@ -0,0 +1 @@ +{"address":"06fc56347d91c6ad2dae0c3ba38eb12ab0d72e97","crypto":{"cipher":"aes-128-ctr","ciphertext":"7630f59ef02c458b0d82a5fd654439a6b0934fc9bdf23884e81cc383c4cc6741","cipherparams":{"iv":"a7ca35290d46a87e2b8db5a427a2c2e1"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"50fa479ac7067aa935df277d107bd09528c02e5ea6ce2feeddd8d539071036ec"},"mac":"dd34972c9558c262bfc9f0e794aa303e89a43b86a0961605bf6317a7f0f9fda0"},"id":"730d63e0-96e6-4720-8677-871283fec0f9","version":3} \ No newline at end of file diff --git a/tools/docker/geth-testnet/data-geth1/keystore/account3--9d624f7995e8bd70251f8265f2f9f2b49f169c55 b/tools/docker/geth-testnet/data-geth1/keystore/account3--9d624f7995e8bd70251f8265f2f9f2b49f169c55 new file mode 100644 index 00000000000..be12c375faa --- /dev/null +++ b/tools/docker/geth-testnet/data-geth1/keystore/account3--9d624f7995e8bd70251f8265f2f9f2b49f169c55 @@ -0,0 +1 @@ +{"address":"9d624f7995e8bd70251f8265f2f9f2b49f169c55","crypto":{"cipher":"aes-128-ctr","ciphertext":"945c252e9b0d42e93fccec32059c09a5f23dc11b7bfa664aee95b628b623ad84","cipherparams":{"iv":"b3afff3af6194d22949f927672de9792"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"ddd4d694a2ede027025b0684d7e0f045694300b6ef2e2c198e479cbd2d67e221"},"mac":"07a8b2d90e4f9f8cf502b2db0acfdce63e1d31b812f6784c5574018ee915ae83"},"id":"59f04a57-21c3-43cb-91cc-c8fecade9950","version":3} \ No newline at end of file diff --git a/tools/docker/geth-testnet/data-geth1/keystore/account4--2666a32bf7594ab5395d766dcfbf03d557dab538 b/tools/docker/geth-testnet/data-geth1/keystore/account4--2666a32bf7594ab5395d766dcfbf03d557dab538 new file mode 100644 index 00000000000..a67d24918ab --- /dev/null +++ b/tools/docker/geth-testnet/data-geth1/keystore/account4--2666a32bf7594ab5395d766dcfbf03d557dab538 @@ -0,0 +1 @@ +{"address":"2666a32bf7594ab5395d766dcfbf03d557dab538","crypto":{"cipher":"aes-128-ctr","ciphertext":"daaed697cb0c33136e10c52d3f45af1bf4531862b0ccb3ae209307a057f6992e","cipherparams":{"iv":"9b67024705eeadc8482cd025d279c63b"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"7908a69d6cbc6ac305889a3dc0053006432ee0bd792cae4e00d38f2a96707478"},"mac":"41f72915c3be1af0f0ae1cc11a1fe3a205f3ed3a44dbb233b61d49d696edbd16"},"id":"58e51e80-9016-4a5b-bc8d-c716ac05f37e","version":3} \ No newline at end of file diff --git a/tools/docker/geth-testnet/docker-compose.yml b/tools/docker/geth-testnet/docker-compose.yml new file mode 100644 index 00000000000..d23d38a3975 --- /dev/null +++ b/tools/docker/geth-testnet/docker-compose.yml @@ -0,0 +1,42 @@ +# Copyright 2019-2020 Fujitsu Laboratories Ltd. +# SPDX-License-Identifier: Apache-2.0 +version: '3' +services: + geth1: + container_name: geth1 + image: ethereum/client-go:v1.8.27 + volumes: + - "$PWD/data-geth1:/root/data" + - "$PWD/data-geth1/keystore:/root/data/keystore" + - "$PWD/data-geth1/genesis.json:/root/data/genesis.json" # mount genesis.js from host + working_dir: /root + ports: + - "8545:8545" #uncomment this line to enable JSON-RPC access from outside of network + # - "30303:30303" + expose: + - "8545" # enable JSON-RPC access fron only inside of network + networks: + - geth1net + logging: + driver: "json-file" + options: + max-size: "10m" + max-file: "3" + # following parameters are given to geth + command: > + --rpc + --networkid 10 + --nodiscover + --datadir=/root/data + --rpcaddr "0.0.0.0" + --rpcport "8545" + --rpccorsdomain "*" + --rpcvhosts "*" + --rpcapi "eth,web3" + --unlock 0,1,2,3,4 + --password "/dev/null" + --gasprice 0 + --mine --minerthreads=1 +networks: + geth1net: + external: true diff --git a/tools/docker/geth-testnet/docker-init.yml b/tools/docker/geth-testnet/docker-init.yml new file mode 100644 index 00000000000..c6062d4ccdb --- /dev/null +++ b/tools/docker/geth-testnet/docker-init.yml @@ -0,0 +1,15 @@ +# Copyright 2019-2020 Fujitsu Laboratories Ltd. +# SPDX-License-Identifier: Apache-2.0 +version: '3' +services: + # geth1 + init-chain-geth1: + container_name: init-chain-ec1 + image: ethereum/client-go:v1.8.27 + tty: true + volumes: + - "$PWD/data-geth1:/root/data" + #- "$PWD/data-geth1/genesis.json:/root/data/genesis.json" + command: > + --datadir "/root/data" + init /root/data/genesis.json \ No newline at end of file diff --git a/tools/docker/geth-testnet/script-start-docker.sh b/tools/docker/geth-testnet/script-start-docker.sh new file mode 100755 index 00000000000..8c7f5c51e89 --- /dev/null +++ b/tools/docker/geth-testnet/script-start-docker.sh @@ -0,0 +1,3 @@ +echo "[process] start docker environment for Go-Ethereum testnet" +./script/init-chain.sh +./script/up.sh \ No newline at end of file diff --git a/tools/docker/geth-testnet/script/delete.sh b/tools/docker/geth-testnet/script/delete.sh new file mode 100755 index 00000000000..c0e686f8761 --- /dev/null +++ b/tools/docker/geth-testnet/script/delete.sh @@ -0,0 +1,6 @@ +# Copyright 2019-2020 Fujitsu Laboratories Ltd. +# SPDX-License-Identifier: Apache-2.0 +docker-compose -f docker-init.yml down +docker-compose down +sudo rm -r ./data-geth1/geth +docker network rm geth1net diff --git a/tools/docker/geth-testnet/script/down.sh b/tools/docker/geth-testnet/script/down.sh new file mode 100755 index 00000000000..b2f43f232ef --- /dev/null +++ b/tools/docker/geth-testnet/script/down.sh @@ -0,0 +1,4 @@ +# Copyright 2019-2020 Fujitsu Laboratories Ltd. +# SPDX-License-Identifier: Apache-2.0 +docker-compose -f docker-init.yml down +docker-compose down diff --git a/tools/docker/geth-testnet/script/init-chain.sh b/tools/docker/geth-testnet/script/init-chain.sh new file mode 100755 index 00000000000..ed32ae0e7c0 --- /dev/null +++ b/tools/docker/geth-testnet/script/init-chain.sh @@ -0,0 +1,3 @@ +# Copyright 2019-2020 Fujitsu Laboratories Ltd. +# SPDX-License-Identifier: Apache-2.0 +docker-compose -f docker-init.yml run init-chain-geth1 diff --git a/tools/docker/geth-testnet/script/logview.sh b/tools/docker/geth-testnet/script/logview.sh new file mode 100755 index 00000000000..806b11f3f86 --- /dev/null +++ b/tools/docker/geth-testnet/script/logview.sh @@ -0,0 +1,3 @@ +# Copyright 2019-2020 Fujitsu Laboratories Ltd. +# SPDX-License-Identifier: Apache-2.0 +docker-compose logs -f diff --git a/tools/docker/geth-testnet/script/up.sh b/tools/docker/geth-testnet/script/up.sh new file mode 100755 index 00000000000..bfcc478972b --- /dev/null +++ b/tools/docker/geth-testnet/script/up.sh @@ -0,0 +1,4 @@ +# Copyright 2019-2020 Fujitsu Laboratories Ltd. +# SPDX-License-Identifier: Apache-2.0 +docker network create geth1net +docker-compose up -d