GSN Provider
A web3.js compatible provider for sending transactions via the Gas Station Network (GSN). This package wraps a modified version of the RelayClient
from tabookey-gasless
with a custom web3 Provider.
Overview
Usage
Create a GSNProvider
and use it as the provider for your web3 instance:
const Web3 = require("web3");
const { GSNProvider } = require("@openzeppelin/gsn-provider");
const web3 = new Web3(new GSNProvider("http://localhost:8545"));
Transactions sent to contracts will then be automatically routed through the GSN:
const myContract = new web3.eth.Contract(abi, address);
// Sends the transaction via the GSN
await myContract.methods.myFunction().send({ from });
// Disable GSN for a specific transaction
await myContract.methods.myFunction().send({ from, useGSN: false });
Learn More
-
Check out Getting Started to use GSN Provider in a new project.
-
The Testing GSN Applications will teach you how to test your project locally.
-
Head to Interacting With
RelayHub
and the GSN Frequently Asked Questions for more information about its inner workings. -
For detailed usage information, take a look at the API Reference.