> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# EIP-2612 on Solana: Approve and Act in One Transaction

> See why Solana needs no permit function: combine an approval and an action in one transaction, and let a sponsor pay the fee.

EIP-2612 adds `permit` to ERC20 so that a holder can approve a spender with an
offchain signature. It removes the separate approval transaction and lets
someone else pay the gas. Solana transactions provide both properties without a
token extension.

## What permit solves on Ethereum

A standard ERC20 flow needs two transactions: the holder approves a contract,
then calls the contract that spends the tokens. The holder pays gas for both.
With EIP-2612, the holder signs an EIP-712 message, and a single `permit` call
sets the allowance from that signature.

<Columns cols={2}>
<Card title="ERC20 without permit">

- Transaction 1: `approve(spender, amount)`.
- Transaction 2: the action that calls `transferFrom`.
- The holder needs ETH for both.

</Card>
<Card title="ERC20 with EIP-2612">

- The holder signs a typed message offchain.
- One transaction calls `permit` and then the action.
- A relayer can submit it and pay the gas.

</Card>
</Columns>

## How Solana covers the same needs

Three protocol features replace the permit extension, and the Token Program
needs no change:

<Columns cols={3}>
<Card title="Several instructions per transaction" href="/developers/docs/core/transactions" arrow>

Put the approval and the action in one transaction. Both succeed or both fail.

</Card>
<Card title="A separate fee payer" href="/developers/docs/core/fees/fee-sponsorship" arrow>

A relayer or your backend pays the fee while the holder signs only to authorize.

</Card>
<Card title="Delegates" href="/developers/docs/tokens/basics/approve-delegate" arrow>

When a spender must act later, approve it as a delegate with a fixed amount.

</Card>
</Columns>

| Need | EIP-2612 | Solana |
| --- | --- | --- |
| One step for approve and act | `permit` plus the action in one call | Two instructions in one transaction |
| Holder pays no fee | A relayer submits the signed permit | The relayer signs as fee payer |
| Replay protection | A per-owner nonce and a deadline in the signed message | The transaction's recent blockhash, which also sets its expiry |
| Signature format | EIP-712 typed data bound to the token's domain | The holder's signature on the transaction itself |
| Token changes | The token must implement the extension | None. Every token works the same way. |

## Approve and act in one transaction

Add an [`ApproveChecked`](/developers/docs/tokens/basics/approve-delegate)
instruction and your program's instruction to the same transaction. Approve
exactly the amount the next instruction spends, so no allowance is left over. If
it may spend less, add a `Revoke` instruction at the end. A token account has
one delegate, so the approval replaces any existing one.

```ts
const instructions = [
  // Lets the vault's PDA pull up to 1 token from the user's token account.
  getApproveCheckedInstruction({
    source: userTokenAccount,
    mint,
    delegate: vaultAuthority,
    owner: user,
    amount: 1_000_000n,
    decimals: 6,
  }),
  // Your program's instruction, which spends the allowance in the same transaction.
  depositInstruction,
];
```

<Note>

**Often you can skip the approval**

The holder's signature applies to every instruction that lists the holder as a
signer, and it extends to the CPIs that instruction makes. Your program can
therefore transfer the holder's tokens directly, with no delegate. Use an
approval when you want to cap what the program can move.

</Note>

## Let a sponsor pay the fee

To give the holder a gasless flow, set a sponsor as the fee payer. The holder
and the sponsor sign the same transaction, and the holder needs no SOL for the
fee. The sponsor can also fund the rent deposit for any account the transaction
creates.

<Steps>
<Step title="Build">

Set the sponsor as fee payer and add the holder's instructions.

</Step>
<Step title="Holder signs">

The signature authorizes the approval and the action.

</Step>
<Step title="Sponsor signs">

The signature authorizes paying the fee.

</Step>
<Step title="Send">

The network charges the sponsor.

</Step>
</Steps>

```ts
const message = pipe(
  createTransactionMessage({ version: 0 }),
  // The sponsor pays the fee. The user only authorizes the instructions.
  (m) => setTransactionMessageFeePayerSigner(sponsor, m),
  (m) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, m),
  (m) => appendTransactionMessageInstructions(instructions, m),
);

// Signs with every signer attached to the message: the user and the sponsor.
const transaction = await signTransactionMessageWithSigners(message);
```

## When you still need an offchain signature

Some designs collect a signature now and act on it later, for example an order
book or an intent system. Two tools cover this:

- **Signed messages:** the holder signs an offchain message with their wallet,
  and your program verifies it by checking an Ed25519 signature verification
  instruction in the same transaction. Include a nonce or an order ID in the
  message, and have your program record it as used so that each signed message
  works once. Add an expiry to limit how long an unused signature stays valid.
- **[Durable nonces](/developers/docs/core/transactions/durable-nonces):** a
  transaction that uses a durable nonce in place of a recent blockhash does not
  expire, so a relayer can submit it later. It needs a nonce account, and it
  stays valid until the nonce authority advances the nonce. Durable nonces are
  planned to be replaced, around early 2027, so check the linked page before you
  build on them.

## Next steps

<Columns cols={3}>
<Card title="Approvals in the ERC20 guide" href="/developers/docs/migrate-to-solana/ethereum/standards/erc20#approvals">

Compare ERC20 allowances with Solana delegates.

</Card>
<Card title="ERC4337 on Solana" href="/developers/docs/migrate-to-solana/ethereum/standards/erc4337">

Map paymasters and smart accounts to Solana.

</Card>
<Card title="Fee sponsorship" href="/developers/docs/core/fees/fee-sponsorship" arrow>

See a tested example of a sponsored transfer.

</Card>
</Columns>
