Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Latest commit

 

History

History
102 lines (75 loc) · 2.58 KB

zkevm-gas-station.md

File metadata and controls

102 lines (75 loc) · 2.58 KB
id title sidebar_label description keywords
zkevm-gas-station
Polygon zkEVM Gas Station
zkEVM Gas Station
Gas price recommendations on the Polygon zkEVM.
polygon
zkevm
gas price prediction
Gas Station

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

The goal of Polygon zkEVM Gas Station is to provide dApp developers with gas pricing suggestions so they can use them before sending transactions to the Polygon zkEVM network. The prediction method is modeled after the Polygon Gas Station but is unique in its own way.

Polygon zkEVM Gas Station is currently deployed on the zkEVM Mainnet Beta and Blueberry Testnet, where it analyzes recent 1500 transactions and recommends gas prices.

Usage

<Tabs defaultValue="mainnet" values={[ { label: 'zkEVM Mainnet Beta', value: 'mainnet', }, { label: 'zKEVM Testnet', value: 'testnet', }, ] }>

Send a GET request to the zkEVM Gas Station endpoint to get a gas price recommendation from this oracle.

cURL

curl https://gasstation-testnet.polygon.technology/zkevm

JavaScript

fetch('https://gasstation-testnet.polygon.technology/zkevm')
  .then(response => response.json())
  .then(json => console.log(json))

Python

import requests
requests.get('https://gasstation-testnet.polygon.technology/zkevm').json()

Send a GET request to the zkEVM Gas Station endpoint to get a gas price recommendation from this oracle.

cURL

curl https://gasstation.polygon.technology/zkevm

JavaScript

fetch('https://gasstation.polygon.technology/zkevm')
  .then(response => response.json())
  .then(json => console.log(json))

Python

import requests
requests.get('https://gasstation.polygon.technology/zkevm').json()

Interpretation

An example JSON response will look like this.

{
    "safeLow":1,
    "standard":1,
    "fast":1,
    "fastest":1,
    "blockTime":2,
    "blockNumber":308789
}
  • {safelow, standard, fast, fastest} are gas prices in Gwei, you can use these prices before sending the transaction off to Polygon zkEVM, depending upon your needs
  • blockTime, in seconds, gives the average block time of the network
  • blockNumber provides the information of the latest block mined when the recommendation was made