Giter VIP home page Giter VIP logo

openzeppelin-gsn-helpers's Introduction

OpenZeppelin GSN Helpers

NPM

Helper functions and scripts for using the Gas Station Network. Develop and test your GSN application with minimal setup.

Provides methods for:

  • Deploying a RelayHub instance

  • Funding a recipient

  • Query a recipient’s or relayer owner’s GSN balance

  • Running and registering a relayer

  • Withdrawing a relayer’s revenue

Overview

Installation

$ npm install @openzeppelin/gsn-helpers

Usage

The GSN Helpers come in two flavors: a command-line interface and a JavaScript library, providing high flexibility.

The following samples show how to use each to deploy the RelayHub contract, fund a recipient and then start a relayer server.

Using the CLI

$ npx oz-gsn deploy-relay-hub --ethereumNodeURL http://localhost:8545
Deploying singleton RelayHub instance
RelayHub deployed at 0xd216153c06e857cd7f72665e0af1d7d82172f494

$ npx oz-gsn fund-recipient --recipient <address> --amount 50000000
Recipient <address> balance is now 50000000 wei

$ npx oz-gsn run-relayer --ethereumNodeURL http://localhost:8545 --quiet
Starting relayer
~/.cache/gsn-nodejs/gsn-relay-v0.2.1
 -EthereumNodeUrl http://localhost:8545
 -RelayHubAddress 0xd216153c06e857cd7f72665e0af1d7d82172f494
 -Port 8090
 -Url http://localhost:8090
Relay is funded and ready!

Using the JavaScript library

const {
  deployRelayHub,
  runRelayer,
  fundRecipient,
} = require('@openzeppelin/gsn-helpers');

const web3 = new Web3('http://localhost:8545');

await deployRelayHub(web3);

await runRelayer(web3, { quiet: true });

await fundRecipient(web3, { recipient: <address>, amount: 50000000 });
Note
All of these actions require a local blockchain to be running in the background on port 8545.

Learn More

License

The MIT License.

openzeppelin-gsn-helpers's People

Contributors

nventuro avatar spalladino avatar ylv-io avatar aquiladev 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.