Gas manager policies are rules defined by companies that govern how and when an application will sponsor a user's gas fees using a paymaster like Alchemy's Gas Manager Coverage API.
An example of spending rules is included in the screenshot below:
This guide demonstrates the steps to create a gas manager policy. Please note that if you're looking to set up a gas policy on Mainnets, a subscription to the Growth or Enterprise plan is required. Consider upgrading your account if necessary.
Start by creating a new application or using an existing application and the associated chain.
Just testing? Try creating a policy on a testnet!
We advise setting up an application on a test network like Sepolia or Mumbai as your new gas manager policy will directly associate with the application and network.
Log in and navigate to the "Gas Policies" section and click the create a policy button.
Enter your gas manager's name and select the application from the previous step in the "Create Policy" form.
Click "Next" and set up address levels and global rules if needed.
These rules help limit the amount of money or the number of user ops that can be sent from the gas manager policy.
You can set up an address allowlist or blocklist to allow the usage of the gas manager policy to a list of specific addresses, or to exclude a list of certain addresses from the policy.
Define the duration of your policy, and the sponsorship expiry period, which is the period for which the Gas Manager signature (paymaster data) will remain valid once it is generated.
When your policy is ready, publish it! Your policy becomes live if its date range includes the current time. However, before it can be used, it must be activated.
Once your policy is published, activate it by clicking the "Activate" button!
To use your gas manager for sponsoring user operations:
- Retrieve your policy id and get your supported entry points via
- For each user operation requiring a gas manager, call
alchemy_requestPaymasterAndDatawith the user operation details.
- Use the returned
paymasterAndDatain the final user operation and submit it to a bundler using
- The Gas Manager will then cover the gas fee for the submitted user operation.
Updated about 2 months ago
Now that you created your first policy it's time to sponsor your first request!