Skip to content

Commit

Permalink
fix: zkevm gas fee calculation (#476)
Browse files Browse the repository at this point in the history
* fix: zkevm gas fee calculation

* Update docs/build/zkEVM/fee.md

Co-authored-by: Mar.io <34627453+Maar-io@users.noreply.github.com>

---------

Co-authored-by: Mar.io <34627453+Maar-io@users.noreply.github.com>
  • Loading branch information
ashutoshvarma and Maar-io committed Oct 20, 2023
1 parent a327657 commit 3d0dba0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/build/zkEVM/fee.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ sidebar_label: Fee Calculation
---

## How do network fees on Astar zkEVM work?
Every transaction consists of two costs: an L2 (execution) fee and an L1 (security) fee. The L2 fee is the cost to execute your transaction on the L2, and the L1 fee is the estimated cost to publish the transaction on the L1. Typically the L1 security fee is higher than the L2 execution fee.
In Astar zkEVM the gas fee is calculated by applying a fixed factor over L1 gas fee. That price factor is a fixed value and doesn't change often and it's value is based the rollup's cost to publish tx to L1. To Simply put, gas prices in L2 will linearly follow gas prices in L1.

$$ L2_{gas\_fee} = L1_{gas\_fee} * Factor $$

The L1 fee will vary depending on the amount of transactions on the L1. If the timing of your transaction is flexible, you can save costs by submitting transactions during periods of lower gas on the L1 (for example, over the weekend)

Similarly, the L2 fee can increase and decrease depending on how many transactions are being submitted to the L2. This adjustment mechanism has the same implementation as the L1. You can read more about EIP-1559 [here](https://eips.ethereum.org/EIPS/eip-1559).
The support for congestion mechanism based EIP-1559 [here](https://eips.ethereum.org/EIPS/eip-1559) is planned for future and will make the L2 gas fee dynamic.

0 comments on commit 3d0dba0

Please sign in to comment.