본문으로 건너뛰기

Polygon Gas Station

Polygon Gas Station aims to help dApp developers with gas price recommendations, so that they can use it before sending transaction off to Polygon network.

origin

At Polygon, we were receiving request from dApp developers for building a gas price recommendation service. So we took some inspiration from Eth Gas Station, and built one.

availability

Polygon Gas Station has been deployed both on Polygon Mumbai Testnet & Polygon Mainnet, where it analyzes recent 500 transactions and recommends gas price.

usage

Polygon-Mainnet

For getting gas price recommendation from this oracle, send GET request to the Polygon Gas Station V2 to get the gas fee estimates. Polygon Gas Station V2 Endpoint: https://gasstation-mainnet.matic.network/v2

cURL

curl https://gasstation-mainnet.matic.network/v2

JavaScript

fetch('https://gasstation-mainnet.matic.network/v2')
.then(response => response.json())
.then(json => console.log(json))

Python

import requests
requests.get('https://gasstation-mainnet.matic.network/v2').json()

interpretation

  • Example JSON response will look like this:
{
"safeLow": {
"maxPriorityFee":30.7611840636,
"maxFee":30.7611840796
},
"standard": {
"maxPriorityFee":32.146027800733336,
"maxFee":32.14602781673334
},
"fast": {
"maxPriorityFee":33.284344224133335,
"maxFee":33.284344240133336
},
"estimatedBaseFee":1.6e-8,
"blockTime":6,
"blockNumber":24962816
}
  • {'safelow', 'standard', 'fast', 'estimatedBaseFee'} are gas prices in GWei, you can use these prices before sending transaction off to Polygon, depending upon your need
  • 'blockNumber' tells what was latest block mined when recommendation was made
  • 'blockTime' in second, which gives average block time of network