Cointime

Download App
iOS & Android

Pricing Gas in Polygon zkEVM

Validated Project

The final Polygon zkEVM testnet, which launched last year, has seen a surge of developers and users eager to experience the future of Ethereum scaling.

The years-long technical achievements to get to this point have been enormous. Researchers working on zero-knowledge (ZK) to scale Ethereum have had to answer and address a bevy of design questions at every turn.

One interesting question that arises for all zkEVMs: how do you price gas?

In the Ethereum Virtual Machine (EVM), gas keeps the network secure by setting an economic fee for every computation. Malicious behaviors, like Denial of Service (DoS) attacks, are muted by setting a price to execute transactions. Gas limits define the total number of computational steps a transaction can execute.

So why is figuring out how to price gas in zkEVMs an interesting problem?

Because gas is supposed to reflect resource consumption for nodes (bandwidth/storage/compute), but when generating zkEVM proofs, some EVM opcodes are relatively more expensive to prove than to re-execute on a CPU.

In other words, some computations that require low gas fees in the EVM might become prohibitively expensive and slow down the network when proved in zkEVM. 

What does this mean? Solidity, the programming language for the EVM, is compiled into opcodes, which run on the blockchain. Each opcode does something simple, and each requires gas to execute. 

To translate gas pricing into zkEVM for these opcodes, there are three options, each of which requires different considerations: 

  1. Keep the gas schedule the same as in the EVM
  2. Reprice opcodes
  3. Keep the gas schedule, but also introduce a mechanism for DoS mitigation

We’ll walk through each option and explain the best design choice for Polygon zkEVM.

Keep the gas schedule? Or reprice opcodes?

Keeping the regular EVM gas fee schedule for Polygon zkEVM seems attractive enough, because existing contract behavior in the EVM would remain unchanged. This is ideal for developers who can easily and seamlessly deploy Ethereum dApps in a zkEVM environment, and a huge upside for EVM-equivalency. 

But maintaining gas fees without modification actually introduces a new vector for potential DDoS attacks. 

There are computations in the EVM which require low gas fees, but which in the context of a zkEVM become very expensive to prove. Cram enough opcodes into one block that are low-cost in EVM, but high-cost in zkEVM, and the network can experience serious lag. 

An example? Keccak hashes are expensive to prove in a zkEVM environment. Filling a block with the opcode “EXTCODESIZE” would only cost 100 gas, but cause a type-1 zkEVM to perform an unwieldy number of Keccak hashes–leading to a potential DoS vector.

So a 1:1 pricing scheme looks like it might cause some trouble.

Why not reprice opcodes, then, in order to reflect the proving cost in a zkEVM? (This is option two above.)

The problem is that some contracts rely on the current gas schedule to function as intended – opcodes like “GASLEFT,” for example, or “CALLSTIPEND.” Repricing opcodes for Polygon zkEVM might actually introduce unexpected behavior into dApps, causing developers unnecessary headaches. 

So that leads us to the best option for Polygon zkEVM…

Keep the gas schedule, but also introduce DoS mitigation

With its fast prover, Polygon zkEVM is able to keep the EVM gas schedule, but also introduces a mechanism by which DDoS attacks can be mitigated. In other words, contract functionality can be preserved without sacrificing the security and reliability of the network. 

How does Polygon zkEVM do it? 

First, the gas schedule remains the same. Opcodes are priced the same in Polygon zkEVM as they are in the EVM. 

Second, and most importantly, Polygon zkEVM introduces quotas to identify pathological transactions, like filling an entire block with EXTCODESIZE. Think of it like an extra security reflex. Only a certain number of Keccak hashes can be included in a block. Polygon zkEVM scans for malicious blocks that breach this quota, helping to ensure that expensive and network-slowing spam does not occur.

Due to the extremely fast Polygon zkEVM prover, the differences in compute cost between the L1 gas schedule and actual resource consumption in Polygon zkEVM remains marginal.

It’s the best of all worlds: seamless design integration coupled with a mechanism to prevent spam.

Read more: https://polygon.technology/blog/pricing-gas-in-polygon-zkevm

Comments

All Comments

Recommended for you

  • Fed Chair Nominee Waller: Independence Depends on the Fed Itself

    Fed Chair nominee Waller: I will be independent of Trump's opinions. Trump tends to call for the FOMC to cut interest rates. Independence depends on the Fed itself.

  • Digital Bank Revolut's IPO Valuation Could Reach $200 Billion

    The Financial Times reported, citing anonymous investor sources, that the UK digital bank Revolut plans to seek a valuation of $150 billion to $200 billion in its upcoming IPO, a significant increase from its previous valuation of $75 billion. The company's CEO, Nik Storonsky, also revealed that Revolut is preparing for a new round of secondary share sales in the second half of 2026, with a valuation potentially exceeding $100 billion.

  • ETH Falls Below $2300

    Market data shows that ETH has fallen below $2300, currently priced at $2299.92, with a 24-hour decline of 0.38%. The market is experiencing significant fluctuations, so please ensure proper risk management.

  • Trump: Disappointed if New Fed Chair Does Not Cut Interest Rates

    On April 21, U.S. President Trump stated: If the new Federal Reserve Chair does not cut interest rates, I will be disappointed.

  • Chairman of the Joint Chiefs of Staff Milley States Readiness to Resume Operations

    On April 21, Chairman of the Joint Chiefs of Staff Mark Milley stated that the U.S. is ready to resume operations and can act against Iran at any time. (Axios)

  • Bank of Japan to Maintain Interest Rates in April

    On April 21, according to Nikkei News: The Bank of Japan will maintain interest rates unchanged in April.

  • Iranian Military: Ready to Respond Decisively to 'Enemy's Breach of Promises'

    On April 21, local time, Abdollahi, commander of the Khatam al-Anbiya Central Command of the Iranian Armed Forces, stated that Iran is prepared to respond decisively to the 'enemy's breach of promises.' Abdollahi emphasized that the current Iranian military possesses 'authority, readiness, and comprehensive strategic capabilities.' He noted that the Islamic Revolutionary Guard Corps and other defense forces have demonstrated combat capabilities in relevant operations, putting 'Israel and the United States in a difficult and fatigued position,' forcing them to 'seek a ceasefire.' Abdollahi also stressed that the Iranian armed forces maintain a high level of unity with the government and the people under the supreme leader's unified command, and will respond 'decisively, resolutely, and promptly' to any threats and actions. (CCTV News)

  • Another Iranian Oil Tanker Returns to Iran After Breaking US Blockade

    On April 21, according to CCTV News, maritime intelligence company 'TankerTrackers' reported that a tanker belonging to the National Iranian Tanker Company returned to Iran after unloading approximately 2 million barrels of crude oil in Indonesia, crossing the relevant maritime blockade line. The tanker is currently en route to Iran's main oil export hub, Khark Island, and is expected to arrive on April 22 local time. It is reported that the tanker set sail from Iran in late March, heading towards the Riau Islands of Indonesia.

  • White House: US and Iran on the Verge of Reaching an Agreement

    On April 21, White House Press Secretary Kayleigh McEnany stated in an interview with Fox News on the evening of the 20th that the United States and Iran are on the "verge of reaching an agreement." McEnany remarked, "The US has never been closer to achieving a truly good deal." However, she did not disclose any information regarding the current status of the negotiations. McEnany noted that even if an agreement is not reached, President Trump has multiple options and is not afraid to utilize these measures. Previous actions have demonstrated that Trump is not just "bluffing."

  • Kelp DAO Attacker Transfers 30,800 ETH to Special Address

    On April 21, news emerged that, according to monitoring by PeckShield, the Kelp DAO attacker transferred 30,800 ETH to a special address starting with 0x00000, possibly indicating a destruction action.