Giter Site home page Giter Site logo

service-node-relayer's Introduction

TSNN-Service-Node

This project is building a relayer able to execute signed transactions on behalf of other parties allowing them interacting with the blockchain without the need to have any ether.

Running a node

From Source with Node

Clone this Git repo and export the web3 url to the node that you would like to use and the private key to the account holding some ether like in the example below:

export WEB3_PROVIDER='https://ropsten.infura.io/abcdefghigk' 
export PRIVATE_KEY='1a2e...e741' 

Then just run it like this:

npm run start

This should produce a message resembling the following, confirm the public address of the account you wanted to use is correct:

TSN is up and running using account: 0x3a64b72aa106a55b2f012620f89086c2dfc68673 and web3 provider: https:/...

With Docker

This TSN image is deployed to Docker Hub under: radek1st/tenz-tsnn-js

To run it, specify a port you want it exposed on (like 7777), web3 url and the private key to the account holding ether to be used:

docker run -it -p7777:8080 \
    -e WEB3_PROVIDER='https://ropsten.infura.io/abcdefghigk' \
    -e PRIVATE_KEY='1a2e...e741' \
    radek1st/tenz-tsnn-js:0.0.1

This should produce a message resembling the following, confirm the public address of the account you wanted to use is correct:

TSN is up and running using account: 0x3a64b72aa106a55b2f012620f89086c2dfc68673 and web3 provider: https:/...

Interacting with the node

As a client POST request to /execute/:personalWallet with the following body format:

{
  "v":"0x1b",
  "r":"0x2a061c04485a307802d76f3e4c7fda40ec4d3390df3c6df28fd6c3165ca1fb59",
  "s":"0x5dd8b1d92512baa9ce7e49cad004a45c4bdabf8b852c99f522740f62b955a6c6",
  "from":"0x9E48c4A74D618a567CD657579B728774f35B82C5",
  "to":"0xf74694642a81a226771981cd38df9105a133c111",
  "value":"0",
  "data":"0x947aca55000000000000000000000000f938bfdc53f72cb7a4b1946969ba0cce05c902c6",
  "rewardType":"0x0000000000000000000000000000000000000000",
  "rewardAmount":"0"
}

where:

  • personalWallet - is the addres of deployed personal wallet smart contract to which the message originator has access
  • v, r, s - components of the signature of the message
  • from - source address that signed the message
  • to - target address if sending ether, or token contract address for token transfer
  • value - amount of ether to send
  • data - function payload like token transfer data or any other function call
  • rewardType - address(0) for ether, and token contract address for tokens payable as fee
  • rewardAmount - how much of ether/token should be paid as the fee

It's recommended to use Tenzorum-SDK on the client side.

service-node-relayer's People

Contributors

radek1st avatar

Watchers

James Cloos avatar 郑肖 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.