Gas sponsorship
Whether you're building an app, gas sponsorship allows you to create seamless user experiences by controlling how transaction fees are handled.
Gas manager overview
A gas manager is at the heart of how Openfort handles transaction fees. It serves as your control center for managing how and when your application sponsors users' gas fees.
Start by visiting the Gas Policy tab in your dashboard and clicking Add Policy. From there, 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:
Pay with credit card
Add balance credit to your account. When you choose this method, gas costs are automatically deducted from your balance as transactions occur. This is required for livemode operations.
Pay 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 for your network.
Deposit your tokens using the depositFor function

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.

Using external paymasters
Openfort supports integration with external paymasters for custom gas sponsorship requirements. When using external paymasters, use the pay_for_user strategy.
You can set up an external paymaster either through the dashboard or via the API.
Using the dashboard

# 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 covers the different types of policies and rules you can create.