zkEVM Protocol FAQs
This document compiles some of the frequently asked questions related to the Astar zkEVM protocol. For more details, check out Polygon zkEVM documentation.
How are transactions collected and ordered?
- Transactions on the Astar zkEVM network are created in users' wallets and signed with their private keys.
- Once generated and signed, the transactions are sent to the Trusted Sequencer's node via their JSON-RPC interface.
- The transactions are then stored in the pending transactions pool, where they await the Sequencer's selection.
- The Trusted Sequencer reads transactions from the pool and decides whether to discard them or order and execute them.
- Lastly, the Sequencer organizes the transactions into batches, followed by the sequencing of the batches.
Are there any time or transaction intervals for a sequencer to wait before moving forward to make a Rollup batch?
The sequencer always has an open batch. Transactions are added to this batch until this batch is full or a big timeout happens. Those batches are also accumulated until it reaches 128K of batches (or a big timeout) and then a sequencing transaction to Layer 1 is sent.
From the Layer 2 user perspective, a new Layer 2 block (different from the Layer 2 batch) is closed and sent to the user. The user perceives the transaction finality even if the Layer 2 batch is not closed. One Layer 2 Transaction is one Layer 2 Block.
What are the stages that a transaction goes through in order to be finalized on Layer 1?
The process of validating a specific transaction within the batch typically involves three steps:
-
Trusted State: This state is given by the trusted sequencer almost instantaneously. No Layer 1 transactions are required.
-
Virtual State: Transactions are on Layer 1. These transactions and their order cannot be modified as the state is final and anybody could calculate.
-
Verified State: When the virtual state is verified by the smart contract, the funds can be withdrawn.
How does a Sequencer validate a specific transaction in order to generate proof?
The Sequencer retrieves the transaction from the transaction pool and verifies that it is properly formatted and contains all the necessary information. The Sequencer does the following checks:
-
Checks that the transaction is valid by checking that the Sender has enough funds to cover the gas costs of the transaction and that the smart contract called, if any, is valid and has the correct bytecode.
-
Checks that the transaction is not a duplicate by checking the transaction nonce of the Sender to ensure that it is one greater than the last nonce used.
-
Checks that the transaction is not a double-spend by checking that the Sender's account balance has not been already spent in another transaction.
Once the transaction is deemed valid, the Sequencer applies the transaction to the current state of the Astar zkEVM, updating the state of the smart contract and the account balances as necessary. Duration and cost vary depending on traffic and prevailing gas prices.
When do transactions achieve finality in Astar zkEVM?
If the user trusts the Sequencer, transactions are considered final once the Sequencer sequences it (or Trusted State).
If the user trusts only the Layer 1 state, then the transaction will be final at the moment it reaches Virtual State. This means, once the data is available and the transaction is already on Layer 1.
In case the user needs to withdraw funds, he/she needs to wait for the Prover to convert the implicit state to an explicit state. We call this last state the Consolidated or Verified State.