npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-smartcontracttx

v1.1.6

Published

Allows to run transactions on Ethereum based blockchains from within Node RED

Downloads

34

Readme

node-red-contrib-smartcontracttx

Allows to run transactions on Ethereum based blockchains from within Node RED

Call methods or run transactions using rpcUrl and ABI of existing contract. Allows OffChain DID/VP signing and verification.

npm npm CO2OffsetCode QualityCircleCIFOSSA Status

Installation

Install using Node-RED Package Manager (Palett).

Input - msg.payload

OnChain - Transaction/Retrieve

In 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.

{
  "method":"transfer",
  "args":["0x6B342cE1cb8671DDeeC57B62D78EB9333898d7da",20]
}

OffChain - Present

To 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 ) and presentation with the Data to crypt and sign.

{
  "presentTo":"0x02eb74c1b28754e079ac138f0d1d73c0b9d82ba2a14ea3146f7f540e841ee43679",
  "presentation":{
    'Hello':'World',
    'TimeStamp': 1641166171599
  }
}

If presentTo is not specified the presentation itself will just be signed and not encrypted.

Injection of unsecure values

If configuration option Allow Insecure Inject is set additional values might be specified in input msg.payload and will overwrite configured values:

{
  ...
  "privateKey":"0x12356....",
  "contract":"0x123456...",
  "abi": [...],
  "rpcUrl": "https://integration.corrently.io/",
  ...
}

In case no privateKey is specified in either input msg.payload or configuration, a new privateKey gets generated.

Output - msg.payload

For background compatibility all results are returned on Output[0]

Output[1] - OnChain Output. Returns results from method calls or transactions.

Output[2] - OffChain Output (JWT). Encrypted DID to be forwarded to other recipient.

Output[3] - OffChain Output. Presentations received and decoded.

Cloudwallet support

Implementation allows to use CloudWallet to persist received presentations/credentials or digital IDs via https://www.npmjs.com/package/cloudwallet

Usage as Module (no Node-RED)

You might use this module without having Node-RED available. However this requires to emulate some of the stuff Node-RED typically provides.

Installation

npm i --save node-red-contrib-smartcontracttx

Hello World (DID)

const SmartContractTX = require("node-red-contrib-smartcontracttx");

const app = async function() {
  const instanceAlice = new SmartContractTX();
  let msgAlice = {
    payload: {
        presentation: {
          'Hallo':'Welt'
        }
    }
  }

  // We need to do something with DIDComms (Message Alice wants to send) ...
  instanceAlice.setSender(async function(msgs) {
      // As soon as JWT got generated (Alice wants to send) - we forward to a new Bob
      const instanceBob = new SmartContractTX();
      let msgBob = msgs[2]; // Alice Output is [2] as we want the JWT
      console.log('Message from Alice to Bob',msgBob);
      // If Bob received a message he sends via output[3] to internal processes...
      instanceBob.setSender(async function(msgs) {
          console.log('Bob DID',msgs[3]);
      });
      await instanceBob.input(msgBob);
      console.log('End');
  });

  // Now we are ready to send Message from Alice
  await instanceAlice.input(msgAlice);
}

app();

Tutorials / Usecases

Maintainer / Imprint

Project Website: https://co2offset.io/

LICENSE

Apache-2.0