EIP-2612는 ERC-20 Permit 확장으로, 토큰 소유자가 온체인 승인 트랜잭션 대신 오프체인 서명을 통해 스마트 컨트랙트나 다른 계정에 지출 한도를 부여할 수 있도록 합니다. 서명된 데이터를 단일 permit() 호출에 포함시킴으로써 사용자는 가스비를 절약하고, 통합자는 승인과 실행을 하나의 원자적 트랜잭션으로 묶을 수 있습니다.
Key Characteristics
- Gasless, single-call approvals: 소유자가 오프체인 EIP-712 메시지에 서명하면 하나의 permit() 호출로 서명을 검증하는 동시에 즉시 한도를 설정하여, 별도의 온체인 승인이 필요 없어지고 사용자 경험이 간소화됩니다.
- 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.
솔라나에서 EIP-2612가 필요하지 않은 이유
솔라나에서는 승인과 실행을 하나의 원자적 트랜잭션으로 결합할 수 있고, 기본적으로 다른 사람이 수수료를 대신 부담할 수 있으므로, 이더리움에서 EIP-2612가 해결하는 두 가지 문제점(중복 승인과 사용자 부담 가스비)은 이미 프로토콜 수준에서 해소되어 있습니다. 별도의 permit 함수, 타입 데이터 도메인, 컨트랙트 업그레이드가 필요 없으며, 표준 SPL-Token 프로그램이 이러한 요구 사항을 기본으로 충족합니다.
토큰 승인 모델
Ethereum에서 사용자를 대신해 두 주소 간에 ERC20 토큰을 전송하려면 보통 approve + transferFrom이 필요합니다. Solana에서는 각 사용자가 이미 Token Program에서 인식하는 ATA(Associated Token Accounts)를 가지고 있습니다. 하나의 Solana 트랜잭션에서 여러 명령을 원자적으로 호출할 수 있으므로 별도의 승인 단계가 필요하지 않습니다. 한 사용자의 token account에서 다른 사용자의 token account로 한 번에 바로 전송할 수 있습니다.
수수료 지불자(가스 위임) 모델
모든 Solana 트랜잭션은 서명자와 수수료 지불자(fee-payer)를 명시적으로 지정합니다. 사용자는 트랜잭션에 서명하면서 제3자(지갑 서비스, dApp 백엔드 또는 릴레이어)가 수수료를 지불하도록 지정할 수 있습니다. 따라서 프로토콜은 EIP-2612가 목표로 하는 것과 동일한 가스리스 사용자 경험을 제공하면서도, EIP-712와 같은 별도의 오프체인 서명 방식을 도입하지 않습니다.
Solana에서 EIP-2612 구현하기
아래는 가장 일반적인 두 가지 permit -> action 시나리오를 Solana의 네이티브 프리미티브에 대응시킨, 복사해서 바로 사용할 수 있는 최소한의 예제 두 가지입니다. 두 예제 모두 @solana/web3.js와 @solana/spl-token을 사용합니다.
1. 소유자가 수수료 지불 (자체 후원 전송)
소유자가 서명과 수수료 지불을 모두 합니다. Approve -> Transfer를 하나의 원자적 트랜잭션으로 묶기만 하면 되며, 별도의 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. 제3자가 수수료 지불 (릴레이 전송)
여기서는 홀더가 명령에 서명하지만, 릴레이어(또는 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 노드