Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opengsn/paymasters

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opengsn/paymasters

A GSN paymaster is a contract that actually pays for a relayed request (as the whole point of GSN is that the calling account require and usually lack eth)

  • 3.0.0-beta.6
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by20%
Maintainers
2
Weekly downloads
 
Created
Source

Sample GSN Paymasters

A GSN paymaster is a contract that actually pays for a relayed request (as the whole point of GSN is that the calling account require and usually lack eth)

AcceptEverythingPaymaster

This is the most naive paymaster: it will accept any request by any client. Obviously, you don't want to deploy that on mainnet, since any client will be able to make any number of requests to drain it.

WhitelistPaymaster

This paymaster accepts only request from specific, known addresses. This way it is protected from anonymous attack, but requires an extra step of whitelisting all valid addresses.

HashcashPaymaster

An example paymaster that tries to mitigate abuse by anonymous clients: It requires the client to perform a "proof of work" that is verified on-chain. the "approval data" should contain a hash over the caller's address and nonce.

TokenPaymaster

A paymaster that requires the calling account to have a specific token. The paymaster will pre-charge the user with the equivalent value of tokens before making the call (and refund it with the excess after the call)

The client doesn't have to have eth, but has to have an approval for the paymaster to pull tokens from its account (for an ETH-less account, this can be done using DAI's permit method, or using the next paymaster:)

ProxyDeployingPaymaster

A specific TokenPaymaster, that can also deploy a proxy account. Since the paymaster also deploys the proxy, it also makes this proxy "approve" the token, so the paymaster can charge the account with tokens - even for the proxy creation - and then for all future requests.

Important notice:

These contracts are provided as an example, and should NOT be deployed as-is into a real network. None of them have passed a security audit. Without a careful configuration, a caller can "grief" the paymaster by making many anonymous calls, and thus drain the paymaster's balance.

FAQs

Package last updated on 16 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc