# Gas sponsorship (/docs/swivy/gas-sponsorship)

<Callout type="warn" title="Preview: Swivy is not generally available">
Swivy is a **staging/testnet preview using software custody**, not a production custody service. All six public SDK packages are available at **1.0.1**. Use test assets only. [Set up the preview](/docs/swivy/preview-setup) or [request project access](/docs/swivy/request-access).
</Callout>

**In plain words:** every blockchain transaction costs a small network fee ("gas"). New users usually have no ETH or SOL to pay it. With sponsorship, a sponsor wallet you fund pays that fee for them, so their first transaction just works.

## Turn it on [#turn-it-on]

Sponsorship lives in your environment [policy](/docs/swivy/policies), under `executionPolicy.sponsorship`:

| Field | What it does |
|---|---|
| `enabled` | Master switch. |
| `autoSponsorTransactions` | Sponsor eligible transactions automatically. |
| `sponsoredNetworks` | The networks you pay gas on, for example `["base-sepolia"]`. |
| `maxSpendPerUserUsd` | The largest transaction value (in USD, from the intent's `requestedValueUsd`) that can be sponsored. Despite the name, it applies per transaction. |
| `maxSpendPerDayUsd` | The most you'll spend across the environment per day. |
| `allowedContractAddresses` | Only sponsor calls to these contracts (leave empty for any). |
| `allowClientTransactions` | Whether transactions built client-side can be sponsored. |
| `requireAdminApproval` | Hold sponsored transactions for an operator's approval. |
| `relayerMode` | `swivy_managed` (Swivy runs the sponsor wallets) or `organization_managed` (you do). |
| `fundingSource` | How sponsor wallets are topped up: `rails` (`crypto`, `stripe`), deposit addresses and a low-balance alert. |

```json
{
  "executionPolicy": {
    "requireMfa": true,
    "hostedExecution": true,
    "maxTransactionValueUsd": 500,
    "sponsorship": {
      "enabled": true,
      "autoSponsorTransactions": true,
      "sponsoredNetworks": ["base-sepolia"],
      "maxSpendPerUserUsd": 2,
      "maxSpendPerDayUsd": 50,
      "relayerMode": "swivy_managed"
    }
  }
}
```

## How a sponsored transaction runs [#how-a-sponsored-transaction-runs]

1. Your app submits an `execute_transaction` [intent](/docs/swivy/wallets-and-signing) as usual.
2. Swivy checks the network, the contract and your caps.
3. If it qualifies, sponsorship logic runs before signing, then Swivy broadcasts through your configured RPC.
4. The environment dashboard shows sponsor wallet balances per network.

## Things to know [#things-to-know]

- Sponsorship pays **network fees only**, not the value being sent.
- On Solana, opening a token account for a first-time recipient needs a small refundable **rent deposit**. That's a Solana rule, not a Swivy fee.
- Set caps before you enable it. An uncapped sponsor wallet is an open tab.

## Sponsorship modes [#sponsorship-modes]

Available in the testnet preview, subject to environment configuration. `prefund` sends native gas to the wallet. Solana `fee_payer` pays fees directly; EVM `exact_gas` funds the encoded worst-case gas cost and is not a guarantee that no residual balance remains:

| Field | Values | What it does |
|---|---|---|
| `solanaMode` | `fee_payer` or `prefund` (default) | `fee_payer` makes the sponsor the **fee payer** of the user's transaction. Get the address from `GET /v1/runtime/sponsorship/fee-payer` and use it as the transaction's payer. Swivy checks the transaction and simulates it before the sponsor co-signs. |
| `evmMode` | `exact_gas` or `prefund` (default) | `exact_gas` sends exactly that transaction's worst-case gas and no more. |
| `maxSponsoredTransactionsPerAccountPerDay` | number | A per-wallet cap on sponsored sends per UTC day. In `fee_payer` or `exact_gas` mode it defaults to **20** when unset; `prefund` has no default cap. |
| `solanaMaxPriorityFeeLamports` | number, default 50,000 | The largest priority fee the sponsor will pay. |
| `solanaMaxTokenAccountCreations` | number, default 0 | How many token accounts the sponsor may open (and pay rent for) per transaction. Paying rent is opt-in: set it to 1 to allow it. |

`exact_gas` refuses to fund anything unless the sponsor wallet's config sets `maxFundingWei`, the most one funding transfer may send.

In fee-payer mode the sponsor only signs if:
- it is used as the fee payer and nowhere else, except to pay for opening a token account;
- the transaction uses no address lookup tables;
- the simulation shows it losing no more than the fees.
