{"eip":6968,"title":"Contract Secured Revenue on an EVM based L2","description":"Contract Secured Revenue on an EVM based L2","authors":["Zak Cole \u003czak@numbergroup.xyz\u003e","Zak Cole (@zscole)","Kevin Owocki \u003ckevin@supermodular.xyz\u003e","lightclient (@lightclient)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2023-05-01","discussionsTo":"https://ethereum-magicians.org/t/eip-6968-generalized-csr-protocol/14178","repo":"EIPs","label":"EIP-6968","officialUrl":"https://eips.ethereum.org/EIPS/eip-6968","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-6968.md","url":"https://eips.huatuo.xyz/eip-6968/","tldr":{"en":"Proposes that EVM-based L2s share part of each transaction's base fee with the contracts that consumed the gas, giving developers protocol-level revenue (Contract Secured Revenue).","ja":"EVM ベースの L2 が、各トランザクションの base fee の一部を、そのガスを消費したコントラクトと分け合うことを提案する。開発者にプロトコルレベルの収益（Contract Secured Revenue）をもたらす。","ko":"EVM 기반 L2가 각 트랜잭션 base fee의 일부를 해당 가스를 소비한 컨트랙트와 나누도록 제안한다. 개발자에게 프로토콜 수준의 수익(Contract Secured Revenue)을 제공한다.","zh":"提议基于 EVM 的 L2 把每笔交易 base fee 的一部分分给消耗了这些 gas 的合约，让开发者获得协议层面的收入（Contract Secured Revenue）。"},"tags":["l2","fees","revenue","opcode","core"],"explainers":{"en":{"lang":"en","tldr":"Proposes that EVM-based L2s share part of each transaction's base fee with the contracts that consumed the gas, giving developers protocol-level revenue (Contract Secured Revenue).","tags":["l2","fees","revenue","opcode","core"],"related":[1559,150,4844],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-6968/","markdown":"## What problem does it solve?\n\nOn Ethereum, transaction fees go to the protocol (the burned base fee) and to the block producer (the tip). The developers of the contracts that users actually interact with receive nothing at the protocol level, so they have to add their own fees or token schemes to fund development or public goods.\n\nContract Secured Revenue (CSR) gives a share of fees back to the contracts that did the work. EIP-6968 explicitly does **not** propose this for Ethereum L1. It describes how an EVM-based **L2** could adopt CSR to attract developers and fund public goods.\n\n## How it works\n\n1. **Gas tracking per address.** During a transaction the client keeps `gas_used_by_address`. Each instruction's gas is charged to the contract currently executing. For call and create instructions, only the caller's own cost is counted (total cost minus the gas forwarded to the child frame, per [EIP-150](/eip-150/)). On an out-of-gas error, the frame's remaining gas is counted too.\n2. **Revenue recipient.** By default a contract's revenue goes to itself. A new opcode **`SETREVENUERECIPIENT` (`0x49`)**, costing 3 gas, lets a contract point its revenue at another address. The mapping is rebuilt every transaction, so a contract has to call the opcode during execution for the redirect to apply.\n3. **Payout.** After the transaction, each tracked address's recipient is credited:\n\n```text\nrevenue = gas_used * (base_fee_per_gas // REVENUE_SHARE_QUOTIENT)   # REVENUE_SHARE_QUOTIENT = 5\n```\n\nWith a quotient of 5, roughly one fifth of the base fee for the gas a contract used is redirected to it instead of being burned. Externally owned accounts receive nothing, because they do not execute code.\n\nSplitting by gas used, rather than paying everything to the transaction's `to` address, rewards every contract in a composed call chain and works with smart contract wallets, which are often the first contract called.\n\n## Sample code\n\nA contract redirecting its revenue to a treasury. Solidity has no keyword for the new opcode, so this is pseudocode for what the contract would execute on a chain implementing the EIP:\n\n```text\n// inside doWork(), before the main logic\nPUSH20 \u003ctreasury address\u003e\nSETREVENUERECIPIENT        // opcode 0x49, 3 gas, pops 1 item\n// ... rest of the function; gas used by this contract in this\n// transaction now earns revenue for \u003ctreasury address\u003e\n```\n\nClient-side payout logic:\n\n```python\nfor addr, gas in gas_used_by_address.items():\n    recipient = revenue_recipient.get(addr, addr)\n    state.add_balance(recipient, gas * (header.base_fee_per_gas // REVENUE_SHARE_QUOTIENT))\n```\n\n## Things to know\n\n- **Status: Stagnant.** It is a design for L2s to consider, not something Ethereum L1 will adopt.\n- The spec text is inconsistent: the fee-mechanism paragraph says `base_fee * REVENUE_SHARE_QUOTIENT`, while the payout formula divides by it. The payout formula (division, about 20 %) is the one that makes sense.\n- Opcode `0x49` was later assigned to `BLOBHASH` on Ethereum by [EIP-4844](/eip-4844/), so a chain adopting this would need a different opcode.\n- Paying contracts per unit of gas creates an incentive to burn gas deliberately. The spec notes possible effects on block size and complexity but does not fully analyse gas-farming.\n"},"ja":{"lang":"ja","tldr":"EVM ベースの L2 が、各トランザクションの base fee の一部を、そのガスを消費したコントラクトと分け合うことを提案する。開発者にプロトコルレベルの収益（Contract Secured Revenue）をもたらす。","tags":["l2","fees","revenue","opcode","core"],"related":[1559,150,4844],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-6968/","markdown":"## 何を解決するのか\n\nEthereum では、トランザクション手数料はプロトコル（バーンされる base fee）とブロック生産者（チップ）に支払われます。ユーザーが実際にやり取りするコントラクトの開発者にはプロトコルレベルでは何も入らないため、開発や公共財の資金を得るには独自の手数料やトークンの仕組みを追加するしかありません。\n\nContract Secured Revenue（CSR）は、手数料の一部を、実際に処理を行ったコントラクトに還元します。EIP-6968 は、これを Ethereum L1 向けに提案するものでは**ありません**。EVM ベースの **L2** が、開発者を引き付け公共財に資金を提供するために CSR を採用する方法を述べています。\n\n## 仕組み\n\n1. **アドレスごとのガス追跡。** トランザクション中、クライアントは `gas_used_by_address` を保持します。各命令のガスは、その時点で実行中のコントラクトに計上されます。call 系や create 系の命令では、呼び出し元自身のコスト（総コストから、[EIP-150](/eip-150/) に従って子フレームに渡されたガスを引いたもの）だけが数えられます。out-of-gas エラーの場合は、そのフレームの残りガスも数えられます。\n2. **収益の受取先。** デフォルトでは、コントラクトの収益はそのコントラクト自身に入ります。新しい opcode **`SETREVENUERECIPIENT`（`0x49`）**（コスト 3 ガス）で、コントラクトは収益を別のアドレスに向けられます。このマッピングはトランザクションごとに作り直されるため、リダイレクトを有効にするには、コントラクトが実行中にこの opcode を呼ぶ必要があります。\n3. **支払い。** トランザクションの後、追跡された各アドレスの受取先に次の額が付与されます。\n\n```text\nrevenue = gas_used * (base_fee_per_gas // REVENUE_SHARE_QUOTIENT)   # REVENUE_SHARE_QUOTIENT = 5\n```\n\n係数が 5 の場合、コントラクトが使ったガス分の base fee のおよそ 5 分の 1 が、バーンされる代わりにそのコントラクトに回されます。外部所有アカウントはコードを実行しないため、何も受け取りません。\n\nトランザクションの `to` アドレスにすべてを支払うのではなく、使用ガスで分配することで、合成された呼び出しチェーン内のすべてのコントラクトが報われ、最初に呼ばれることが多いスマートコントラクトウォレットでも機能します。\n\n## サンプルコード\n\n収益をトレジャリーにリダイレクトするコントラクトです。Solidity には新しい opcode に対応するキーワードがないため、これは、この EIP を実装したチェーンでコントラクトが実行する内容の擬似コードです。\n\n```text\n// inside doWork(), before the main logic\nPUSH20 \u003ctreasury address\u003e\nSETREVENUERECIPIENT        // opcode 0x49, 3 gas, pops 1 item\n// ... rest of the function; gas used by this contract in this\n// transaction now earns revenue for \u003ctreasury address\u003e\n```\n\nクライアント側の支払いロジック:\n\n```python\nfor addr, gas in gas_used_by_address.items():\n    recipient = revenue_recipient.get(addr, addr)\n    state.add_balance(recipient, gas * (header.base_fee_per_gas // REVENUE_SHARE_QUOTIENT))\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。** L2 が検討するための設計であり、Ethereum L1 が採用するものではありません。\n- 仕様の文章には不整合があります。手数料メカニズムの段落では `base_fee * REVENUE_SHARE_QUOTIENT` とあるのに、支払いの式では割り算になっています。理にかなっているのは支払いの式（割り算、約 20 %）のほうです。\n- opcode `0x49` は後に [EIP-4844](/eip-4844/) によって Ethereum 上で `BLOBHASH` に割り当てられたため、これを採用するチェーンは別の opcode が必要です。\n- ガス 1 単位ごとにコントラクトへ支払うと、意図的にガスを消費するインセンティブが生まれます。仕様はブロックサイズや複雑さへの影響の可能性に触れていますが、ガスファーミングを十分に分析してはいません。\n"},"ko":{"lang":"ko","tldr":"EVM 기반 L2가 각 트랜잭션 base fee의 일부를 해당 가스를 소비한 컨트랙트와 나누도록 제안한다. 개발자에게 프로토콜 수준의 수익(Contract Secured Revenue)을 제공한다.","tags":["l2","fees","revenue","opcode","core"],"related":[1559,150,4844],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-6968/","markdown":"## 어떤 문제를 해결하나요?\n\n이더리움에서 트랜잭션 수수료는 프로토콜(소각되는 base fee)과 블록 생산자(팁)에게 돌아갑니다. 사용자가 실제로 상호작용하는 컨트랙트의 개발자는 프로토콜 수준에서 아무것도 받지 못하므로, 개발이나 공공재 자금을 마련하려면 자체 수수료나 토큰 방식을 추가해야 합니다.\n\nContract Secured Revenue(CSR)는 수수료의 일부를 실제로 일을 한 컨트랙트에 돌려줍니다. EIP-6968은 이를 이더리움 L1에 제안하는 것이 **아닙니다**. EVM 기반 **L2**가 개발자를 끌어들이고 공공재에 자금을 지원하기 위해 CSR을 도입하는 방법을 설명합니다.\n\n## 어떻게 동작하나요?\n\n1. **주소별 가스 추적.** 트랜잭션 동안 클라이언트는 `gas_used_by_address`를 유지합니다. 각 명령어의 가스는 현재 실행 중인 컨트랙트에 부과됩니다. call 및 create 계열 명령어에서는 호출자 자신의 비용(총 비용에서 [EIP-150](/eip-150/)에 따라 자식 프레임에 전달한 가스를 뺀 값)만 집계합니다. out-of-gas 오류가 나면 해당 프레임의 남은 가스도 함께 집계합니다.\n2. **수익 수령자.** 기본적으로 컨트랙트의 수익은 자기 자신에게 돌아갑니다. 새로운 opcode **`SETREVENUERECIPIENT`(`0x49`)**(가스 3 소모)를 쓰면 컨트랙트가 수익을 다른 주소로 지정할 수 있습니다. 이 매핑은 트랜잭션마다 새로 만들어지므로, 리디렉션이 적용되려면 컨트랙트가 실행 중에 이 opcode를 호출해야 합니다.\n3. **지급.** 트랜잭션이 끝난 뒤 추적된 각 주소의 수령자에게 다음 금액이 지급됩니다.\n\n```text\nrevenue = gas_used * (base_fee_per_gas // REVENUE_SHARE_QUOTIENT)   # REVENUE_SHARE_QUOTIENT = 5\n```\n\n계수가 5이면 컨트랙트가 사용한 가스에 해당하는 base fee의 약 5분의 1이 소각되는 대신 그 컨트랙트로 돌아갑니다. 외부 소유 계정은 코드를 실행하지 않으므로 아무것도 받지 못합니다.\n\n모든 수익을 트랜잭션의 `to` 주소에 주는 대신 사용한 가스에 따라 나누면, 조합된 호출 체인의 모든 컨트랙트가 보상을 받고, 흔히 가장 먼저 호출되는 스마트 컨트랙트 지갑에서도 잘 동작합니다.\n\n## 샘플 코드\n\n수익을 트레저리로 리디렉션하는 컨트랙트입니다. Solidity에는 새 opcode에 해당하는 키워드가 없으므로, 이는 이 EIP를 구현한 체인에서 컨트랙트가 실행할 내용을 나타낸 의사 코드입니다.\n\n```text\n// inside doWork(), before the main logic\nPUSH20 \u003ctreasury address\u003e\nSETREVENUERECIPIENT        // opcode 0x49, 3 gas, pops 1 item\n// ... rest of the function; gas used by this contract in this\n// transaction now earns revenue for \u003ctreasury address\u003e\n```\n\n클라이언트 측 지급 로직:\n\n```python\nfor addr, gas in gas_used_by_address.items():\n    recipient = revenue_recipient.get(addr, addr)\n    state.add_balance(recipient, gas * (header.base_fee_per_gas // REVENUE_SHARE_QUOTIENT))\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** L2가 고려해 볼 설계이며, 이더리움 L1이 채택할 내용이 아닙니다.\n- 명세 본문이 일관되지 않습니다. 수수료 메커니즘 단락은 `base_fee * REVENUE_SHARE_QUOTIENT`라고 하는데 지급 공식은 이 값으로 나눕니다. 말이 되는 것은 지급 공식(나눗셈, 약 20 %)입니다.\n- opcode `0x49`는 이후 [EIP-4844](/eip-4844/)에 의해 이더리움에서 `BLOBHASH`에 할당되었으므로, 이를 도입하는 체인은 다른 opcode가 필요합니다.\n- 가스 단위마다 컨트랙트에 지급하면 일부러 가스를 소모할 유인이 생깁니다. 명세는 블록 크기와 복잡도에 미칠 수 있는 영향을 언급하지만 가스 파밍은 충분히 분석하지 않았습니다.\n"},"zh":{"lang":"zh","tldr":"提议基于 EVM 的 L2 把每笔交易 base fee 的一部分分给消耗了这些 gas 的合约，让开发者获得协议层面的收入（Contract Secured Revenue）。","tags":["l2","fees","revenue","opcode","core"],"related":[1559,150,4844],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-6968/","markdown":"## 它解决什么问题？\n\n在以太坊上，交易费用流向协议（被销毁的 base fee）和区块生产者（小费）。用户实际交互的合约的开发者在协议层面一无所获，因此只能自行添加手续费或代币方案来为开发或公共物品筹资。\n\nContract Secured Revenue（CSR）把一部分费用返还给实际完成工作的合约。EIP-6968 明确**不是**为以太坊 L1 提出的。它描述了基于 EVM 的 **L2** 如何采用 CSR 来吸引开发者并为公共物品提供资金。\n\n## 它如何运作\n\n1. **按地址追踪 gas。** 交易期间，客户端维护 `gas_used_by_address`。每条指令的 gas 计入当前正在执行的合约。对于 call 和 create 类指令，只计入调用者自身的消耗（总消耗减去按 [EIP-150](/eip-150/) 转发给子帧的 gas）。发生 out-of-gas 错误时，该帧剩余的 gas 也会计入。\n2. **收入接收方。** 默认情况下，合约的收入归其自身。新的 opcode **`SETREVENUERECIPIENT`（`0x49`）**消耗 3 gas，允许合约把收入指向另一个地址。该映射在每笔交易中重新构建，因此合约必须在执行期间调用这个 opcode，重定向才会生效。\n3. **发放。** 交易结束后，每个被追踪地址的接收方会获得：\n\n```text\nrevenue = gas_used * (base_fee_per_gas // REVENUE_SHARE_QUOTIENT)   # REVENUE_SHARE_QUOTIENT = 5\n```\n\n在系数为 5 时，合约所用 gas 对应的 base fee 中大约五分之一会被转给它，而不是被销毁。外部拥有账户不执行代码，因此什么也得不到。\n\n按所用 gas 拆分，而不是把全部收入付给交易的 `to` 地址，可以奖励组合调用链中的每个合约，并且适用于智能合约钱包（它们往往是第一个被调用的合约）。\n\n## 示例代码\n\n一个把收入重定向到金库的合约。Solidity 没有对应新 opcode 的关键字，所以下面是合约在实现了该 EIP 的链上将会执行内容的伪代码：\n\n```text\n// inside doWork(), before the main logic\nPUSH20 \u003ctreasury address\u003e\nSETREVENUERECIPIENT        // opcode 0x49, 3 gas, pops 1 item\n// ... rest of the function; gas used by this contract in this\n// transaction now earns revenue for \u003ctreasury address\u003e\n```\n\n客户端的发放逻辑：\n\n```python\nfor addr, gas in gas_used_by_address.items():\n    recipient = revenue_recipient.get(addr, addr)\n    state.add_balance(recipient, gas * (header.base_fee_per_gas // REVENUE_SHARE_QUOTIENT))\n```\n\n## 需要注意\n\n- **状态：Stagnant。** 这是供 L2 参考的设计，而不是以太坊 L1 会采用的东西。\n- 规范文本前后不一致：费用机制一段写的是 `base_fee * REVENUE_SHARE_QUOTIENT`，而发放公式却是除以它。合理的是发放公式（除法，约 20 %）。\n- opcode `0x49` 后来被 [EIP-4844](/eip-4844/) 在以太坊上分配给了 `BLOBHASH`，因此采用此方案的链需要使用另一个 opcode。\n- 按每单位 gas 向合约付费，会产生故意烧 gas 的激励。规范提到了对区块大小和复杂度的可能影响，但没有充分分析 gas 刷取行为。\n"}}}
