This is Fiddy, a researcher at Lido and ex-core developer at Curve (DEX). I have a lot of experience building in the application layer, and this particular EIP is also very interesting for use cases other than funding smart contract developers. The following statements are independent of my representation, but they are something I deeply stand by.
Disclaimer: the following is co-authored by an LLM (Google Gemini 2.5 Pro).
GAS2ETH
introduces a fundamental mechanism enabling smart contracts to directly convert transaction gas, already paid by the sender, into ETH credited to the contract’s balance. While seemingly simple, this opcode offers a powerful primitive for simplifying on-chain fee structures and reducing operational risks for various applications, particularly those requiring dynamic fee adjustments. I believe this EIP warrants strong consideration and push from the application layer due to its significant potential benefits.
The Current Complexity of On-Chain Fee Management
Currently, smart contracts needing to implement dynamic fee structures face considerable complexities and inherent risks:
- Indirect Fee Mechanisms: Contracts often cannot directly charge fees based on network congestion (i.e., gas prices). Instead, they rely on proxy metrics, such as tracking usage frequency via storage variables, to infer periods of high demand or volatility and adjust fees accordingly. This is an indirect and often imprecise method.
- Fee Token Management: Many protocols, especially Decentralized Exchanges (DEXes), collect fees in the tokens being traded. This necessitates a multi-step, often cumbersome process:
- Accumulation: Fees accrue in various, potentially volatile or illiquid, tokens.
- Conversion: The protocol (or its DAO/operators/keepers) must periodically execute transactions to swap these accumulated fee tokens into a desired base asset like ETH or a stablecoin.
- Risks: This conversion process introduces significant risks:
- Market Volatility & Depegging: The value of accumulated fee tokens can drastically decrease between accumulation and conversion due to market fluctuations or events like stablecoin depegs.
- Liquidity Issues & Slippage: Converting large amounts of fee tokens can face insufficient liquidity, leading to significant price slippage.
- MEV Exposure: Fee conversion transactions themselves can be targets for Maximal Extractable Value (MEV), further eroding the collected value.
- Operational Overhead: Managing this process requires dedicated infrastructure, transaction costs, and governance overhead.
EIP-7791: A Direct and Elegant Solution
EIP-7791 introduces the GAS2ETH
opcode, offering a direct solution to these challenges.
Clarifying the Mechanics: GAS2ETH
vs. PAY
It is crucial to distinguish the proposed GAS2ETH
opcode’s function from that of potential complementary opcodes like PAY. Based on discussions surrounding the EIP’s design, GAS2ETH
leverages the gas already supplied and paid for by the transaction initiator (effectively, the entity covering the transaction’s gas costs: tx.origin). When a contract executes GAS2ETH(g)
, it consumes g gas provided by the initiator, calculates the equivalent ETH value based on the transaction’s gas price, and credits this ETH to its own balance. Conversely, an opcode like PAY would serve a different purpose: deducting ETH from the current contract’s balance to transfer it externally, potentially offering benefits like reentrancy protection. Therefore, GAS2ETH
is about the contract receiving ETH funded by the transaction initiator’s gas, while PAY would facilitate the contract sending ETH from its own reserves. This distinction underscores how GAS2ETH
enables direct fee capture in ETH from the user interacting with the contract.
Mechanism: A contract executing GAS2ETH(g)
would:
- Consume g amount of gas from the transaction’s available gas limit (this gas cost is ultimately borne by the transaction sender as part of their overall gas payment).
- Calculate the corresponding ETH value based on g * effective_gas_price (using the gas price context of the transaction).
- Credit this calculated ETH amount directly to the smart contract’s own balance.
Benefits:
-
Intrinsic Dynamic Fees: Fees charged via GAS2ETH
are inherently tied to network demand. When blockspace is contested and gas prices are high, the ETH value derived from consuming a fixed amount of gas (g) increases proportionally. This allows contracts to automatically adjust their fee levels based on real-time network conditions without complex logic or storage reads.
-
Simplified Fee Logistics: It entirely eliminates the need to handle intermediate fee tokens. Fees are collected directly in ETH, the network’s native asset.
-
Risk Mitigation: By receiving fees directly in ETH, protocols circumvent exposure to the volatility, depegging risks, liquidity constraints, and slippage associated with converting diverse fee tokens.
-
Reduced Transactional Overhead: The entire process of accumulating, managing, and converting fee tokens is bypassed, reducing the number of transactions required and associated gas costs.
Use Case: Revolutionizing DEX Fee Structures
Let’s revisit the DEX example:
- Without
GAS2ETH
: A DEX facilitating a stablecoin pair swap collects fees in those stablecoins. If $500k worth of fees are collected on Friday, market turmoil over the weekend (e.g., a depeg) could reduce their value significantly before they can be converted to ETH on Monday/Tuesday, further impacted by slippage and potential MEV during the conversion swaps.
- With
GAS2ETH
: The DEX contract could, as part of the swap execution, include a GAS2ETH
operation. This consumes a predetermined amount of gas (g) paid by the user initiating the swap. The contract immediately receives the corresponding ETH value (g * tx.gasprice). If network congestion is high (high tx.gasprice), the ETH fee collected is higher, reflecting the increased demand for the DEX’s service during that period. The collected ETH can then be efficiently transferred to a designated withdrawal address, potentially using a complementary mechanism like the PAY opcode (often discussed alongside gas-related EIPs). This entire process is atomic, direct, and avoids intermediate token risks.
Conclusion and Call for Support
EIP-7791 (GAS2ETH
) offers a foundational improvement to smart contract economics on Ethereum. By enabling direct conversion of gas cost to ETH revenue for contracts, it provides a robust, elegant, and risk-minimizing mechanism for implementing dynamic fees. This is particularly valuable for high-throughput applications like DEXes, but its utility could extend to lending protocols, NFT marketplaces, oracle services, and others that require a seamless fee management infrastructure.
The primary hurdle for such a valuable, low-level primitive is often demonstrating clear demand and utility from the application layer. Simplifying core economic interactions like fee collection in ETH strengthens the entire ecosystem. I urge developers, protocol designers, and the broader Ethereum community to recognize the potential of GAS2ETH
, discuss its applications, and voice support for its inclusion in a future network upgrade.