EIP-2612は、トークン保有者がオンチェーンのapproveトランザクションではなく、オフチェーン署名によってスマートコントラクトや別のアカウントに使用許可を付与できるERC-20 Permit拡張です。署名されたデータを単一のpermit()呼び出しに埋め込むことで、ユーザーはガス代を節約でき、インテグレーターは承認とアクションを1つのアトミックトランザクションにまとめることができます。
Key Characteristics
- Gasless, single-call approvals: 保有者がオフチェーンでEIP-712メッセージに署名し、1回のpermit()呼び出しで署名を検証しながら即座に使用許可を設定します。これにより、別途オンチェーンでのapproveが不要となり、UXが合理化されます。
- Security & backward compatibility: Each permit consumes a unique, ever-increasing nonce and the signature is bound to the token's EIP-712 domain (name, chain ID, contract address). The extension adds < 200 bytes to a standard ERC-20, leaving balances and transfers untouched.
- Seamless DeFi & wallet integration: DEXs, lending protocols, routers, and meta-TX relayers can batch permit -> action in one atomic transaction, while wallets like MetaMask and Ledger present it as a familiar Sign Message flow instead of a gas-priced approval.
SolanaでEIP-2612が不要な理由
Solanaでは、承認とアクションを1つのアトミックトランザクションにまとめることができ、デフォルトで他者が手数料を負担することも可能です。そのため、EthereumでEIP-2612が解決する2つの課題(承認の重複とユーザー負担のガス代)は、すでにプロトコルレベルで解消されています。追加のpermit関数、型付きデータドメイン、コントラクトのアップグレードは必要ありません。標準のSPL-Tokenプログラムが、これらの要件をそのまま満たします。
トークン承認モデル
Ethereumでは、ユーザーに代わってERC20トークンを2つのアドレス間で転送する場合、approve + transferFromが必要になることがよくあります。Solanaでは、各ユーザーはToken Programが認識するATA(Associated Token Accounts)をすでに持っています。1つのSolanaトランザクションで複数のinstructionsをアトミックに呼び出せるため、別途承認ステップは不要です。あるユーザーのtoken accountから別のユーザーのtoken accountへ、一度に直接転送できます。
手数料支払者(ガス委任)モデル
すべてのSolanaトランザクションでは、署名者と手数料支払者(fee-payer)の両方が明示的に指定されます。ユーザーが署名しつつ、第三者(ウォレットサービス、dAppバックエンド、リレイヤー)に手数料を支払わせることができます。そのため、EIP-2612が目指すガスレスなユーザー体験を、EIP-712のような特別なオフチェーン署名方式を導入することなく実現できます。
SolanaでEIP-2612を実現する方法
以下は、最も一般的な2つのpermit -> actionシナリオをSolanaのネイティブなプリミティブに対応させた、コピー&ペーストですぐ使える最小限の例です。どちらも@solana/web3.jsと@solana/spl-tokenを使用します。
1. オーナーが手数料を支払う(自己負担の転送)
オーナーが署名と手数料の支払いの両方を行います。Approve -> Transferを1つのアトミックなトランザクションにまとめるだけで、追加のpermit関数は必要ありません。
import { Connection, Keypair, PublicKey, Transaction } from "@solana/web3.js";
import {
createApproveInstruction,
createTransferInstruction,
getAssociatedTokenAddressSync
} from "@solana/spl-token";
const connection = new Connection("https://api.devnet.solana.com");
const owner = Keypair.generate();
const delegate = owner.publicKey;
const recipient = new PublicKey("DESTINATION_WALLET");
const mint = new PublicKey("TOKEN_MINT");
const amount = 1_000_000;
const ownerATA = getAssociatedTokenAddressSync(mint, owner.publicKey);
const recipientATA = getAssociatedTokenAddressSync(mint, recipient);
const ixApprove = createApproveInstruction(ownerATA, delegate, owner.publicKey, amount);
const ixTransfer = createTransferInstruction(ownerATA, recipientATA, owner.publicKey, amount);
const tx = new Transaction().add(ixApprove, ixTransfer);
tx.feePayer = owner.publicKey;
tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
tx.sign(owner);
const sig = await connection.sendRawTransaction(tx.serialize());
console.log("Sent (self-sponsored):", sig);2. 第三者が手数料を支払う(リレー転送)
ここでは、ホルダーがinstructionsに署名しますが、リレイヤー(またはdAppバックエンド)がSOLの手数料を負担します。SolanaはfeePayerフィールドと部分署名によって、これをネイティブにサポートしています。
import { Connection, Keypair, PublicKey, Transaction } from "@solana/web3.js";
import { createTransferInstruction, getAssociatedTokenAddressSync } from "@solana/spl-token";
const connection = new Connection("https://api.devnet.solana.com");
const owner = Keypair.generate(); // replace with real keypair
const feePayer = Keypair.generate(); // replace with real keypair
const recipient = new PublicKey("DESTINATION_WALLET");
const mint = new PublicKey("TOKEN_MINT");
const amount = 500_000;
const ownerATA = getAssociatedTokenAddressSync(mint, owner.publicKey);
const recipientATA = getAssociatedTokenAddressSync(mint, recipient);
const ix = createTransferInstruction(ownerATA, recipientATA, owner.publicKey, amount);
const tx = new Transaction().add(ix);
tx.feePayer = feePayer.publicKey;
tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
tx.partialSign(owner);
tx.sign(feePayer);
const sig = await connection.sendRawTransaction(tx.serialize());
console.log("Sent (relayer-sponsored):", sig);
すべてのデータを保存し、コンセンサスに参加するノード
- Ethereum: アーカイブノード
- Solana: [該当なし]
一部のデータを保存し、コンセンサスに参加するノード
- Ethereum: フルノード
- Solana: コンセンサスノード
一部のデータを保存し、コンセンサスに参加しないノード
- Ethereum: ライトノード
- Solana: RPCノード