{"_id":"@elenaizaguirre/cactus-plugin-ledger-connector-iroha","_rev":"3-9c0034e7406168a33d87747edd85ecaf","name":"@elenaizaguirre/cactus-plugin-ledger-connector-iroha","dist-tags":{"latest":"0.9.4"},"versions":{"0.9.3":{"name":"@elenaizaguirre/cactus-plugin-ledger-connector-iroha","version":"0.9.3","description":"Allows Cactus nodes to connect to an Iroha ledger.","main":"dist/lib/main/typescript/index.js","mainMinified":"dist/cactus-plugin-ledger-connector-iroha.node.umd.min.js","browser":"dist/cactus-plugin-ledger-connector-iroha.web.umd.js","browserMinified":"dist/cactus-plugin-ledger-connector-iroha.web.umd.min.js","module":"dist/lib/main/typescript/index.js","types":"dist/types/main/typescript/index.d.ts","scripts":{"generate-sdk":"openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected","codegen:openapi":"npm run generate-sdk","codegen":"run-p 'codegen:*'","watch":"npm-watch","webpack":"npm-run-all webpack:dev webpack:prod","webpack:dev":"npm-run-all webpack:dev:node webpack:dev:web","webpack:dev:web":"webpack --env=dev --target=web --config ../../webpack.config.js","webpack:dev:node":"webpack --env=dev --target=node --config ../../webpack.config.js","webpack:prod":"npm-run-all webpack:prod:node webpack:prod:web","webpack:prod:web":"webpack --env=prod --target=web --config ../../webpack.config.js","webpack:prod:node":"webpack --env=prod --target=node --config ../../webpack.config.js"},"watch":{"codegen:openapi":{"patterns":["./src/main/json/openapi.json"]}},"publishConfig":{"access":"public"},"engines":{"node":">=10","npm":">=6"},"repository":{"type":"git","url":"git+https://github.com/elenaizaguirre/cactus.git"},"keywords":["Hyperledger","Cactus","Iroha","Integration","Blockchain","Distributed Ledger Technology"],"author":{"name":"Hyperledger Cactus Contributors","email":"cactus@lists.hyperledger.org","url":"https://www.hyperledger.org/use/cactus"},"contributors":[{"name":"Peter Somogyvari","email":"peter.somogyvari@accenture.com","url":"https://accenture.com"},{"name":"Han Xu","email":"hanxu8@illinois.edu","url":"https://github.com/hxlaf"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/hyperledger/cactus/issues"},"homepage":"https://github.com/hyperledger/cactus#readme","dependencies":{"@elenaizaguirre/cactus-common":"0.9.3","@elenaizaguirre/cactus-core":"0.9.3","@elenaizaguirre/cactus-core-api":"0.9.3","@types/google-protobuf":"3.15.3","axios":"0.21.1","express":"4.17.1","grpc":"1.24.11","iroha-helpers-ts":"0.9.25-ss","openapi-types":"7.0.1","prom-client":"13.1.0","typescript-optional":"2.0.1"},"devDependencies":{"@elenaizaguirre/cactus-plugin-keychain-memory":"0.9.3","@elenaizaguirre/cactus-test-tooling":"0.9.3","@types/express":"4.17.8"},"gitHead":"0d5cded5b3d726c93392ed2ce0fe8dfa2dc03c95","_id":"@elenaizaguirre/cactus-plugin-ledger-connector-iroha@0.9.3","_nodeVersion":"16.3.0","_npmVersion":"lerna/4.0.0/node@v16.3.0+x64 (linux)","dist":{"integrity":"sha512-DFONLT+vW3e+ztoPmrz8AJTqoEsWuv65K+BVNdUPIEGATLDFgyY6c2zMcvFegyUJwewDnA1cURLEHIgHD33nAQ==","shasum":"0d8694422ede7b7f9a3aa3a14d1fd0e2c10901cb","tarball":"https://registry.npmjs.org/@elenaizaguirre/cactus-plugin-ledger-connector-iroha/-/cactus-plugin-ledger-connector-iroha-0.9.3.tgz","fileCount":54,"unpackedSize":10374187,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC67jBFz4R7s1j1ZnmLEBnau6MMAdzICcYj27lmSo3nuwIhAO99MgoGpJ0QLbLp44XALgeoGZLCDDLV+RbjprpSPan0"}]},"_npmUser":{"name":"elenaizaguirre","email":"e.izaguirre.equiza@accenture.com"},"directories":{},"maintainers":[{"name":"elenaizaguirre","email":"e.izaguirre.equiza@accenture.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cactus-plugin-ledger-connector-iroha_0.9.3_1632223848305_0.690391136641074"},"_hasShrinkwrap":false},"0.9.4":{"name":"@elenaizaguirre/cactus-plugin-ledger-connector-iroha","version":"0.9.4","description":"Allows Cactus nodes to connect to an Iroha ledger.","main":"dist/lib/main/typescript/index.js","mainMinified":"dist/cactus-plugin-ledger-connector-iroha.node.umd.min.js","browser":"dist/cactus-plugin-ledger-connector-iroha.web.umd.js","browserMinified":"dist/cactus-plugin-ledger-connector-iroha.web.umd.min.js","module":"dist/lib/main/typescript/index.js","types":"dist/types/main/typescript/index.d.ts","scripts":{"generate-sdk":"openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected","codegen:openapi":"npm run generate-sdk","codegen":"run-p 'codegen:*'","watch":"npm-watch","webpack":"npm-run-all webpack:dev webpack:prod","webpack:dev":"npm-run-all webpack:dev:node webpack:dev:web","webpack:dev:web":"webpack --env=dev --target=web --config ../../webpack.config.js","webpack:dev:node":"webpack --env=dev --target=node --config ../../webpack.config.js","webpack:prod":"npm-run-all webpack:prod:node webpack:prod:web","webpack:prod:web":"webpack --env=prod --target=web --config ../../webpack.config.js","webpack:prod:node":"webpack --env=prod --target=node --config ../../webpack.config.js"},"watch":{"codegen:openapi":{"patterns":["./src/main/json/openapi.json"]}},"publishConfig":{"access":"public"},"engines":{"node":">=10","npm":">=6"},"repository":{"type":"git","url":"git+https://github.com/elenaizaguirre/cactus.git"},"keywords":["Hyperledger","Cactus","Iroha","Integration","Blockchain","Distributed Ledger Technology"],"author":{"name":"Hyperledger Cactus Contributors","email":"cactus@lists.hyperledger.org","url":"https://www.hyperledger.org/use/cactus"},"contributors":[{"name":"Peter Somogyvari","email":"peter.somogyvari@accenture.com","url":"https://accenture.com"},{"name":"Han Xu","email":"hanxu8@illinois.edu","url":"https://github.com/hxlaf"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/hyperledger/cactus/issues"},"homepage":"https://github.com/hyperledger/cactus#readme","dependencies":{"@elenaizaguirre/cactus-common":"0.9.4","@elenaizaguirre/cactus-core":"0.9.4","@elenaizaguirre/cactus-core-api":"0.9.4","@types/google-protobuf":"3.15.3","axios":"0.21.4","express":"4.17.1","grpc":"1.24.11","iroha-helpers-ts":"0.9.25-ss","openapi-types":"7.0.1","prom-client":"13.1.0","typescript-optional":"2.0.1"},"devDependencies":{"@elenaizaguirre/cactus-plugin-keychain-memory":"0.9.4","@elenaizaguirre/cactus-test-tooling":"0.9.4","@types/express":"4.17.8"},"gitHead":"50ad5e82a81dfca2040770c696d353055f27a24a","_id":"@elenaizaguirre/cactus-plugin-ledger-connector-iroha@0.9.4","_nodeVersion":"16.3.0","_npmVersion":"lerna/4.0.0/node@v16.3.0+x64 (linux)","dist":{"integrity":"sha512-hk7jq2gwPjCCFh2jpV1qLMWvAc2kg0PplVL/kKMTbhGdjfJ30nXaNH20zy8Taim2/VBrp84bIffvmboKU25leg==","shasum":"28e87cfa091eac11ae7c53aed624e9aac4384779","tarball":"https://registry.npmjs.org/@elenaizaguirre/cactus-plugin-ledger-connector-iroha/-/cactus-plugin-ledger-connector-iroha-0.9.4.tgz","fileCount":55,"unpackedSize":11080138,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2FlECRA9TVsSAnZWagAAoB4P/A/gWtqjSPDStxWlmP39\n7isax6oAyTuE8ZwQRVa6hhSTHd7kZF5FYg76f7u1znoFpAd1g1Fh7QqgCRE4\nhneEMkYDPaP0mW/qx9vOyjmZCTmPnLmbAQ2vBY3RyXLy/OZXXq/Vy9qu4HD0\n/eu31Vx2AdeyaPPpZjrOGn+TtdjAk4trbJINVGUkokjwPjq5kN1LVC+ZY4FG\nk8tbLhoSVoZE/q2W3TNrG7AyErm4A7gv6SmwQO85+mInHPcOnYdKYCJFJatf\nVdan3EGHpfWlwtGOtgx4L0NC3jrMr0012pTtFhhzZSiF+emtIzwW5+iMXujV\nPOYrqMXRNG7ey+CGdXMTC8/0+3YM4KGYu1kko19yhGEmYUrP1DYpnRdGt+qd\nxqCDWff1sIbq4yaQZ3bpeZMJ9ySjkB7gJy9Yrnplh+JhcYRk0UEwWYU0qnlf\nftriLPQNHdGuo9EK+BLfKBCnHT84va20ZaOPf7I7TI4x5UcLr6E74wi+IaUY\nx5I92on8VYcKqKlptP8noQzDemaYFJcqi1OoGtKCnZ//BvhDNjVpZmm1Xsb2\n+Y2T+SJtrWLgpqiOw2xC8V7radBIng8XxB7PZX/8kAJhd47Nk1izV9uXtVAl\n5hT/Zscs26qg/DBELudfFq3bQ/iRRqiAdGGqPSKtALjCV8KNCbDlqXfYH/OU\nYp3o\r\n=/GAp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCz8wf7GvueTYJ0AtNtnN4h0L14tHIdG9pn9CVmUEjZ/QIhAOp4WzFLsFLN8+9blqVAm9joP1akpZhDXdUGddZk2TQu"}]},"_npmUser":{"name":"elenaizaguirre","email":"e.izaguirre.equiza@accenture.com"},"directories":{},"maintainers":[{"name":"elenaizaguirre","email":"e.izaguirre.equiza@accenture.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cactus-plugin-ledger-connector-iroha_0.9.4_1632388162539_0.1615535404368147"},"_hasShrinkwrap":false}},"time":{"created":"2021-09-21T11:30:48.265Z","0.9.3":"2021-09-21T11:30:48.653Z","modified":"2022-04-05T07:09:35.406Z","0.9.4":"2021-09-23T09:09:22.758Z"},"maintainers":[{"name":"elenaizaguirre","email":"e.izaguirre.equiza@accenture.com"}],"description":"Allows Cactus nodes to connect to an Iroha ledger.","homepage":"https://github.com/hyperledger/cactus#readme","keywords":["Hyperledger","Cactus","Iroha","Integration","Blockchain","Distributed Ledger Technology"],"repository":{"type":"git","url":"git+https://github.com/elenaizaguirre/cactus.git"},"contributors":[{"name":"Peter Somogyvari","email":"peter.somogyvari@accenture.com","url":"https://accenture.com"},{"name":"Han Xu","email":"hanxu8@illinois.edu","url":"https://github.com/hxlaf"}],"author":{"name":"Hyperledger Cactus Contributors","email":"cactus@lists.hyperledger.org","url":"https://www.hyperledger.org/use/cactus"},"bugs":{"url":"https://github.com/hyperledger/cactus/issues"},"license":"Apache-2.0","readme":"# `@elenaizaguirre/cactus-plugin-ledger-connector-iroha`\n\nThis plugin provides `Cactus` a way to interact with Iroha networks. Using this we can perform:\n* Run various Iroha leger commands and queries.\n* Build and sign transactions using any arbitrary credential.\n## Summary\n\n  - [Getting Started](#getting-started)\n  - [Architecture](#architecture)\n  - [Usage](#usage)\n  - [Runing the tests](#running-the-tests)\n  - [Built With](#built-with)\n  - [Contributing](#contributing)\n  - [License](#license)\n  - [Acknowledgments](#acknowledgments)\n\n## Getting Started\n\nClone the git repository on your local machine. Follow these instructions that will get you a copy of the project up and running on your local machine for development and testing purposes.\n\n### Prerequisites\n\nIn the root of the project, execute the command to install the dependencies:\n```sh\nyarn run configure\n```\n\n### Compiling\n\nIn the project root folder, run this command to compile the plugin and create the dist directory:\n```sh\n# For one off builds:\nyarn run build:dev:backend\n```\n\n```sh\n# For continuous watching of the source code with \n# automatic recompilation (more convenient) \nyarn run watch\n```\n\n### Architecture\nThe sequence diagrams for various endpoints are mentioned below\n\n#### run-transaction-endpoint\n![run-transaction-endpoint sequence diagram](docs/architecture/images/run-transaction-endpoint.png)\n\nThe above diagram shows the sequence diagram of run-transaction-endpoint. User A (One of the many Users) interacts with the API Client which in turn, calls the API server. The API server then executes `transact()` method which is explained in detailed in the subsequent diagrams.\n\n![run-transaction-endpoint transact() method](docs/architecture/images/run-transaction-endpoint-transact.png)\n\nThe above diagram shows the sequence diagram of `transact()` method of the `PluginLedgerConnectorIroha` class. The caller to this function, which in reference to the above sequence diagram is API server, sends `RunTransactionRequestV1` object as an argument to the `transact()` method. Based on the exact command name of the request, corresponsing response `RunTransactionResponse` is sent back to the caller.  \n\n### Usage\n\nTo use this import public-api and create new **PluginFactoryLedgerConnector**. Then use it to create a connector.\n```typescript\n  const factory = new PluginFactoryLedgerConnector({\n    pluginImportType: PluginImportType.Local,\n  });\n\n  const connector: PluginLedgerConnectorIroha = await factory.create({\n    rpcToriiPortHost,\n    instanceId: uuidv4(),\n    pluginRegistry: new PluginRegistry(),\n  });\n```\nYou can make calls through the connector to the plugin API:\n\n```typescript\nasync transact(req: RunTransactionRequestV1):Promise<RunTransactionResponse>;\n```\n\nCall example to run an Iroha execute account command:\n```typescript\n    const req = {\n      commandName: IrohaCommand.CreateAccount,\n      baseConfig: {\n        irohaHost: \"localhost\",\n        irohaPort: 50051,\n        creatorAccountId: \"admin@test\",\n        privKey: [\"f101537e319568c765b2cc89698325604991dca57b9716b58016b253506cab70\"],\n        quorum: 1,\n        timeoutLimit: 5000,\n      },\n    const res = await apiClient.runTransactionV1(req);\n```\nCall example to run an Iroha get account query:\n```typescript\n    const req = {\n      commandName: IrohaQuery.GetAccount,\n      baseConfig: {\n        irohaHost: \"localhost\",\n        irohaPort: 50051,\n        creatorAccountId: \"admin@test\",\n        privKey: [\"f101537e319568c765b2cc89698325604991dca57b9716b58016b253506cab70\"],\n        quorum: 1,\n        timeoutLimit: 5000,\n      },\n      params: [\"admin@test\"],\n    };\n    const res = await apiClient.runTransactionV1(req);\n```\n> Extensive documentation and examples in the [readthedocs](https://readthedocs.org/projects/hyperledger-cactus/) (WIP) \n\n\n### Building/running the container image locally\n\nIn the Cactus project root say:\n\n```sh\nDOCKER_BUILDKIT=1 docker build -f ./packages/cactus-plugin-ledger-connector-iroha/Dockerfile . -t cplcb\n```\n\nBuild with a specific version of the npm package:\n```sh\nDOCKER_BUILDKIT=1 docker build --build-arg NPM_PKG_VERSION=latest -f ./packages/cactus-plugin-ledger-connector-iroha/Dockerfile . -t cplcb\n```\n\n#### Running the container\n\nLaunch container with plugin configuration as an **environment variable**:\n```sh\ndocker run \\\n  --rm \\\n  --publish 3000:3000 \\\n  --publish 4000:4000 \\\n  --publish 5000:5000 \\\n  --env PLUGINS='[{\"packageName\": \"@elenaizaguirre/cactus-plugin-ledger-connector-iroha\", \"type\": \"org.hyperledger.cactus.plugin_import_type.LOCAL\",  \"options\": {\"rpcApiHttpHost\": \"http://localhost:8545\", \"instanceId\": \"some-unique-iroha-connector-instance-id\"}}]' \\\n  cplcb\n```\n\nLaunch container with plugin configuration as a **CLI argument**:\n```sh\ndocker run \\\n  --rm \\\n  --publish 3000:3000 \\\n  --publish 4000:4000 \\\n  --publish 5000:5000 \\\n  cplcb \\\n    ./node_modules/.bin/cactusapi \\\n    --plugins='[{\"packageName\": \"@elenaizaguirre/cactus-plugin-ledger-connector-iroha\", \"type\": \"org.hyperledger.cactus.plugin_import_type.LOCAL\",  \"options\": {\"rpcApiHttpHost\": \"http://localhost:8545\", \"instanceId\": \"some-unique-iroha-connector-instance-id\"}}]'\n```\n\nLaunch container with **configuration file** mounted from host machine:\n```sh\n\necho '[{\"packageName\": \"@elenaizaguirre/cactus-plugin-ledger-connector-iroha\", \"type\": \"org.hyperledger.cactus.plugin_import_type.LOCAL\",  \"options\": {\"rpcApiHttpHost\": \"http://localhost:8545\", \"instanceId\": \"some-unique-iroha-connector-instance-id\"}}]' > cactus.json\n\ndocker run \\\n  --rm \\\n  --publish 3000:3000 \\\n  --publish 4000:4000 \\\n  --publish 5000:5000 \\\n  --mount type=bind,source=\"$(pwd)\"/cactus.json,target=/cactus.json \\\n  cplcb \\\n    ./node_modules/.bin/cactusapi \\\n    --config-file=/cactus.json\n```\n\n#### Testing API calls with the container\n\nDon't have an Iroha network on hand to test with? Test or develop against our Iroha All-In-One dockerfile!\n\n**Terminal Window 1 (Ledger)**\n```sh\ndocker run -p 0.0.0.0:8545:8545/tcp  -p 0.0.0.0:8546:8546/tcp  -p 0.0.0.0:8888:8888/tcp  -p 0.0.0.0:9001:9001/tcp  -p 0.0.0.0:9545:9545/tcp hyperledger/cactus-iroha-all-in-one:latest\n```\n\n**Terminal Window 2 (Cactus API Server)**\n```sh\ndocker run \\\n  --network host \\\n  --rm \\\n  --publish 3000:3000 \\\n  --publish 4000:4000 \\\n  --publish 5000:5000 \\\n  --env PLUGINS='[{\"packageName\": \"@elenaizaguirre/cactus-plugin-ledger-connector-iroha\", \"type\": \"org.hyperledger.cactus.plugin_import_type.LOCAL\",  \"options\": {\"rpcApiHttpHost\": \"http://localhost:8545\", \"instanceId\": \"some-unique-iroha-connector-instance-id\"}}]' \\\n  cplcb\n```\n\n**Terminal Window 3 (curl - replace transaction request as needed)**\n```sh\ncurl --location --request POST 'http://127.0.0.1:4000/api/v1/plugins/@elenaizaguirre/cactus-plugin-ledger-connector-iroha/run-transaction' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n  commandName: 'createAsset',\n  baseConfig: {\n    irohaHost: 'localhost',\n    irohaPort: 50051,\n    creatorAccountId: 'admin@test',\n    privKey: [\n      'f101537e319568c765b2cc89698325604991dca57b9716b58016b253506cab70'\n    ],\n    quorum: 1,\n    timeoutLimit: 5000\n  },\n  params: [ 'coolcoin', 'test', 3]\n}'\n```\n\nThe above should produce a response that looks similar to this:\n\n```json\n{\n    \"success\": true,\n    \"data\": {\n        \"transactionReceipt\": {\n            \"txHash\": \"c3ffd772f26950243aa357ab4f21b9703d5172490b66ddc285355230d6df60b8\",\n            \"status\": \"COMMITTED\"\n        }\n    }\n}\n```\n\n## Running the tests\n\nTo check that all has been installed correctly and that the plugin has no errors run the tests:\n\n* Run this command at the project's root:\n```sh\nyarn run test:plugin-ledger-connector-iroha\n```\n\n## Contributing\n\nWe welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do!\n\nPlease review [CONTIRBUTING.md](../../CONTRIBUTING.md) to get started.\n\n## License\n\nThis distribution is published under the Apache License Version 2.0 found in the [LICENSE](../../LICENSE) file.\n\n## Acknowledgments \n","readmeFilename":"README.md"}