> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.openfort.io/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

# Sponsor gas on Solana and Ethereum

Gas sponsorship lets users transact without holding SOL or a native gas token. Openfort sponsors gas the same way across Solana and every EVM chain: you define a policy, attach a gas sponsorship, and send. This page is the actionable reference for wiring it up.

Two models cover every use case:

* **App pays** — your project covers the fee so users transact for free.
* **User pays** — the user pays the fee in a token you choose: an [SPL token such as USDC on Solana](https://www.openfort.io/docs/configuration/gas-spl), or an [ERC-20 on EVM chains](https://www.openfort.io/docs/configuration/gas-erc20).

## How gas sponsorship works per chain

The configuration is identical; only the on-chain mechanism differs:

| Chain | Mechanism | Policy operation |
|-------|-----------|------------------|
| **EVM** (Ethereum, Base, Polygon, Arbitrum, …) | An ERC-4337 paymaster signs the UserOperation and pays gas. | `sponsorEvmTransaction` |
| **Solana** | A fee-payer relayer (Kora) signs the transaction as fee payer — no ERC-4337 needed. | `sponsorSolTransaction` |

You configure both from the same [gas sponsorships tab](https://dashboard.openfort.io/policies) and the same API.

## Gas sponsorship overview

A gas sponsorship is the control center for how and when your application sponsors users' gas fees.

Start by visiting the [gas sponsorships tab](https://dashboard.openfort.io/policies) in your dashboard and clicking **Add gas sponsorship**. From there, pick a **Sponsorship mode**:

* **App pays** — your project covers gas fees so users transact for free.
* **User pays** — users pay gas in a token you choose, instead of the native gas token.

## Gas sponsorship policies

Gas sponsorship policies define when and how transactions receive gas sponsorship. Policies are enforced using the [Policy Engine](https://www.openfort.io/docs/configuration/policies), which provides criteria-based controls such as:

* Restricting sponsorship to specific contract interactions or function calls
* Setting value caps and gas spending limits
* Restricting sponsored transactions to specific chains
* Filtering by recipient address (allowlist/denylist)

### Policy scopes

Gas sponsorship policies support two scopes:

| Scope | Behavior | `policyId` required? |
|-------|----------|----------------------|
| `project` | Applies to **all** transactions in the project automatically. The system discovers matching project-scoped policies in priority order. | No |
| `transaction` | Applies only when the `policyId` is explicitly passed in the request. Uses strict validation — if the policy's rules don't match, the transaction is rejected. | Yes |

:::tip
Use **project** scope for broad sponsorship rules (for example, sponsor all transactions under 1 ETH). Use **transaction** scope when you need explicit control over which policy applies to each request.
:::

### Sponsorship operations

Gas sponsorship policies use dedicated operation names:

| Operation | Description |
|-----------|-------------|
| `sponsorEvmTransaction` | Sponsor an EVM UserOperation |
| `sponsorSolTransaction` | Sponsor a Solana transaction |

:::info
These are different from backend wallet operations (`signEvmTransaction`, `sendEvmTransaction`, and so on) which are used for [backend wallet policies](https://www.openfort.io/docs/configuration/policies).
:::

Learn more about setting up [policies](https://www.openfort.io/docs/configuration/policies) and [policy rules](https://www.openfort.io/docs/configuration/policies/rules-reference).

## Sponsor gas (app pays)

To sponsor gas for your users, create a policy that says which transactions qualify, then create a `pay_for_user` gas sponsorship that bills your project balance. [Add balance credit](https://dashboard.openfort.io/settings/project/billing) first — it is required for `livemode` operations.

The two chains differ only in the policy operation and the send call. Pick your chain:

### Sponsor gas on Ethereum and EVM chains

:::steps
#### Create a policy for the sponsorship rules

Create a [policy](https://www.openfort.io/docs/configuration/policies) with the `sponsorEvmTransaction` operation. Leave `criteria` empty to sponsor every transaction, or add rules to scope it:

```bash
curl -X POST https://api.openfort.io/v2/policies \
  -H "Authorization: Bearer $YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "scope": "project",
    "description": "Sponsor all EVM transactions",
    "rules": [
      {
        "action": "accept",
        "operation": "sponsorEvmTransaction",
        "criteria": []
      }
    ]
  }'
```

#### Create the gas sponsorship (app pays)

Link the policy to a `pay_for_user` gas sponsorship. With no `paymaster` set, gas is billed to your project balance:

```bash
curl -X POST https://api.openfort.io/v2/fee-sponsorship \
  -H "Authorization: Bearer $YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "App-pays gas on EVM",
    "strategy": { "sponsorSchema": "pay_for_user" },
    "policyId": "ply_..."
  }'
```

#### Send a sponsored transaction

Pass the policy to `sendTransaction`. Openfort's paymaster covers gas — the user needs no ETH. See [Send gasless transactions (EVM)](https://www.openfort.io/docs/products/server/evm/gasless-transactions) for the full flow.

```ts
const result = await openfort.accounts.evm.backend.sendTransaction({
  account,
  chainId: 84532, // Base Sepolia
  interactions: [{ to: '{{CONTRACT_ADDRESS}}', data: '{{CALLDATA}}' }],
  policy: '{{POLICY_ID}}',
})
```
:::

### Sponsor gas on Solana

:::steps
#### Create a policy for the sponsorship rules

Create a [policy](https://www.openfort.io/docs/configuration/policies) with the `sponsorSolTransaction` operation. Solana policies are project-scoped and apply automatically to every transaction:

```bash
curl -X POST https://api.openfort.io/v2/policies \
  -H "Authorization: Bearer $YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "scope": "project",
    "description": "Sponsor all Solana transactions",
    "rules": [
      {
        "action": "accept",
        "operation": "sponsorSolTransaction",
        "criteria": []
      }
    ]
  }'
```

#### Create the gas sponsorship (app pays)

Link the policy to a `pay_for_user` gas sponsorship. Kora signs as fee payer and your project balance is billed:

```bash
curl -X POST https://api.openfort.io/v2/fee-sponsorship \
  -H "Authorization: Bearer $YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "App-pays gas on Solana",
    "strategy": { "sponsorSchema": "pay_for_user" },
    "policyId": "ply_..."
  }'
```

#### Send a sponsored transaction

Send as usual — the project-scoped policy applies automatically, so the wallet never needs SOL. See [Send gasless transactions (Solana)](https://www.openfort.io/docs/products/server/solana/gasless-transactions) for the full flow.

```ts
const result = await account.transfer({
  to: '{{DESTINATION_ADDRESS}}',
  amount: 1_000_000n,
  token: 'usdc',
  cluster: 'mainnet-beta', // or 'devnet'
})
```
:::

:::tip[Runnable examples]
See the complete runnable examples for [gas sponsorship](https://github.com/openfort-xyz/openfort-node/tree/main/examples/fee-sponsorship) in the Node SDK repository.
:::

## Let users pay gas in a token (user pays)

Instead of covering gas yourself, you can let users pay the fee in a token you accept. The mechanism differs per chain:

* **Solana** — users pay in a stablecoin such as [USDC, USDT, or USDG](https://www.openfort.io/docs/configuration/gas-spl). Kora signs as fee payer and collects the fee on-chain in the SPL mint you accept.
* **EVM** — users pay in an [ERC-20 token](https://www.openfort.io/docs/configuration/gas-erc20) at a live or fixed exchange rate.

In both cases your project balance is never debited.

### Pay with credit card

Add [balance credit](https://dashboard.openfort.io/settings/project/billing) to your account. When you choose the app-pays method, gas costs are automatically deducted from your balance as transactions occur. This is required for `livemode` operations.

## Using external paymasters

Openfort supports integration with external paymasters for custom gas sponsorship requirements on EVM chains.

:::info
When using an external paymaster, the only supported `strategy` is `pay_for_user`.
:::

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

### Dashboard

<img alt="Using external paymasters" src="https://www.openfort.io/images/blog/policy_addional_options_35e7b3096b.png" />

### API

:::code-group
```bash [command-line]
# Create the paymaster object
curl https://api.openfort.io/v1/paymasters \
  -H "Authorization: Bearer $YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "address": "0x7d526b7e99fbf52850a183...",
    "url": "YOUR_PAYMASTER_URL"
  }'

# Create a gas sponsorship linking the paymaster to a policy
curl -X POST https://api.openfort.io/v2/fee-sponsorship \
  -H "Authorization: Bearer $YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "External Paymaster Sponsorship",
    "strategy": { "sponsorSchema": "pay_for_user" },
    "paymaster": "pay_...",
    "policyId": "ply_..."
  }'
```

```ts [server.ts]
import Openfort from '@openfort/openfort-node';
const openfort = new Openfort(YOUR_SECRET_KEY);

// Create a gas sponsorship linking the paymaster to a policy
const sponsorship = await openfort.feeSponsorship.create({
  name: 'External Paymaster Sponsorship',
  strategy: { sponsorSchema: 'pay_for_user' },
  paymaster: 'pay_...',
  policyId: 'ply_...',
})
```
:::

With these fundamentals in place, you're ready to sponsor gas for your users on Solana and every EVM chain.
