Gas Manager Coverage API Quickstart

Learn about the Gas Manager Coverage API which allows you to sponsor gas fees.

What is a Gas Manager?

The Gas Manager is an ERC-4337 Verifying Paymaster, an onchain contract that allows one entity to sponsor the gas fees for another entity. Gas Managers can be used by dapps or companies to remove the need for users to pay for gas, which significantly enhances the user experience and can help onboard the next generation of web3 users.

What is the Gas Manager Coverage API?

The Gas Manager Coverage API is a set of methods to sponsor user operations on behalf of users, and abstracting away the concept of "gas" from them. More information about it is mentioned in the sections below.

How to Sponsor a User Operation

📘

NOTE

Please note that using aa-sdk provides the easiest way to sponsor user operations. Checkout the tutorial on sponsoring UOs with aa-sdk. However, if you want to use the raw APIs to do it, steps are listed below.

To sponsor gas fees for your users using Gas Manager Coverage API, here are the steps you need to follow:

  1. Create a Gas Policy: Gas policies are rules defining conditions when you want to sponsor someone's gas. Developers can manually create gas policies through the Alchemy dashboard or programmatically through the Gas Manager Admin APIs. Once a policy is created, developers will receive a policy id.
  2. Get paymasterAndData: When sending a user operation, you can specify the paymasterAndData field in the userOp object. This field is the signature of the Gas Manager that validates your sponsorship for the user operation. You can get this field through alchemy_requestGasAndPaymasterAndData ( recommended ) or alchemy_requestPaymasterAndData methods using your gas policy id. This step uses methods specific to the Gas Manager Coverage API.
  3. Send the sponsored user operation: Once you get the paymasterAndData, you can use this in your user operation ( userOp ) to sponsor the given userOp. The Gas Manager will pay for the gas associated with the given user operation when it is mined.

📘

Note:

You must make the Gas Manager Coverage API requests with the Alchemy API key associated with the policy’s app.

Gas Manager Coverage API Endpoints

All the Gas Manager Coverage API endpoints are listed below along with links to their individual pages and brief descriptions.

ReadMe