EIPs Explained

EIP-2474 · Stagnant · Core · 2020-01-19

EIP-2474: Coinbase calls

A stagnant proposal to let the block producer (block.coinbase) call contracts directly at the start of a block without signing a transaction, removing the overhead of zero-gas-price relay transactions.

What problem does it solve?

A miner or validator sometimes wants to execute a call that benefits it without really needing a sender identity. The motivating case is acting as a relayer for meta-transactions (EIP-1077): the block producer submits a user's signed request to a contract and gets paid by that contract, not through gas fees.

Today the only way to do that is to sign an ordinary transaction, typically with gasPrice = 0 because the producer pays itself anyway. That transaction still carries a signature that must be verified (an ecrecover), even though the resulting msg.sender is irrelevant to the call. EIP-2474 proposes dropping that overhead.

How it works

The proposal is short and leaves many details as "TBD":

  • The block producer (block.coinbase) may include calls without a transaction. These are placed first in the block.
  • They consume block gas as normal but do not pay for gas; the called contract logic is expected to compensate the producer in some other way.
  • During such a call, tx.origin = block.coinbase and the gas price is 0 for the whole call stack.
  • Reading msg.sender in a coinbase call is not allowed and would throw, since there is no signed sender.
  • Otherwise the calls behave like normal calls.

Sample code

Illustrative only; this behaviour does not exist on Ethereum. A relayer-style contract that never reads msg.sender and pays whoever produced the block:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract CoinbaseRelay {
    // Under EIP-2474, the block producer could call this without a signed tx.
    // It must not touch msg.sender, which would be invalid in a coinbase call.
    function relay(address target, bytes calldata data, uint256 reward) external {
        (bool ok, ) = target.call(data);
        require(ok, "call failed");
        payable(block.coinbase).transfer(reward); // compensation instead of gas fees
    }

    receive() external payable {}
}

Things to know

  • Status: Stagnant. It was never scheduled for any network upgrade, and its Rationale, Test Cases, Implementation and Security sections were never filled in.
  • The spec itself flags a risk: setting tx.origin = block.coinbase could break badly designed contracts that use tx.origin for authorisation.
  • Paying the producer "in other form" ties the feature to block-producer-specific logic, which interacts with later changes to how blocks are built (for example proposer/builder separation); the proposal predates those changes.
  • Other approaches to gas abstraction and sponsored execution were explored separately, such as EIP-2711 (withdrawn) and later account-abstraction work.

#core #evm #coinbase #meta-transactions #stagnant

Details

Authors
Ricardo Guilherme Schmidt (@3esmit)
Status
Stagnant
Type
Standards Track / Core
Created
2020-01-19

Machine-readable: Markdown · JSON