Matic Gas Station

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

origin

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

availability

Matic Gas Station has been deployed both on Matic Mumbai Testnet & Matic Mainnet, where it analyzes last 200 non-empty mined blocks and recommends gas price. As soon as new non-empty block gets mined, that's taken under consideration for updating recommendation.

usage

Matic-Mainnet

For getting gas price recommendation from this oracle, send GET request to https://gasstation-mainnet.matic.network

cURL

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

JavaScript

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

Python

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

interpretation

  • Example JSON response will look like this.
{
"safeLow": 1.0,
"standard": 9.0,
"fast": 29.0,
"fastest": 45.0,
"block_time": 2.1,
"blockNum": 1876116
}
  • {'safelow', 'standard', 'fast', 'fastest'} are gas prices in GWei, you can use these prices before sending transaction off to Matic, depending upon your need
  • blockNum gives non-empty block identifier when recommendation was made
  • block_time in second, which gives average block time of network [ Note: As of now, don't rely on block_time, this will be healed as network starts becoming crowded ]