Gas Fee
About 1 min
Gas Fee
Gas Tracker
GET
https://services.tokenview.io/vipapi/eth/gas/nextblock?apikey={apikey}
Parameters
Support public chain: eth
- {apikey}: Get your activated apikey from the API system: https://services.tokenview.io
The calculation formula of Gas Fee
units of gas used * (base fee + priority fee)
- units of gas used: The number of gas units spent on the transaction. A standard simple ETH transfer transaction requires 21,000 units of gas.
- base fee: Basic gas fee, unit is gwei (1gwei = 0.000000001 ETH)
- priority fee: The priority fee, or tip to miners, is in the same unit as the base fee, which is gwei.
Based on this, in order to estimate the optimal handling fee for a transaction, you only need to accurately estimate the basic gas unit [gasUsed] required for the transfer transaction. For example, a standard ETH transfer transaction [Transfer] requires 21,000 units of gas, and contract creation [CREATE] requires 32,000 units of gas. Then calculate it with the data returned by the interface to get the estimated optimal handling fee.
Request
curl --location https://services.tokenview.io/vipapi/eth/gas/nextblock?apikey={apikey}
Response
{
"code": 1,
"msg": "成功",
"data": {
"nextBlockNum": 18210999,
"midPriorityFee": "0.59",
"highPriorityFee": "1.98",
"lowPriorityFee": "0.1",
"nextBlockNumBaseFee": "7.1"
}
}
Response Description
{
"code": 1,
"msg": "成功",
"data": {
"nextBlockNum": 18210999, // next block num
"midPriorityFee": "0.59", // predict priority fees(50%)
"highPriorityFee": "1.98",// predict priority fees(75%)
"lowPriorityFee": "0.1", // predict priority fees(25%)
"nextBlockNumBaseFee": "7.1" // Base Fee
}
}
Mempool Gas
GET
https://services.tokenview.io/vipapi/pendingstat/{lowercase-coin-abbr}?apikey={apikey}
Parameters
- {lowercase-coin-abbr}: eth; bsc; kcs; movr.
- {apikey}: Get your activated apikey from the API system: https://services.tokenview.io
Request
curl --location https://services.tokenview.io/vipapi/pendingstat/eth?apikey={apikey}
Response
{
"code": 1,
"msg": "成功",
"data": {
"bestGasPrice": "41160637668",
"totalCnt": 192520,
"minGasPrice": "1",
"totalSentValue": "3933.985047304320769560",
"totalFee": "177.236959787971531353",
"maxGasPrice": "373890000000",
"totalTokenTransferCnt": 786,
"totalCallTransferCnt": 0
}
}
Response Description
{
"code": 1,
"msg": "成功",
"data": {
"bestGasPrice": "273488197", // best GasPrice
"totalCnt": 4245,
"minGasPrice": "100000000", // min GasPrice
"totalSentValue": "403.823851911631256720",
"totalFee": "8.272538731340059391",
"totalCallTransferCnt": 0,
"totalTokenTransferCnt": 78
}
}