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.
approve(spender, amount).transferFrom.permit and then the action.How Solana covers the same needs
Three protocol features replace the permit extension, and the Token Program needs no change:
| 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 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.
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,
];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.
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: 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 may be deprecated in a future release.