Skip to content

Commit

Permalink
restructure gas fee information
Browse files Browse the repository at this point in the history
  • Loading branch information
Maar-io committed Oct 26, 2023
1 parent 43739a4 commit 0248433
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 7 deletions.
65 changes: 64 additions & 1 deletion docs/build/zkEVM/fee.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
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`.
<Tabs>
<TabItem value="testnet" label="zKatana testnet" default>

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()
```

</TabItem>
<TabItem value="Mainnet" label="Astar zkEVM">
coming soon...
</TabItem>

</Tabs>

### 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.
13 changes: 7 additions & 6 deletions docs/build/zkEVM/zkevm-gas-station.md
Original file line number Diff line number Diff line change
@@ -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`.
<Tabs>
<TabItem value="testnet" label="zKatana testnet" default>

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

Expand Down Expand Up @@ -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
- {`average`, `fast`, `slow`} are gas prices in Gwei, you can use these prices before sending the transaction off to Astar zkEVM.

0 comments on commit 0248433

Please sign in to comment.