Skip to content

Gas sponsorship

Whether you're building a game, marketplace, or any web3 application, these policies give you the tools to create seamless user experiences by controlling how transaction fees are handled.

What's a Gas Manager?

A gas manager is at the heart of how Openfort handles transaction fees. Think of it as your control center for managing how and when your application will sponsor user's gas fees.

Start by visiting the Gas Policy tab in your dashboard and clicking Add Policy. From there, you'll be able to configure how you want to handle transaction fees.

Sponsoring gas fees

When it comes to sponsoring gas fees, you have two main payment methods available:

Paying with credit card

The simplest way to get started is by adding balance credit to your account. When you choose this method, gas costs are automatically deducted from your balance as transactions occur. This is particularly useful when you're ready to go live with your project, as it's required for livemode operations.

Paying with native tokens

For more advanced use cases, you can use network native tokens (like ETH on Base). This method involves depositing tokens to Openfort's Paymaster contract. Here's how to set it up:

Check the entity addresses page to find the paymaster's address in your network.

Deposit your tokens using the depositFor function

deposit native tokens

Register your EOA wallet

Go to the backend wallets page to register your EOA wallet.

Sign and validate your signature

Click on advanced configuration (see the video below).

Configure your policy

Select "Sponsor gas with your tokens" when editing or creating a policy.

deposit native tokens

Optional: Using external paymasters

For those needing custom solutions, Openfort supports integration with external paymasters. This feature is particularly useful when you have specific requirements for gas sponsorship that go beyond the standard options. Note that when using external paymasters, you'll need to use the pay_for_user strategy.

You can set up an external paymaster either through the dashboard or via the API.

Using the dashboard

Using external paymasters

Using the API

# Create the paymaster object
curl https://api.openfort.io/v1/paymasters/ \
  -H "Authorization: Bearer $YOUR_SECRET_KEY" \
  -d address=80002 \
  -d url="YOUR_PAYMASTER_URL"
 
# Link it to your policy
curl https://api.openfort.io/v1/policies/:id \
  -H "Authorization: Bearer $YOUR_SECRET_KEY" \
  -d paymaster=pay_...

With these fundamentals in place, you're ready to start managing gas fees for your users. The next section will dive deeper into the different types of policies and rules you can create.