EIP-6968 EVM L2 Contract Revenue Sharing (CSR) (Contract Secured Revenue on an EVM based L2)

No call decision · Fees & gas · EIP status Stagnant · created 2023-05-01

Proposes a CSR (Contract Secured Revenue) mechanism on EVM-based L2s in which a portion of the transaction fees paid by users is distributed, in proportion to gas usage, to the smart contracts executed in that transaction.

Why it is needed

Currently, no matter how many times a smart contract is called, all of the transaction fees generated go entirely to the protocol (base fee, validator rewards), with nothing returned to the developer who created the contract. This gives developers weak financial incentive to deploy on a given network, and public-good contracts must separately secure their own funding to stay maintained. This EIP is not a proposal to change Ethereum L1 itself, but an idea to let L2s experiment with distributing a portion of transaction fees, in proportion to gas usage, to the contracts actually executed. This creates a new revenue source for developers of heavily used contracts, which can be used as public goods funding or as a means of attracting developers.

What changes

Today

After EIP-6968

Who is affected

In depth

Concept of fee redistribution

This EIP does not change the behavior of EIP-1559's base fee, but instead defines that on L2, the portion obtained by applying REVENUE_SHARE_QUOTIENT to header.base_fee_per_gas is redistributed to the contracts executed within the transaction, in proportion to gas usage. The REVENUE_SHARE_QUOTIENT value is fixed at 5. This is not a proposal to change L1's own fee policy, and it presupposes experimentation on EVM-based L2s.

Gas Tracking

While a block executes, a gas_used_by_address mapping is maintained, keyed by address with the gas amount used (uint64) as the value. Instructions that do not create a new execution frame (e.g., ADD, SSTORE, etc.) add their instruction cost directly to the calling address's total. Instructions that create a new frame, such as CALL, CALLCODE, DELEGATECALL, STATICCALL, CREATE, and CREATE2, add to the calling address's total the full cost minus the gas amount passed to the child frame (computed per EIP-150). The default value for an address not in the mapping is 0. If an instruction fails with an out-of-gas (OOG) error, all of the gas remaining in that frame is added to that address's total, but for other kinds of exceptional halts, the remaining gas is not added.

Designating the revenue recipient: SETREVENUERECIPIENT

A revenue_recipient mapping (address to address) is defined, newly created for each transaction, with a default where each address points to itself. The new instruction SETREVENUERECIPIENT (opcode 0x49) takes one value from the stack and returns nothing. It takes the lowest 20 bytes of the input value as the caller's new revenue recipient address and updates the revenue_recipient entry. The gas cost of this instruction is 3.

Dispersing Revenue

When a transaction completes, for each (addr, gas_used) pair held in gas_used_by_address, the balance of revenue_recipient[addr] is increased by gas_used * (header.base_fee_per_gas // REVENUE_SHARE_QUOTIENT). Since the recipient is determined based on the called contract address, by definition no revenue is distributed to externally owned accounts (EOAs).

Why base on gas usage rather than the transaction's recipient (to) address

A simpler approach would be to send the entire transaction's revenue to a single to address, but this fails to properly reward cases where multiple contracts and apps are combined within a single transaction. Also, since smart contract wallets are by definition often the first execution target of a transaction, this is incompatible with a to-based approach. Tracking gas usage across the whole transaction allows revenue to be distributed to the contracts actually used the most.

Why the recipient mapping is newly created for every transaction

Constructing the revenue_recipient value ephemerally for every transaction appears inefficient on its face. This value is usually fixed, and if it needs to change, that could be handled on the recipient contract's side. However, storing this value permanently would require modifying the account structure of the state tree itself, and would also need a point at which the value is first set, requiring either modifying the CREATE* opcodes or adding a new initialization opcode. Since this is a more invasive change to the EVM, the ephemeral mapping approach was chosen instead.

Security consideration: increased block size and complexity

As with EIP-1559, the impact of this change on block size must be considered. It is stated that, depending on the implementation, if many contracts opt in to CSR, the maximum block size could grow.

Current status

This EIP was submitted under the Standards Track · Core category and is currently in Stagnant status. It does not require any change to Ethereum L1 itself and is a proposal premised on adoption on EVM-based L2s; the given material contains no record of core developer call discussion or a fork inclusion decision.

Original EIP · ← EIPs