Polygon zkEVM
Key Takeaways
- Polygon zkEVM is a zkEVM rollup product from Polygon, offering high-level EVM compatibility, allowing developers to easily deploy existing Ethereum smart contracts.
- Currently, Polygon zkEVM corresponds to a type-3 zkEVM, with development ongoing to reach type-2.
- Polygon zkEVM uses a Proof of Efficiency (PoE) consensus mechanism to separate the roles of the sequencer and prover.
1. Overview
Polygon zkEVM is a zkEVM rollup product from Polygon aiming for high-level EVM compatibility. It currently corresponds to a type-3 zkEVM, with the goal of supporting all Ethereum precompiles to become type-2. Polygon zkEVM has already achieved opcode-level compatibility, making it very easy for Ethereum developers to deploy their existing smart contracts.
2. Execution
Polygon zkEVM demonstrates opcode-level EVM-compatibility, and according to Vitalik Buterin's 'The different types of ZK-EVMs', it currently corresponds to a Type-3 zkEVM, but is in development with the goal of becoming a Type-2 zkEVM. The difference between Type-2 and Type-3 is the implementation of difficult precompiles in zkEVM. Polygon zkEVM supports all precompiled contracts except SHA256, BLAKE, and PAIRINGS.
2.1 Components
Key components of Polygon zkEVM include the Consensus Contract, zkNode, zkProver, zkEVM Bridge, etc., and zkProver will be discussed in section ‘3. Settlement.’
2.1.1 Consensus Contract (PolygonZkEVM.sol)
The initial version of Polygon zkEVM, Polygon Hermez 1.0, used a consensus mechanism called Proof of Donation (PoD). In PoD, block producers compete for the right to generate the next block and receive users' transaction fees when they succeed to generate a block.
The current Consensus Contract of Polygon zkEVM has implemented an upgraded version of PoD, called Proof of Efficiency (PoE). In PoE, Sequencers and Aggregators are introduced to generate batch and validity proof. For more details, refer to the zkNode section below.
PolygonZkEVM.sol also verifies the validity proofs of Polygon zkEVM.
2.1.2 zkNode
zkNode is a client of Polygon zkEVM, composed of the Synchronizer, Sequencers, Aggregators, and RPC.
Sequencers and Aggregators are participants in the PoE consensus mechanism, with Sequencers gathering users' transactions and then proposing batches to the network. Aggregators check the validity of the batches and then generate validity proofs. As of now, transactions on the Polygon zkEVM network are ordered by the trusted sequencer’s node. Since the submission of batches by Sequencers and the generation of validity proofs by Aggregators occur separately, the Synchronizer is responsible for synchronizing these processes.
2.2 Transaction Lifecycle
- Signed transactions are generated in users’ wallets and sent to the trusted sequencer’s node.
- The trusted sequencer checks the validity of transactions, orders valid transactions, and then executes them. (L2 state is updated)
- Transactions that have been executed are included in a batch and sent to L1 smart contract.
- Aggregator builds a validity proof of the batch.
- Once the validity proof is validated by the verifier contract, users’ transactions are completely finalized.
3. Settlement
Polygon zkEVM uses a validity proof system to ensure the validity of execution. The zkProver is software for generating validity proofs and must be run to become an aggregator. The zkProver first creates a STARK proof, which is large in size, and then compresses it using a SNARK proof. The generated SNARK proof is verified by the Verifier contract existing on the Ethereum network.
Currently, the prover is also centralized in Polygon zkEVM, but it plans to introduce a decentralized prover market in the future. Although the aggregator(prover), who is responsible for submitting state roots and ZKPs, goes offline, users can withdraw their funds by leveraging the open-source prover system to submit ZKPs.
There are three stages of transaction finality in Polygon zkEVM:
- Trusted State: This level of finality is ensured by a trusted sequencer in an almost instant manner.
- Virtual State: Transactions are posted to the Ethereum and their order is finalized.
- Verified State: Virtual state is verified through ZKP by the smart contract on Ethereum.
4. Data Availability
Currently, Polygon zkEVM is storing transaction data on the Ethereum mainnet, following the full zk rollup schema. However, due to the high cost of storing data on the Ethereum network, it is also considering options such as validium and volition.
5. Team
- Sandeep Nailwal (Co-founder, Polygon)
- Mihailo Bjelic (Co-founder, Polygon)
- Jaynti Kanani (Co-founder, Polygon)
- Jordi Baylina (Co-founder, Polygon zkEVM)
- David Schwartz (Co-founder, Polygon zkEVM)
- Antoni Martin (Co-founder, Polygon zkEVM)
6. Resources
- Website | Docs | Blog | Twitter
- All about Polygon zkEVM and zkEVM Rollup by msfew