{"id":19863071,"url":"https://github.com/energychain/node-red-contrib-smartcontracttx","last_synced_at":"2025-05-02T04:30:57.482Z","repository":{"id":43871087,"uuid":"442452366","full_name":"energychain/node-red-contrib-smartcontracttx","owner":"energychain","description":"Allows to run transactions on Ethereum based blockchains from within Node RED","archived":false,"fork":false,"pushed_at":"2022-12-08T05:42:59.000Z","size":1089,"stargazers_count":4,"open_issues_count":3,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-06T22:38:25.640Z","etag":null,"topics":["did","ethereum","node-red"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/energychain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-28T12:11:31.000Z","updated_at":"2023-04-03T10:31:08.000Z","dependencies_parsed_at":"2023-01-24T15:15:56.364Z","dependency_job_id":null,"html_url":"https://github.com/energychain/node-red-contrib-smartcontracttx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/energychain%2Fnode-red-contrib-smartcontracttx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/energychain%2Fnode-red-contrib-smartcontracttx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/energychain%2Fnode-red-contrib-smartcontracttx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/energychain%2Fnode-red-contrib-smartcontracttx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/energychain","download_url":"https://codeload.github.com/energychain/node-red-contrib-smartcontracttx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251986743,"owners_count":21675950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["did","ethereum","node-red"],"created_at":"2024-11-12T15:13:32.230Z","updated_at":"2025-05-02T04:30:55.955Z","avatar_url":"https://github.com/energychain.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-red-contrib-smartcontracttx\n\n\u003ca href=\"https://stromdao.de/\" target=\"_blank\" title=\"STROMDAO - Digital Energy Infrastructure\"\u003e\u003cimg src=\"./static/stromdao.png\" align=\"right\" height=\"85px\" hspace=\"30px\" vspace=\"30px\"\u003e\u003c/a\u003e\n\n**Allows to run transactions on Ethereum based blockchains from within Node RED**\n\nCall methods or run transactions using rpcUrl and ABI of existing contract. Allows OffChain DID/VP signing and verification.\n\n[![npm](https://img.shields.io/npm/dt/node-red-contrib-smartcontracttx.svg)](https://www.npmjs.com/package/node-red-contrib-smartcontracttx)\n[![npm](https://img.shields.io/npm/v/node-red-contrib-smartcontracttx.svg)](https://www.npmjs.com/package/node-red-contrib-smartcontracttx)\n[![CO2Offset](https://api.corrently.io/v2.0/ghgmanage/statusimg?host=node-red-contrib-smartcontracttx\u0026svg=1)](https://co2offset.io/badge.html?host=node-red-contrib-smartcontracttx)[![Code Quality](https://api.codiga.io/project/30556/score/svg)](https://app.codiga.io/public/project/30556/node-red-contrib-smartcontracttx/dashboard)[![CircleCI](https://circleci.com/gh/energychain/node-red-contrib-smartcontracttx/tree/main.svg?style=svg)](https://circleci.com/gh/energychain/node-red-contrib-smartcontracttx/tree/main)[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fenergychain%2Fnode-red-contrib-smartcontracttx.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fenergychain%2Fnode-red-contrib-smartcontracttx?ref=badge_shield)\n\n## Installation\n\nInstall using Node-RED Package Manager (Palett).\n\n## Input - msg.payload\n\n### OnChain - Transaction/Retrieve\n\nIn order to call a method of a SmartContract specify a JSON in `msg.payload` containing the method name as `method` and all required arguments in an array as `args`.\n\n```javascript\n{\n  \"method\":\"transfer\",\n  \"args\":[\"0x6B342cE1cb8671DDeeC57B62D78EB9333898d7da\",20]\n}\n```\n\n### OffChain - Present\n\nTo present a set of information (Object) signed to another party DID-VPs are used. In this case `msg.payload` must contain `presentTo` with the recipients publicKey (not address - [see here](https://ethereum.stackexchange.com/questions/13778/get-public-key-of-any-ethereum-account/79174) ) and `presentation` with the Data to crypt and sign.\n\n```javascript\n{\n  \"presentTo\":\"0x02eb74c1b28754e079ac138f0d1d73c0b9d82ba2a14ea3146f7f540e841ee43679\",\n  \"presentation\":{\n    'Hello':'World',\n    'TimeStamp': 1641166171599\n  }\n}\n```\n\nIf `presentTo` is not specified the presentation itself will just be signed and not encrypted.\n\n### Injection of unsecure values\n\nIf configuration option `Allow Insecure Inject` is set additional values might be specified in input `msg.payload` and will overwrite configured values:\n\n```javascript\n{\n  ...\n  \"privateKey\":\"0x12356....\",\n  \"contract\":\"0x123456...\",\n  \"abi\": [...],\n  \"rpcUrl\": \"https://integration.corrently.io/\",\n  ...\n}\n```\n\nIn case no privateKey is specified in either input msg.payload or configuration, a new privateKey gets generated.\n\n## Output - msg.payload\n\nFor background compatibility all results are returned on `Output[0]`\n\n`Output[1]` - OnChain Output. Returns results from method calls or transactions.\n\n`Output[2]` - OffChain Output (JWT). Encrypted DID to be forwarded to other recipient.\n\n`Output[3]` - OffChain Output. Presentations received and decoded.\n\n## Cloudwallet support\n\nImplementation allows to use [CloudWallet](https://rapidapi.com/stromdao-stromdao-default/api/cloudwallet) to persist received presentations/credentials or digital IDs via https://www.npmjs.com/package/cloudwallet\n\n## Usage as Module (no Node-RED)\n\nYou might use this module without having Node-RED available. However this requires to *emulate* some of the stuff Node-RED typically provides.\n\n### Installation\n\n```\nnpm i --save node-red-contrib-smartcontracttx\n```\n\n### Hello World (DID)\n\n```javascript\nconst SmartContractTX = require(\"node-red-contrib-smartcontracttx\");\n\nconst app = async function() {\n  const instanceAlice = new SmartContractTX();\n  let msgAlice = {\n    payload: {\n        presentation: {\n          'Hallo':'Welt'\n        }\n    }\n  }\n\n  // We need to do something with DIDComms (Message Alice wants to send) ...\n  instanceAlice.setSender(async function(msgs) {\n      // As soon as JWT got generated (Alice wants to send) - we forward to a new Bob\n      const instanceBob = new SmartContractTX();\n      let msgBob = msgs[2]; // Alice Output is [2] as we want the JWT\n      console.log('Message from Alice to Bob',msgBob);\n      // If Bob received a message he sends via output[3] to internal processes...\n      instanceBob.setSender(async function(msgs) {\n          console.log('Bob DID',msgs[3]);\n      });\n      await instanceBob.input(msgBob);\n      console.log('End');\n  });\n\n  // Now we are ready to send Message from Alice\n  await instanceAlice.input(msgAlice);\n}\n\napp();\n\n```\n\n## Tutorials / Usecases\n\n- [Call Method on SmartContract - ERC20 totalSupply](https://github.com/energychain/node-red-contrib-smartcontracttx/blob/main/docs/UC1_Call_Method.md)\n- [Issue Transaction](https://github.com/energychain/node-red-contrib-smartcontracttx/blob/main/docs/UC2_Transact_SC.md)\n- [Basic Verifiable Presentation](https://github.com/energychain/node-red-contrib-smartcontracttx/blob/main/docs/UC3_VP_Offchain.md)\n- [Digital Freddy - Digital Heritage](https://github.com/energychain/node-red-contrib-smartcontracttx/blob/main/docs/UC4_VP_DigitalFreddy.md)\n- [Using Presentation Processing Services](https://github.com/energychain/node-red-contrib-smartcontracttx/blob/main/docs/CB_PresentationProcessingService.md)\n- [Chinese whispers - Building a JWT/DID Bus](https://github.com/energychain/node-red-contrib-smartcontracttx/blob/main/docs/CB_Chinese_Whispers_Building_A_Bus.md)\n\n## Maintainer / Imprint\n\n\u003caddr\u003e\nSTROMDAO GmbH  \u003cbr/\u003e\nGerhard Weiser Ring 29  \u003cbr/\u003e\n69256 Mauer  \u003cbr/\u003e\nGermany  \u003cbr/\u003e\n  \u003cbr/\u003e\n+49 6226 968 009 0  \u003cbr/\u003e\n  \u003cbr/\u003e\nkontakt@stromdao.com  \u003cbr/\u003e\n  \u003cbr/\u003e\nHandelsregister: HRB 728691 (Amtsgericht Mannheim)\n\u003c/addr\u003e\n\nProject Website: https://co2offset.io/\n\n## LICENSE\n[Apache-2.0](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenergychain%2Fnode-red-contrib-smartcontracttx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenergychain%2Fnode-red-contrib-smartcontracttx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenergychain%2Fnode-red-contrib-smartcontracttx/lists"}