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 EIP7685, which proposes a general-purpose framework for storing requests triggered by smart contracts and sharing them from the execution layer (EL) to the consensus layer (CL).

This article translates, summarizes, and adds context to the following proposal.

I also cover a range of EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.

Overview

EIP7685 defines a general-purpose framework for storing contract-triggered requests. It adds a single field to the execution header to commit to request information. The requests are subsequently exposed to the consensus layer (CL), which processes each request.

Key features

Feature Description
General-purpose bus A general-purpose interface for sharing requests from the EL to the CL
requests_hash A 32-byte commitment added to the block header
Extensibility New request types can be added easily
Opaque data format Different encoding formats can be supported in the future
Ordering by type Requests are sorted in ascending order of request type

Ethereum consists of two layers. The Execution Layer (EL) executes transactions and processes smart contracts, while the Consensus Layer (CL) validates blocks and provides finality through Proof of Stake.

Motivation

As smart-contract-controlled validators become more widespread, demand for additional EL-triggered actions is increasing. Allowing these systems to delegate administrative operations to a managing smart contract removes the need for an intermediary to ensure that certain operations occur. This creates a more secure system for end users.

Demand for EL-triggered actions

Traditionally, operations such as validator withdrawals and deposits have relied on external actors or oracles. As smart-contract-based staking pools and liquid staking protocols become more common, the ability to trigger these operations directly from contracts themselves is becoming increasingly important.

Benefits of the framework

Abstracting the details of individual requests away from the EL makes it easier to add new request types without updating the execution block structure.

Benefit Description
No intermediary Smart contracts can carry out administrative operations directly
Improved security Removes reliance on trusted third parties
Extensibility New request types can be added easily
Structural stability Functionality can be extended without modifying the block structure

Specification

Execution layer

Request structure

A requests object consists of a request_type byte and an opaque byte array, request_data. request_data contains zero or more encoded request objects.

javascript
requests = request_type ++ request_data

Each request type defines its own requests object and its own request_data format.

Field Description
request_type A one-byte value identifying the request type
request_data An opaque byte array containing the request details

Block header extension

A new 32-byte commitment value, requests_hash, is added to the header.

During block processing, the system generates multiple requests objects with different request_type values and accumulates them in the block request list.

Computing the commitment

To compute the commitment, first hash every non-empty requests element in the block request list to construct an intermediate list of hashes. Items with empty request_data are excluded. In other words, requests items that contain only the request_type (one byte) and nothing else are excluded from the intermediate list.

Within the intermediate list, requests items must be ordered by ascending request_type.

The final commitment is computed as the sha256 hash of the intermediate element hashes.

python
def compute_requests_hash(block_requests: Sequence[bytes]):
    m = sha256()
    for r in block_requests:
        if len(r) > 1:
            m.update(sha256(r).digest())
    return m.digest()

block.header.requests_hash = compute_requests_hash(requests)

This code defines a function for computing requests_hash. For each request in the block_requests sequence, if its length is greater than one (that is, it contains actual data in addition to the request_type), its sha256 hash is added to the running hash. The final digest becomes requests_hash.

Consensus layer

Each proposal can choose how to extend Beacon Chain types to accommodate new EL request types.

The following diagram shows how requests propagate from the EL to the CL. The original diagram retains its Japanese labels.

sequenceDiagram
    participant SC as スマートコントラクト
    participant EL as 実行レイヤー
    participant Block as ブロック
    participant CL as コンセンサスレイヤー

    SC->>EL: リクエストをトリガー
    EL->>Block: requestsオブジェクトを蓄積
    Block->>Block: requests_hashを計算
    Block->>CL: リクエストを公開
    CL->>CL: 各リクエストを処理

When a smart contract triggers a request, the EL processes it and accumulates it in the block. The block computes requests_hash from all the requests and includes it in the header. The CL then receives the requests and processes them individually.

Additional context

Why an opaque byte array was chosen

Using opaque bytes from the second byte onward in the request_data array (rather than RLP or another encoded list) allows future request payloads to support different encoding formats, such as SSZ, LEB128, and fixed-width formats.

Encoding format Description
RLP A format widely used in Ethereum today
SSZ Simple Serialize, a format used in the consensus layer
LEB128 Variable-length integer encoding
Fixed-width format A fixed-size data format

Request sources and validity

EIP7685 does not impose strict requirements on where requests originate or when and how they are validated. This gives future protocol designers maximum flexibility.

Recommendations for request sources

Requests should originate from transaction execution. More specifically, transactions should call a designated system contract that stores requests in an account. This storage is later retrieved through a post-block system call to the contract.

Alternatively, if system calls do not need to be inherently involved in rate limiting, the mechanism can simply rely on emitted events that the system parses after the block and converts into requests.

Recommendations for validity checks

In many cases, the validity of requests cannot be fully established in the execution layer. This is why they are called requests. A request does not itself have the authority to unilaterally trigger an action.

System contracts are expected to perform as much validation as possible in the EL before passing requests to the CL for further validation.

Rationale for ordering

Requests are ordered across types in ascending type order. This simplifies verification that all requests match those committed to by requests_hash.

Ordering method Advantage Disadvantage
Ascending type order Easy to verify and ensures consistency Does not reflect generation order
Generation order Reflects chronological order Difficult to enforce because of system calls at the end of the block

An alternative would be to order requests by the sequence in which they were generated within the block. However, many requests are expected to accumulate through system calls at the end of the block, making this difficult to enforce. Ordering by type is therefore the simplest way to ensure consistency.

Ordering within a type

Ordering within a single type is not defined. This is because request data is opaque as far as this proposal is concerned. Each request type therefore determines its own ordering.

Why empty requests are excluded from the commitment

Excluding empty requests elements from the requests_hash commitment produces a stable empty hash value that is independent of blockchain forks. For blocks with no request data, requests_hash is simply sha256("").

Case requests_hash
No requests sha256("")
Only empty requests sha256("")
Valid requests present sha256 of the intermediate hashes

Backward compatibility

No backward compatibility issues were identified.

EIP7685 adds a new field, requests_hash, to the block header, which requires a hard fork. After the fork, all clients must understand the new block format.

Security

The security of EIP7685 remains subject to further discussion. The following considerations are important.

Consideration Description
Request validation Both partial validation in the EL and full validation in the CL are required
System contract security System contracts that trigger requests must be designed carefully
Rate limiting Mechanisms may be needed to prevent large volumes of malicious requests
Hash collisions The use of sha256 provides sufficient collision resistance

References

Conclusion

This article covered the EIP7685 framework for sharing requests from the execution layer to the consensus layer. How did you find it?

If you have any questions, feel free to send me a direct message on Twitter.

Twitter @cardene777

I also publish on other platforms. Feel free to explore them.