Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article examines Frame Transactions, which allow transaction verification, execution, and gas payments to be defined independently in individual frames without relying on ECDSA.

Conventional Ethereum transactions have relied on ECDSA signatures. This proposal introduces an abstraction called a frame, allowing transactions to be authenticated using arbitrary cryptographic schemes. EIP8141 aims to enable migration to post-quantum cryptography and fulfill the original vision of account abstraction.

This article explains the proposal below.

Overview

Frame Transactions at a glance

Conventional Ethereum transactions follow a protocol-defined sequence: authenticate the sender with an ECDSA signature, execute the operation, and charge the sender for gas. Frame Transactions divide this sequence into smaller execution units called frames, allowing users to compose them flexibly.

graph LR
    subgraph "従来のトランザクション"
        A1[ECDSA署名で本人確認] --> A2[処理を実行] --> A3[送信者がガス代支払い]
    end
graph LR
    subgraph "Frame Transaction"
        B1["フレーム0 VERIFY
本人確認(任意の方式)"] --> B2["フレーム1 VERIFY
Paymasterがガス支払い"] --> B3["フレーム2 SENDER
やりたい操作を実行"] --> B4["フレーム3 DEFAULT
後処理"]
    end

There are three key points.

  • Flexible signature schemes — Verification is not restricted to ECDSA. A VERIFY frame can implement custom verification logic, including post-quantum cryptography, biometric authentication, or multisignature verification.
  • Separate gas payments — The sender can pay for gas with APPROVE(0x3), or a paymaster can pay instead (the sender uses APPROVE(0x1), and the paymaster uses APPROVE(0x2)).
  • Multiple operations in one transaction — Multiple SENDER frames can safely group operations in one transaction, such as executing an approval and swap atomically.

This mechanism introduces a new transaction type (0x06) and four new opcodes (APPROVE, TXPARAM, FRAMEDATALOAD, and FRAMEDATACOPY).

Basic concept

The core idea behind Frame Transactions is to divide a transaction into multiple frames. Each frame is an independent unit of execution with a mode specifying the purpose of that frame.

For example, one frame can verify the transaction signature, another can call a contract on behalf of the sender, and another can pay for gas. Executing these frames sequentially completes the verification, execution, and payment of a single transaction.

In conventional transactions, the sequence of signature verification, execution, and gas payment is hardcoded into the protocol. Frame Transactions allow users to compose this sequence themselves. To use a signature scheme other than ECDSA, implement its verification logic in a VERIFY-mode frame.

Differences from ERC4337

ERC4337 is an important proposal that advanced account abstraction, but it depends on infrastructure outside the protocol (off-chain). It requires additional components such as bundlers and the EntryPoint contract, leaving challenges in data efficiency and protocol integration.

For more information about ERC4337, see the following article.

[ERC5635] Understanding the Mechanism for Managing NFT Licenses

The Frame Transactions proposed in EIP8141 address these issues at the protocol level. The transaction itself introduces the frame abstraction, allowing verification, execution, and gas payments to be defined flexibly on the EVM.

The following diagram compares the architectures of ERC4337 and EIP8141.

Comparison of ERC4337 and EIP8141

ERC4337 requires additional contract-level infrastructure, such as bundlers and the EntryPoint contract. EIP8141 integrates the mechanism natively into the protocol, removing the need for these intermediate layers.

Motivation

Dependence on ECDSA

In Ethereum today, all transactions are signed using ECDSA (Elliptic Curve Digital Signature Algorithm), an elliptic-curve cryptographic scheme. Account addresses are derived from ECDSA public keys, and transaction validity is verified using ECDSA signatures.

ECDSA (Elliptic Curve Digital Signature Algorithm)

This is the signature scheme used by Ethereum. Transactions are signed with private keys and verified with public keys. Its security relies on the difficulty of solving the elliptic curve discrete logarithm problem, an assumption that may no longer hold once practical quantum computers become available.

However, this mechanism has several limitations.

No migration path to post-quantum cryptography

Advances in quantum computing could threaten ECDSA's security in the future. The secp256k1 elliptic curve used by ECDSA is vulnerable to quantum computers, and the protocol provides no migration path to post-quantum-secure cryptographic schemes.

secp256k1

This is the set of elliptic curve parameters used by Ethereum. Bitcoin uses the same curve. Once quantum computers reach sufficient scale, signatures based on this curve are expected to become forgeable in a short period of time.

The original vision of account abstraction

Another issue is that the original vision of account abstraction has yet to be realized. Account abstraction removes dependence on a specific key scheme, allowing accounts to define their own authentication and payment methods. The original idea is that an account is an address with code, and the account should be free to decide how that code verifies signatures.

Account abstraction

The concept aims to make Ethereum accounts flexible rather than restricting them to a particular signature scheme or gas payment method. Users can choose authentication methods suited to their needs, including social recovery, multisignature verification, and biometrics.

Specification

Transaction structure

The three frame modes

Each frame has a mode field, whose lowest eight bits determine its execution mode. The proposal defines three modes. The following diagram compares their characteristics.

Three frame modes

Mode Value Caller Role
DEFAULT 0 ENTRY_POINT (address(0xaa)) Executes general-purpose calls, such as account deployment
VERIFY 1 ENTRY_POINT (address(0xaa)) Verifies the transaction. Signature verification and a call to APPROVE are required
SENDER 2 tx.sender Calls a contract on behalf of the sender. Requires sender_approved to be true beforehand

DEFAULT mode executes an ordinary call from the ENTRY_POINT address (address(0xaa)). It is primarily used to deploy smart accounts.

VERIFY mode handles transaction authentication. Like STATICCALL, it cannot modify state. Unless the APPROVE opcode is called during execution, the entire transaction is invalid. In addition, the data of a frame in this mode is excluded from the signature hash and cannot be read by other frames. This is because the frame contains signature data itself, which cannot be included in the data being signed.

SENDER mode executes a frame on behalf of the sender. Since msg.sender is set to tx.sender, it can interact with contracts as the sender's account. However, the transaction is invalid unless a preceding VERIFY frame calls APPROVE(0x1) or APPROVE(0x3) and sets sender_approved to true.

Mode flags

The higher bits of the mode field (from bit 9 onward) configure the execution environment.

Overview of the APPROVE opcode

Frame Transactions require explicit approval of sender authentication and gas payment within VERIFY frames. The new APPROVE opcode performs this approval.

APPROVE has three scopes.

  • 0x1 → Declares I am the sender (execution approval).
  • 0x2 → Declares I will pay for gas (payment approval).
  • 0x3 → Declares both at once.

The approval scope in the mode flags restricts which of these scopes can be used. The opcode section explains APPROVE in detail.

Bit position Meaning Applicable modes
9-10 Approval scope (scope restriction) All modes
11 Atomic batch SENDER mode only

Bits 9-10 restrict the scope that can be specified for the APPROVE opcode. For example, if bits 9-10 contain 1, only APPROVE(0x1) (execution approval) can be used in that frame. Bit 11 is the atomic batch flag, which enables the atomic batching mechanism described below.

RLP serialization

Frame Transactions follow the EIP2718 Typed Transaction Envelope as a new transaction type, 0x06.

EIP-2718(Typed Transaction Envelope)

This mechanism assigns a type to Ethereum transactions. The first byte of a transaction identifies its type, and each type can have a different payload structure. EIP1559 (type 2) and EIP4844 (type 3) also use this mechanism.

The payload is defined using the following RLP serialization.

javascript
[chain_id, nonce, sender, frames, max_priority_fee_per_gas, max_fee_per_gas, max_fee_per_blob_gas, blob_versioned_hashes]

frames = [[mode, target, gas_limit, data], ...]

RLP(Recursive Length Prefix)

This is a data encoding scheme used in Ethereum. It uniquely encodes arbitrarily nested lists and byte strings as bytes using length prefixes. It is widely used to serialize transactions and block headers.

A major difference from conventional transactions is the explicit inclusion of the sender field. ECDSA transactions can recover the sender address from the signature. Frame Transactions explicitly specify the sender to accommodate arbitrary signature schemes. There is also no value field. The sender's account code can handle ETH transfers, so the protocol does not need a value field.

Each frame consists of four fields: mode, target (the destination address), gas_limit, and data. If target is null, the destination is tx.sender.

For transactions without blobs, blob_versioned_hashes must be an empty list and max_fee_per_blob_gas must be 0.

Comparison of conventional transaction and Frame Transaction structures

Comparing Frame Transactions with conventional EIP1559 transactions (type 2) highlights the differences.

graph LR
    subgraph "従来(EIP-1559)"
        direction TB
        A1[nonce] --> A2[gas_limit]
        A2 --> A3[to]
        A3 --> A4[value]
        A4 --> A5[data]
        A5 --> A6[v, r, s 署名]
    end

    subgraph "Frame Transaction"
        direction TB
        B1[nonce] --> B2[sender 明示]
        B2 --> B3["frames[ ]"]
        B3 --> B4["Frame 0: mode, target,
gas_limit, data"]
        B3 --> B5["Frame 1: mode, target,
gas_limit, data"]
        B3 --> B6[...]
    end
Item Conventional (EIP1559) Frame Transaction
Sender identification Recovered from ECDSA signature Explicitly specified in the sender field
Transfer amount value field None (handled by account code)
Signature Fixed (v, r, s) Arbitrary logic within frames
Gas payment Automatically paid by the sender Paid by the account calling APPROVE(0x2)
Execution One to + data Flexibly composed from multiple frames

Conventional transactions perform one operation at one destination. Frame Transactions allow verification, execution, and payment to be composed from multiple frames.

Constraints

The transaction structure has several constraints that can be verified statically. The following Python pseudocode illustrates them.

python
assert tx.chain_id < 2**256
assert tx.nonce < 2**64
assert len(tx.frames) > 0 and len(tx.frames) <= MAX_FRAMES
assert len(tx.sender) == 20
assert (tx.frames[n].mode & 0xFF)  < 3
assert len(tx.frames[n].target) == 20 or tx.frames[n].target is None

# Atomic batchフラグ(ビット11)はSENDERモードでのみ有効
# 次のフレームもSENDERモードでなければならない
for i, frame in enumerate(tx.frames):
    if (frame.mode >> 10) & 1 == 1:
        assert (frame.mode & 0xFF) == 2               # SENDERモードであること
        assert i + 1 < len(tx.frames)                  # 最後のフレームではないこと
        assert (tx.frames[i + 1].mode & 0xFF) == 2     # 次のフレームもSENDERモード

The number of frames must be at least 1 and no greater than MAX_FRAMES (1000). The atomic batch flag is valid only in SENDER mode, and the frame following a frame with this flag set must also be in SENDER mode.

Bit structure of the mode field

The mode field is not merely a mode number. Different bits have different meanings.

Bit position Name Value range Meaning
0-7 Execution mode 0-2 0=DEFAULT, 1=VERIFY, 2=SENDER
9-10 Approval scope 0-3 Restricts scopes available to APPROVE
11 Atomic batch 0 or 1 If 1, the frame is part of an atomic batch

For example, mode = 0x802 can be broken down as follows.

Bit position Value Meaning
0-7 0x02 SENDER mode
9-10 0x00 No scope restriction
11 0x1 (ON) Atomic batch flag enabled

A single integer encodes three pieces of information: the mode, approval scope restriction, and atomic batch flag.

Receipts and signature hashes

Frame Transaction receipts have a different structure from conventional transaction receipts.

javascript
[cumulative_gas_used, payer, [frame_receipt, ...]]
frame_receipt = [status, gas_used, logs]

A notable addition is the payer field. The gas payer cannot be determined statically from the Frame Transaction payload alone, so the receipt must record that information. Each frame receipt contains status (success or failure), gas_used, and logs.

When calculating the signature hash, the data of VERIFY frames is replaced with empty data.

python
def compute_sig_hash(tx):
    for i, frame in enumerate(tx.frames):
        if (frame.mode & 0xFF) == VERIFY:
            tx.frames[i].data = Bytes()
    return keccak(rlp(tx))

Since the data in a VERIFY frame contains the signature itself, it cannot be included in the signature hash. The design also considers the possibility of aggregating cryptographic operations across multiple VERIFY frames in the future. Gas sponsorship workflows also require adding sponsor input after the sender has signed, so the data of VERIFY frames is deliberately excluded from the signature and remains mutable. However, the target of a VERIFY frame is included in the signature hash, requiring the sender to explicitly select the sponsor's address.

Why only VERIFY frame data is excluded from the signature hash

The following diagram illustrates the signature hash calculation.

graph TD
    A["Frame Transaction 全体"] --> B["署名ハッシュ計算"]
    B --> C["Frame 0 (VERIFY)
data → 空に置換"]
    B --> D["Frame 1 (VERIFY)
data → 空に置換"]
    B --> E["Frame 2 (SENDER)
data はそのまま"]
    C --> F["keccak(rlp(tx))"]
    D --> F
    E --> F
    F --> G["署名ハッシュ"]

There are three reasons.

  • A VERIFY frame's data contains the signature itself. Including it would create a circular dependency in which the signature signs a hash that includes itself.
  • Excluding the paymaster's data from the signature hash allows the paymaster to add its own data after the user signs. The user does not need to sign again.
  • However, the target (the party asked to perform verification) is included in the signature hash, so the user explicitly chooses the paymaster.

Opcodes

APPROVE(0xaa)

APPROVE is the most important new opcode in Frame Transactions. It behaves similarly to RETURN, but instead of merely terminating a frame, it also updates the transaction-scoped approval state.

It takes three values from the stack.

Stack position Value
top - 0 offset (memory offset)
top - 1 length (data length)
top - 2 scope (approval scope)

The scope value specifies the type of approval.

scope Meaning Conditions
0x1 Execution approval Sets sender_approved = true. Valid only when frame.target matches tx.sender
0x2 Payment approval Increments the nonce, collects the full gas cost, and sets payer_approved = true. Invalid unless sender_approved is already true
0x3 Execution and payment approval Performs both 0x1 and 0x2. Valid only when frame.target matches tx.sender

Only code executing at the frame.target address may call APPROVE. If ADDRESS does not match frame.target, execution reverts. This design makes it easier for the transaction pool and other frames to reason about the behavior of a VERIFY frame.

Importantly, sender_approved and payer_approved can each be set to true only once. Calling APPROVE again when the corresponding flag is already true causes a revert. Payment approval (0x2) must also follow execution approval (0x1). This enforces an order in which the sender first approves the transaction and the payer then assumes responsibility for the gas costs.

Bits 9-10 of the mode field restrict the approval scope, further limiting the approvals that the frame permits.

Value of bits 9-10 Available scopes
0 All scopes
1 Only 0x1
2 Only 0x2
3 Only 0x3

Overview of the approval flow

Frame Transactions separately approve who sent the transaction (execution approval) and who pays for gas (payment approval).

sequenceDiagram
    participant W as ウォレット(sender)
    participant P as Paymaster
    participant EVM as EVM

    Note over W: VERIFYフレームで署名検証
    W->>EVM: APPROVE(0x1) 実行承認
    Note over EVM: sender_approved = true

    Note over P: VERIFYフレームでガス確認
    P->>EVM: APPROVE(0x2) 支払い承認
    Note over EVM: payer_approved = true

    Note over EVM: 両方trueで実行開始

When paying for gas yourself, APPROVE(0x3) can grant both approvals at once. With a paymaster, you grant only sender approval using APPROVE(0x1), and the paymaster takes responsibility for gas payment using APPROVE(0x2).

TXPARAM(0xb0)

TXPARAM is an opcode for accessing transaction header and frame information. Its gas cost is 2.

It takes two values, param and in2, from the stack and returns the corresponding information on the stack.

The parameter table below lists the available information.

param in2 Returned value
0x00 Fixed at 0 Current transaction type
0x01 Fixed at 0 nonce
0x02 Fixed at 0 sender
0x03 Fixed at 0 max_priority_fee_per_gas
0x04 Fixed at 0 max_fee_per_gas
0x05 Fixed at 0 max_fee_per_blob_gas
0x06 Fixed at 0 Maximum cost (calculated with basefee at its maximum, including blob and intrinsic costs)
0x07 Fixed at 0 Number of blob_versioned_hashes
0x08 Fixed at 0 compute_sig_hash(tx) (signature hash)
0x09 Fixed at 0 Number of frames
0x10 Fixed at 0 Index of the currently executing frame
0x11 Frame index target
0x12 Frame index gas_limit
0x13 Frame index mode (lowest eight bits)
0x14 Frame index Length of data (returns 0 for a VERIFY frame)
0x15 Frame index status (exceptional halt for the current or a future frame)
0x16 Frame index scope (bits 9-10)
0x17 Frame index atomic_batch (bit 11; returns 0 or 1)

The ability to retrieve the signature hash with 0x08 is particularly important. Computing a signature hash from scratch inside the EVM is complex and gas-intensive. Providing a precomputed hash at the protocol level substantially simplifies smart account development. Using this hash is optional. However, accounts that do not use it must implement their own exact commitment to transaction data to address transaction malleability, in which third parties can modify part of a transaction.

An undefined param value causes an exceptional halt. Requesting the status (0x15) of the currently executing frame or a future frame also causes an exceptional halt.

FRAMEDATALOAD and FRAMEDATACOPY

The proposal also introduces two opcodes for accessing the data of other frames.

FRAMEDATALOAD (0xb1) reads 32 bytes from the specified frame's data. Its gas cost is 3, the same as CALLDATALOAD. It takes offset and frameIndex from the stack and places the loaded data on the stack.

FRAMEDATACOPY (0xb2) copies the specified frame's data into memory. Its gas cost is the same as CALLDATACOPY: a fixed cost of 3 plus variable memory expansion and copying costs. It takes four values from the stack: memOffset, dataOffset, length, and frameIndex.

Neither opcode returns data when targeting a VERIFY-mode frame (FRAMEDATALOAD returns zero, while FRAMEDATACOPY performs no copy). This design protects signature data privacy and supports potential future signature aggregation.

Execution flow

Execution steps for each frame

The following diagram illustrates the complete Frame Transaction execution flow.

Frame Transaction execution flow

Frame Transactions execute as follows.

First, check whether tx.nonce matches state[tx.sender].nonce (stateful validation). Then initialize the transaction-scoped variables.

python
payer_approved = False
sender_approved = False

Each frame is then executed sequentially.

The following flowchart illustrates Frame Transaction execution.

flowchart TD
    A["nonce検証"] --> B["payer_approved = false
sender_approved = false"]
    B --> C{"次のフレームあり?"}
    C -->|はい| D{"モードは?"}
    D -->|DEFAULT / VERIFY| E["caller = ENTRY_POINT
で実行"]
    D -->|SENDER| F{"sender_approved
== true?"}
    F -->|いいえ| G["トランザクション無効"]
    F -->|はい| H["caller = tx.sender
で実行"]
    E --> I{"VERIFYモードで
APPROVE呼ばれた?"}
    I -->|いいえ| G
    I -->|はい| C
    H --> C
    C -->|いいえ| J{"payer_approved
== true?"}
    J -->|はい| K["リファンド計算
トランザクション完了"]
    J -->|いいえ| G

Each frame executes with its specified mode, target, gas_limit, and data. If target is null, the destination is tx.sender. In SENDER mode, msg.sender is set to tx.sender. In DEFAULT or VERIFY mode, msg.sender is ENTRY_POINT.

In a Frame Transaction, the ORIGIN opcode returns the frame's caller. It therefore returns ENTRY_POINT in DEFAULT or VERIFY mode, and tx.sender in SENDER mode. This applies at every call depth.

If frame.target is an account without code (an EOA), execution uses the Default Code logic described below.

What is and is not shared between frames

Item Behavior across frames Example
Warm/cold access records Shared If frame 0 accesses account A, account A is warm in frame 1 (a gas discount applies)
Transient Storage Discarded A value written with TSTORE in frame 0 cannot be read with TLOAD in frame 1

In the EVM, gas costs differ between the first access to an account or storage location (cold) and subsequent accesses (warm). In Frame Transactions, accounts accessed in one frame remain warm in subsequent frames, reducing gas costs for repeated accesses. By contrast, transient storage (temporary storage lasting only within a transaction) is cleared at frame boundaries and cannot be used to pass data between frames.

Atomic Batching

Atomic Batching

This mechanism groups multiple operations so that either all succeed or all are reverted. For example, if an ERC20 approval and swap are grouped in one batch, the approval is automatically reverted if the swap fails. This prevents an account from being left in a partially updated state.

Consecutive SENDER-mode frames with the atomic batch flag (bit 11) set on every frame except the last form a single atomic batch. If any frame in the batch reverts, all state changes from preceding frames in that batch are reverted, and subsequent frames are skipped.

Execution proceeds as follows.

  1. Take a snapshot of the state before executing the first frame in the batch.
  2. Execute each frame in the batch in sequence.
  3. If any frame reverts, restore the state to the snapshot and skip the remaining frames.

Consider the following example.

Frame Mode Atomic batch flag
0 SENDER Set
1 SENDER Not set
2 SENDER Set
3 SENDER Set
4 SENDER Not set

Frames 0-1 form the first batch, and frames 2-4 form the second batch. If frame 3 reverts, state changes from frames 2 and 3 are discarded, and frame 4 is skipped. The batch containing frames 0-1 is independent and remains unaffected.

Without this mechanism, executing an approval and swap in separate frames could leave the approval intact even if the swap fails, exposing the account to an unnecessary authorization. The simple flag-based design identifies batch boundaries without introducing a new mode.

Why atomic batching matters

Swapping tokens on a DEX typically requires two operations.

graph LR
    A[approve - DEXにトークン使用を許可] --> B[swap - DEXでトークンを交換]

Consider what happens if these operations execute in separate frames and the swap fails. Without atomic batching, only the approval remains successful. The DEX has permission to use the tokens, but the exchange has not taken place. A malicious contract could abuse that permission.

With atomic batching, a failed swap automatically reverts the approval. Either every operation succeeds or all of them are undone.

Default Code (EOA support)

Frame Transactions define Default Code, allowing accounts without code (EOAs) to execute frames as well. This allows existing EOA users to benefit from gas abstraction without migrating to smart accounts.

The following Python pseudocode illustrates how Default Code works.

python
DEFAULT   = 0
VERIFY    = 1
SENDER    = 2

SECP256K1 = 0x0
P256      = 0x1

def default_code(frame, tx):
    mode = frame.mode & 0xFF

    if mode == VERIFY:
        scope = (frame.mode >> 8) & 3
        if scope == 0:
            revert()
        signature_type = frame.data[0]
        sig_hash       = compute_sig_hash(tx)

        if signature_type == SECP256K1:
            # frame.data: [signature_type(1byte), v(1byte), r(32bytes), s(32bytes)]
            if len(frame.data) != 66:
                revert()
            v = frame.data[1]
            r = frame.data[2:34]
            s = frame.data[34:66]
            if frame.target != ecrecover(sig_hash, v, r, s):
                revert()

        elif signature_type == P256:
            # frame.data: [signature_type(1byte), r(32bytes), s(32bytes), qx(32bytes), qy(32bytes)]
            if len(frame.data) != 129:
                revert()
            r  = frame.data[1:33]
            s  = frame.data[33:65]
            qx = frame.data[65:97]
            qy = frame.data[97:129]
            if frame.target != keccak256(qx + qy)[12:]:
                revert()
            if not P256VERIFY(sig_hash, r, s, qx, qy):
                revert()

        else:
            revert()

        APPROVE(scope)

    elif mode == SENDER:
        if frame.target != tx.sender:
            revert()

        # frame.data: RLPエンコードされた [[target, value, data], ...]
        calls = rlp_decode(frame.data)
        for call_target, call_value, call_data in calls:
            result = evm_call(caller=tx.sender, to=call_target, value=call_value, data=call_data)
            if result.reverted:
                revert()

    elif mode == DEFAULT:
        revert()

    else:
        revert()

Default Code behaves differently in each of the three modes.

In VERIFY mode, the first byte of frame.data determines the signature type. A value of 0x0 uses ECDSA (secp256k1) verification, while 0x1 uses P256 verification.

P256(secp256r1)

This elliptic curve is standardized by NIST and widely used in WebAuthn and secure hardware on iOS and Android. Its security against quantum computers is comparable to secp256k1, but it has extensive hardware-level support and can serve as a bridge to more secure cryptographic schemes in the future. A P256 address is determined by the lowest 20 bytes of the keccak hash of the public key (qx, qy).

How EOAs can use Frame Transactions

Ordinary EOAs (accounts without code) can also use Frame Transactions. When an account without code is the target of a frame, the protocol automatically executes Default Code.

graph TD
    A[VERIFYフレームでEOAが対象] --> B{signature_typeを確認}
    B -->|0x0| C[ECDSA(secp256k1)で署名検証]
    B -->|0x1| D[P256で署名検証]
    C --> E{署名は有効か}
    D --> E
    E -->|有効| F[APPROVE実行]
    E -->|無効| G[revert]

Existing EOA users can therefore use Frame Transactions to have a paymaster cover gas costs or pay gas using ERC20 tokens. P256 signature support also provides a migration path toward future post-quantum cryptography.

ECDSA verification requires 66 bytes of data (one byte for the type and 65 bytes for v, r, and s). It checks whether the address recovered using ecrecover matches frame.target.

P256 verification requires 129 bytes of data (one byte for the type and 128 bytes for r, s, qx, and qy). It derives an address from the keccak hash of the public key, confirms that it matches frame.target, and then verifies the signature with the P256VERIFY precompile.

In SENDER mode, Default Code RLP-decodes frame.data into a list of calls, [[target, value, data], ...], and executes them sequentially as tx.sender.

In DEFAULT mode, execution reverts. This is because executing in DEFAULT mode has no purpose for an EOA.

Gas calculation

Overall transaction gas limit

The gas limit of a Frame Transaction is calculated using the following formula.

javascript
tx_gas_limit = FRAME_TX_INTRINSIC_COST + calldata_cost(rlp(tx.frames)) + sum(frame.gas_limit)

FRAME_TX_INTRINSIC_COST is fixed at 15,000. calldata_cost follows standard EVM rules: 4 gas for a zero byte and 16 gas for a nonzero byte. The sum of the gas_limit values for all frames is the total gas available for frame execution.

Gas allocation per frame

Each frame receives an independent gas_limit. Gas unused by one frame does not carry over to the next frame. This design eliminates gas dependencies between frames and makes each frame's execution predictable.

Refunds

Once all frames have executed, unused gas is returned to the payer.

javascript
refund = sum(frame.gas_limit) - total_gas_used

The refund goes to the account that called APPROVE(0x2) or APPROVE(0x3) (the gas payer), and the unused gas is returned to the block's gas pool. This refund mechanism is separate from the EIP3529 storage refund mechanism.

The total transaction fee is calculated as follows.

javascript
tx_fee = tx_gas_limit * effective_gas_price + blob_fees
blob_fees = len(blob_versioned_hashes) * GAS_PER_BLOB * blob_base_fee

The effective_gas_price is calculated according to EIP1559, and blob fees follow EIP4844.

Mempool

Validation Prefix

Frame Transactions require special attention when operating transaction pools (mempools). Because verification logic can be arbitrary EVM code, malicious transactions can become a denial-of-service (DoS) attack vector that wastes node resources.

The proposal draws inspiration from ERC7562 while defining a mempool policy that eliminates staking and reputation mechanisms entirely.

ERC-7562

This standard defines account abstraction validation rules. It was developed as a set of rules for ERC4337 bundlers, but allowed exceptions based on staking and reputation. EIP8141 eliminates these exceptions and applies stricter rules.

The core concept in the mempool rules is the Validation Prefix. The Validation Prefix is the shortest sequence of frames from the beginning of the frame list until payer_approved = true is set. The mempool rules apply only to the Validation Prefix. Frames after payment approval (such as user operations and post-operation processing) can be composed freely.

Why the Validation Prefix is necessary

When a node receives a transaction, it needs to verify its validity. With Frame Transactions, however, validation logic can be arbitrary EVM code, potentially allowing malicious transactions to waste the node's computational resources.

graph TD
    A[トランザクション受信] --> B{Validation Prefix}
    B -->|payer_approved = true| C[mempoolに追加・ピアに伝播]
    B -->|MAX_VERIFY_GAS超過| D[拒否]
    B -->|禁止オペコード使用| D
    B -->|外部ストレージ参照| D

The Validation Prefix is the shortest sequence of frames ending when payer_approved becomes true. Only this portion is validated, and the transaction is rejected if it cannot complete within the gas limit of 100,000. Frames after payer_approved becomes true (user operations and post-operations) are outside mempool validation.

Four recognized prefixes

The public mempool accepts only the following four Validation Prefix patterns. The diagram provides an overview.

Four Validation Prefix patterns

The green dashed boundary encloses the Validation Prefix. Gray frames (user_op and post_op) are outside the Validation Prefix and are not subject to mempool validation.

Self Relay

Self Relay is the pattern in which the sender also pays for gas.

The basic pattern contains just one frame, self_verify.

text
+-------------+
| self_verify |
+-------------+

When deploying a new account, a deployment frame is added at the beginning.

text
+--------+-------------+
| deploy | self_verify |
+--------+-------------+
Canonical Paymaster

Paymaster

A paymaster is a contract that pays gas fees on behalf of users. Users can execute transactions even without holding ETH because the paymaster covers their gas fees. This enables flexible payment schemes, including payment in ERC20 tokens.

How a paymaster sponsors gas fees

For example, a user who holds USDC but no ETH can pay for gas in USDC using a paymaster.

sequenceDiagram
    participant U as ユーザー
    participant PM as Paymaster
    participant EVM as EVM

    U->>EVM: Frame 0 - VERIFY: 署名検証 → APPROVE(0x1)
    PM->>EVM: Frame 1 - VERIFY: USDC残高確認 → APPROVE(0x2)
    Note over EVM: sender + payer 両方承認済み
    U->>EVM: Frame 2 - SENDER: USDCをPaymasterに送金
    U->>EVM: Frame 3 - SENDER: 本来やりたい操作
    PM->>EVM: Frame 4 - DEFAULT: 未使用ガスの精算

In frame 1, the paymaster checks the user's USDC balance, verifies that the next frame contains an appropriate transfer, and calls APPROVE(0x2). The paymaster covers the gas fee in ETH and collects payment from the user in USDC.

The Canonical Paymaster pattern separates sender verification from payer verification.

In the basic pattern, only_verify verifies the sender, and pay approves payment.

text
+-------------+-----+
| only_verify | pay |
+-------------+-----+

The pattern looks like this when deployment of a new account is included.

text
+--------+-------------+-----+
| deploy | only_verify | pay |
+--------+-------------+-----+

Frames after the Validation Prefix can be composed freely. For example, any number of user_op (SENDER mode) and post_op (DEFAULT mode) frames may be added.

The individual frame subtypes are summarized below.

Name Mode Role
self_verify VERIFY Approves both the sender and payment
deploy DEFAULT Deploys a smart account using a known deployer
only_verify VERIFY Approves only the sender
pay VERIFY Approves only payment
user_op SENDER Executes the user's operation
post_op DEFAULT Performs paymaster post-operation processing

The sum of gas limits across the entire Validation Prefix must not exceed MAX_VERIFY_GAS (100,000). The node stops simulation immediately when it detects payer_approved = true.

How paymasters work

A paymaster pays gas fees on behalf of users. If one paymaster sponsors many accounts, changes to its balance or storage can invalidate many transactions at once. This creates a potential DoS attack vector for the mempool.

The proposal addresses this issue by applying different rules to canonical and non-canonical paymasters.

Canonical Paymaster

A Canonical Paymaster is a standardized paymaster contract designed for safe use in the public mempool. It is not a singleton: multiple instances may be deployed. A paymaster is recognized as canonical if the runtime code at the target of its pay frame exactly matches the Canonical Paymaster implementation.

A key property of Canonical Paymasters is that deposited ETH can leave the contract in only two ways.

  • Payment of transaction gas fees
  • Withdrawal after a delay period

This restriction makes the paymaster's balance predictable, allowing it to sponsor many transactions safely.

Nodes track the available balance of each Canonical Paymaster as follows.

python
available_paymaster_balance = state.balance(paymaster) - reserved_pending_cost(paymaster) - pending_withdrawal_amount(paymaster)

reserved_pending_cost is the sum of the maximum costs of pending transactions using that paymaster. pending_withdrawal_amount is the amount subject to a delayed withdrawal. If the available balance is less than the transaction's maximum cost, the transaction is rejected.

Because the Canonical Paymaster is explicitly designed to be safe, nodes do not need to apply generic validation tracing or opcode rules to its frame. Acceptance is determined by an exact runtime code match, successful payment approval (the pay frame calls APPROVE(0x2), not APPROVE(0x1)), and paymaster-specific accounting rules.

Non-canonical Paymaster

A Non-canonical Paymaster is an arbitrary paymaster contract without a delayed withdrawal mechanism. Instead, safety is enforced by limiting the number of pending transactions it can sponsor simultaneously to MAX_PENDING_TXS_USING_NON_CANONICAL_PAYMASTER (one transaction).

A transaction using a Non-canonical Paymaster must satisfy two conditions to be accepted.

  • The available balance must be at least the maximum cost of the transaction.
python
available_paymaster_balance = state.balance(paymaster) - reserved_pending_cost(paymaster)
  • The number of pending transactions using that paymaster must be less than MAX_PENDING_TXS_USING_NON_CANONICAL_PAYMASTER.

The primary use case for a Non-canonical Paymaster is a personal paymaster that a user treats as a gas account. For example, a user can maintain a single account holding ETH to pay gas fees for transactions originating from other accounts that hold only stablecoins or NFTs. Default Code also allows any EOA to act as a paymaster.

Data efficiency

Byte-size comparison across patterns

One important advantage of Frame Transactions over ERC4337 is data efficiency. Each UserOperation field in ERC4337 is ABI-encoded on 32-byte boundaries, which tends to introduce substantial overhead. Frame Transactions store frame data compactly.

The following table shows the byte size of a basic ETH transfer from a smart account.

Field Bytes
Transaction wrapper 1
Chain ID 1
Nonce 2
Sender 20
Max priority fee 5
Max fee 5
Max fee per blob gas 1
Blob versioned hashes (empty) 1
Frames wrapper 1
Verification frame target 1
Verification frame gas 2
Verification frame data 65
Verification frame mode 1
Execution frame target 1
Execution frame gas 1
Execution frame data 25
Execution frame mode 1
Total 134

The assumptions are a nonce below 65,536, fees below 1,099 gwei, a verification frame targeting tx.sender (represented by one byte), and a 65-byte ECDSA signature. The size is not significantly different from an EIP1559 transaction. The additional overhead comes from explicitly specifying the sender and the amount in calldata.

Deploying a new account requires the following additional bytes.

Field Bytes
Deployment frame target 20
Deployment frame gas 3
Deployment frame data 100
Deployment frame mode 1
Additional total 124

This assumes gas below 2^24 and data for a small proxy contract.

A sponsored transaction paying gas in ERC20 tokens requires the following additional bytes.

Field Bytes
Sponsor verification frame target 20
Sponsor verification frame gas 3
Sponsor verification frame calldata 0
Sponsor verification frame mode 1
Sponsor transfer frame target 20
Sponsor transfer frame gas 3
Sponsor transfer frame calldata 68
Sponsor transfer frame mode 1
Sponsor post-op frame target 20
Sponsor post-op frame gas 3
Sponsor post-op frame calldata 0
Sponsor post-op frame mode 2
Additional total 141

Sponsored transactions have some inefficiency because the same sponsor address is included three times. Nevertheless, the overall encoding is more efficient because it avoids the per-field 32-byte ABI overhead of ERC4337.

Additional details

Use cases

Example 1 -- Simple transaction

The most basic pattern consists of two frames: signature verification and execution.

Frame Caller Target Data Mode
0 ENTRY_POINT Null (sender) Signature VERIFY
1 Sender Target address Calldata SENDER

Frame 0 verifies the signature and calls APPROVE(0x3). This completes both execution approval and payment approval. Frame 1 calls the contract as the sender and terminates normally with RETURN.

For a simple ETH transfer, frame 1 targets Null (that is, tx.sender) and executes a call list such as [[destination, amount, "0x"]] using Default Code in SENDER mode. Conventional transactions have a value field. Frame Transactions do not need one because the account code handles ETH transfers.

Deploying a new account requires three frames.

Frame Caller Target Data Mode
0 ENTRY_POINT Deployer Initcode, Salt DEFAULT
1 ENTRY_POINT Null (sender) Signature VERIFY
2 Sender Null (sender) Destination/amount SENDER

Frame 0 calls a deployer contract such as that described in EIP7997 to deploy a smart account, frame 1 verifies the account, and frame 2 executes the operation. Since the sender has not yet been authenticated at the deployment frame, the initcode must be safe regardless of who deploys it.

Example 2 -- Atomic Approve + Swap
Frame Caller Target Data Mode Atomic Batch
0 ENTRY_POINT Null (sender) Signature VERIFY -
1 Sender ERC20 approve(DEX, amount) SENDER Set
2 Sender DEX swap(...) SENDER Not set

Frame 0 verifies the signature and calls APPROVE(0x3). Frames 1 and 2 form an atomic batch. Frame 1 approves the ERC20 token, and frame 2 executes a swap on the DEX. If the swap in frame 2 reverts, the approval in frame 1 is automatically reverted.

This addresses the problem in common DeFi approve-and-swap operations where an approval remains in effect after a swap fails.

Example 3 -- Gas payment in ERC20 tokens
Frame Caller Target Data Mode
0 ENTRY_POINT Null (sender) Signature VERIFY
1 ENTRY_POINT Sponsor Sponsor data VERIFY
2 Sender ERC20 transfer(sponsor, fee) SENDER
3 Sender Target Calldata SENDER
4 ENTRY_POINT Sponsor Post-op call DEFAULT

Frame 0 verifies the sender's signature and approves only execution with APPROVE(0x1). In frame 1, the sponsor checks the user's ERC20 balance, verifies that the next frame contains an appropriate ERC20 transfer, and approves payment with APPROVE(0x2). In frame 2, the user transfers ERC20 tokens to the sponsor. Frame 3 executes the user's intended operation. In optional frame 4, the sponsor settles outstanding gas costs or converts tokens to ETH.

Example 4 -- ERC20 gas payments from an EOA
Frame Caller Target Data Mode
0 ENTRY_POINT Null(sender) (0, v, r, s) VERIFY
1 ENTRY_POINT Sponsor Sponsor signature VERIFY
2 Sender ERC20 transfer(sponsor, fee) SENDER
3 Sender Target Calldata SENDER

This is almost identical to example 3, except frame 0 uses the ECDSA verification provided by Default Code for EOAs. An ECDSA signature is supplied with signature_type = 0x0, and execution is approved with APPROVE(0x1). EOA users can therefore pay for gas using ERC20 tokens without migrating to a smart account.

Rationale for design decisions

Frame Transactions incorporate several important design decisions.

The data of VERIFY frames is excluded from the signature hash and remains mutable because gas sponsorship requires adding sponsor data after the sender signs. However, target is included in the signature hash, so the sender explicitly selects the sponsor's address.

Allowing the APPROVE opcode to set sender_approved and payer_approved only once each makes the verification flow more predictable and easier for transaction pools to reason about.

Implementing atomic batching as a flag rather than a new mode keeps the frame structure simple while clearly identifying batch boundaries.

Default Code allows EOA users to benefit from Frame Transactions without waiting to migrate to smart accounts.

Backward compatibility

Changes to the behavior of the ORIGIN opcode

Frame Transactions change the value returned by the ORIGIN opcode. Previously it always returned the original transaction sender, whereas in Frame Transactions it returns the frame's caller. This is ENTRY_POINT in DEFAULT or VERIFY mode, and tx.sender in SENDER mode.

This follows the precedent of EIP7702, which already changed the semantics of ORIGIN. Contracts that use ORIGIN == CALLER as a security check (a discouraged pattern) may behave differently under Frame Transactions.

Security

Mitigating DoS attacks

Frame Transactions introduce new potential DoS attack vectors for transaction pools. Since validation logic can be arbitrary EVM code, an attacker may submit large numbers of transactions that initially appear valid but become invalid later.

Consider the following example validation code.

javascript
function validateTransaction() external {
    require(block.timestamp < SOME_DEADLINE, "expired");
    // ... 残りの検証
    APPROVE(0x3);
}

This transaction is valid when submitted but becomes invalid automatically after its deadline. An attacker could waste node resources by submitting many such transactions and simply waiting for their deadlines to expire.

Prohibited opcodes in the Validation Prefix

To mitigate this problem, the following opcodes are prohibited within the Validation Prefix.

Opcode Reason
ORIGIN (0x32) Environment-dependent value
GASPRICE (0x3A) Varies by block
BLOCKHASH (0x40) Varies by block
COINBASE (0x41) Varies by block
TIMESTAMP (0x42) Varies by block
NUMBER (0x43) Varies by block
PREVRANDAO (0x44) Varies by block
GASLIMIT (0x45) Varies by block
BASEFEE (0x48) Varies by block
BLOBHASH (0x49) Varies by block
BLOBBASEFEE (0x4A) Varies by block
GAS (0x5A) Except immediately before a *CALL
CREATE (0xF0) State modification
CREATE2 (0xF5) Except for a known deployer in the first deploy frame
INVALID (0xFE) Exceptional halt
SELFDESTRUCT (0xFF) State modification
BALANCE (0x31) Dependence on external balances
SELFBALANCE (0x47) Dependence on balance
SSTORE (0x55) State modification
TLOAD (0x5C) Transient Storage
TSTORE (0x5D) Transient Storage

SLOAD may access only the storage of tx.sender. CALL* and EXTCODE* may target existing contracts or precompiles, subject to storage and opcode restrictions.

In addition, the public mempool may hold only one Frame Transaction per sender account. Replacing it with a new transaction requires the same nonce and compliance with fee increase rules.

When a new block is accepted, nodes remove included transactions, update paymaster reservations, resimulate the Validation Prefix of affected pending transactions, and evict transactions that no longer satisfy the rules.

References

Conclusion

This article has examined Frame Transactions that do not depend on ECDSA.

Frame Transactions represent a substantial protocol-level step toward the original vision of account abstraction on Ethereum. In particular, allowing arbitrary signature schemes beyond ECDSA helps prepare for the post-quantum cryptography era.