diff --git a/docs/build/zkEVM/fee.md b/docs/build/zkEVM/fee.md index 8440f449a..e92fa0848 100644 --- a/docs/build/zkEVM/fee.md +++ b/docs/build/zkEVM/fee.md @@ -3,6 +3,8 @@ sidebar_position: 7 title: Astar zkEVM Fee Calculation sidebar_label: Fee Calculation --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; ## How do network fees on Astar zkEVM work? 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. @@ -13,4 +15,65 @@ $$ 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) -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. \ No newline at end of file +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. + +## Fetch gas price from RPC node +The gas price can be fetched from the Astar zkEVM Sequencer using the following RPC call: + +```bash +curl https://rpc.zkatana.gelato.digital/ \ + -X POST \ + -H "Content-Type: application/json" \ + --data '{"method":"eth_gasPrice","params":[],"id":1,"jsonrpc":"2.0"}' + ``` + + The result is the hex value of the gas price in wei. + +## Use Blockscout Price Oracle +Blockscout Price Oracle calculates the gas price from the average of previous blocks. It doesn't call `eth_gasPrice`. + + + +Send a GET request to the [Blockscout Price Oracle endpoint](https://zkatana.blockscout.com/api/v1/gas-price-oracle) to get a gas price recommendation from this oracle. + +#### cURL + +```bash +curl https://zkatana.blockscout.com/api/v1/gas-price-oracle +``` + +#### JavaScript + +```javascript +fetch('https://zkatana.blockscout.com/api/v1/gas-price-oracle') + .then(response => response.json()) + .then(json => console.log(json)) +``` + +#### Python + +```python +import requests +requests.get('https://zkatana.blockscout.com/api/v1/gas-price-oracle').json() +``` + + + +coming soon... + + + + +### The Price Oracle Response + +An example JSON response will look like this. + +```json +{ + "average":0.02, + "fast":0.02, + "slow":0.02, +} +``` + +- {`average`, `fast`, `slow`} are gas prices in Gwei, you can use these prices before sending the transaction off to Astar zkEVM. \ No newline at end of file diff --git a/docs/build/zkEVM/zkevm-gas-station.md b/docs/build/zkEVM/zkevm-gas-station.md index 5bf10a355..cd0517136 100644 --- a/docs/build/zkEVM/zkevm-gas-station.md +++ b/docs/build/zkEVM/zkevm-gas-station.md @@ -1,20 +1,21 @@ --- sidebar_position: 6 -title: Astar zkEVM Gas Station -sidebar_label: zkEVM Gas Station +title: Blockscout zkEVM Gas Oracle +sidebar_label: zkEVM Gas Oracle --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -The goal of **Astar zkEVM Gas Station** is to provide dApp developers with gas pricing suggestions so they can use them before sending transactions to the **Astar zkEVM** network. +## Overview +The **Blockscout Price Oracle** provides gas pricing suggestions which can be used by dApp developers before sending transactions to the **Astar zkEVM** network. ## Usage - +Blockscout Price Oracle takes the values from the average of previous blocks. It does't call `eth_gasPrice`. -Send a GET request to the [zKatana Gas Station endpoint](https://zkatana.blockscout.com/api/v1/gas-price-oracle) to get a gas price recommendation from this oracle. +Send a GET request to the [Blockscout Price Oracle endpoint](https://zkatana.blockscout.com/api/v1/gas-price-oracle) to get a gas price recommendation from this oracle. #### cURL @@ -56,4 +57,4 @@ An example JSON response will look like this. } ``` -- {`average`, `fast`, `slow`} are gas prices in Gwei, you can use these prices before sending the transaction off to Astar zkEVM, depending upon your needs \ No newline at end of file +- {`average`, `fast`, `slow`} are gas prices in Gwei, you can use these prices before sending the transaction off to Astar zkEVM. \ No newline at end of file