# Gas Tracker (WIP)

## Get Estimation of Confirmation Time (WIP)

Returns the estimated time, in seconds, for a transaction to be confirmed on the blockchain.

```
https://api.xdcscan.io/api
   ?module=gastracker
   &action=gasestimate
   &gasprice=2000000000
   &apikey=YourApiKeyToken
```

> Try this endpoint in your [**browser**](https://api.xdcscan.io/api?module=gastracker\&action=gasestimate\&gasprice=2000000000\&apikey=YourApiKeyToken) :link:

{% tabs %}
{% tab title="Request" %}
Query Parameters

| Parameter | Description                              |
| --------- | ---------------------------------------- |
| gasprice  | the price paid per unit of gas, in `wei` |

{% hint style="info" %}
:book: **Tip:** Easily convert XDC units using our [**unit converter.**](https://xdc.blocksscan.io/unitconverter)
{% endhint %}
{% endtab %}

{% tab title="Response" %}
Sample Response

```
{
   "status":"1",
   "message":"OK",
   "result":"9227"
}
```

{% hint style="info" %}
:pencil: **Note:** The `result` is returned in **seconds.**
{% endhint %}
{% endtab %}
{% endtabs %}

## Get Gas Oracle ***(Coming Soon)***

Returns the current Safe, Proposed and Fast gas prices.

{% hint style="info" %}
Post **EIP-1559** :fire: changes :

* Safe/Proposed/Fast gas price recommendations are now modeled as Priority Fees.
* New field `suggestBaseFee` , the baseFee of the next pending block
* New field `gasUsedRatio`, to estimate how busy the network is

Learn more about the [**gas changes in EIP-1559.**](https://metamask.io/1559)
{% endhint %}

```
https://api.xdcscan.io/api
   ?module=gastracker
   &action=gasoracle
   &apikey=YourApiKeyToken 
```

> Try this endpoint in your [**browser**](https://api.xdcscan.io/api?module=gastracker\&action=gasoracle\&apikey=YourApiKeyToken) :link:

{% tabs %}
{% tab title="Request" %}
No parameters required.
{% endtab %}

{% tab title="Response" %}
Sample Response

```
{
   "status":"1",
   "message":"OK",
   "result":{
      "LastBlock":"13053741",
      "SafeGasPrice":"20",
      "ProposeGasPrice":"22",
      "FastGasPrice":"24",
      "suggestBaseFee":"19.230609716",
      "gasUsedRatio":"0.370119078777807,0.8954731,0.550911766666667,0.212457033333333,0.552463633333333"
   }
}
```

{% hint style="info" %}
:fuelpump: **Note:** The gas prices are returned in **Gwei.**
{% endhint %}
{% endtab %}
{% endtabs %}

## Get Daily Average Gas Limit ***(Coming Soon)***<img src="https://github.com/BlocksScan/Docs/blob/api/broken-reference" alt="" data-size="line">

Returns the historical daily average gas limit of the XDC network.

```
 https://api.xdcscan.io/api
    ?module=stats
    &action=dailyavggaslimit
    &startdate=2019-02-01
    &enddate=2019-02-28
    &sort=asc
    &apikey=YourApiKeyToken 
```

> Try this endpoint in your [**browser**](https://api.xdcscan.io/api?module=stats\&action=dailyavggaslimit\&startdate=2019-02-01\&enddate=2019-02-28\&sort=asc\&apikey=YourApiKeyToken) :link:

{% tabs %}
{% tab title="Request" %}
Query Parameters

| Parameter    | Description                                                                             |
| ------------ | --------------------------------------------------------------------------------------- |
| startdate    | the starting date in `yyyy-MM-dd` format, eg. `2019-01-31`                              |
| enddate      | the ending date in `yyyy-MM-dd` format, eg. `2019-02-28`                                |
| sort         | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending |
| {% endtab %} |                                                                                         |

{% tab title="Response" %}
Sample Response

```
{
   "status":"1",
   "message":"OK",
   "result":[
      {
         "UTCDate":"2019-02-01",
         "unixTimeStamp":"1548979200",
         "gasLimit":"8001360"
      },
      {
         "UTCDate":"2019-02-27",
         "unixTimeStamp":"1551225600",
         "gasLimit":"8001071"
      },
      {
         "UTCDate":"2019-02-28",
         "unixTimeStamp":"1551312000",
         "gasLimit":"8001137"
      }
   ]
}
```

{% endtab %}
{% endtabs %}

## Get XDC Daily Total Gas Used ***(Coming Soon)***<img src="https://github.com/BlocksScan/Docs/blob/api/broken-reference" alt="" data-size="line">

Returns the total amount of gas used daily for transctions on the XDC network.

```
 https://api.xdcscan.io/api
    ?module=stats
    &action=dailygasused
    &startdate=2019-02-01
    &enddate=2019-02-28
    &sort=asc
    &apikey=YourApiKeyToken 
```

> Try this endpoint in your [**browser**](https://api.xdcscan.io/api?module=stats\&action=dailygasused\&startdate=2019-02-01\&enddate=2019-02-28\&sort=asc\&apikey=YourApiKeyToken) :link:

{% tabs %}
{% tab title="Request" %}
Query Parameters

| Parameter    | Description                                                                             |
| ------------ | --------------------------------------------------------------------------------------- |
| startdate    | the starting date in `yyyy-MM-dd` format, eg. `2019-01-31`                              |
| enddate      | the ending date in `yyyy-MM-dd` format, eg. `2019-02-28`                                |
| sort         | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending |
| {% endtab %} |                                                                                         |

{% tab title="Response" %}
Sample Response

```
{
   "status":"1",
   "message":"OK",
   "result":[
      {
         "UTCDate":"2019-02-01",
         "unixTimeStamp":"1548979200",
         "gasUsed":"32761450415"
      },
      {
         "UTCDate":"2019-02-27",
         "unixTimeStamp":"1551225600",
         "gasUsed":"32657440136"
      },
      {
         "UTCDate":"2019-02-28",
         "unixTimeStamp":"1551312000",
         "gasUsed":"33081119561"
      }
   ]
}
```

{% endtab %}
{% endtabs %}

## Get Daily Average Gas Price ***(Coming Soon)***<img src="https://github.com/BlocksScan/Docs/blob/api/broken-reference" alt="" data-size="line">

Returns the daily average gas price used on the XDC network.

```
 https://api.xdcscan.io/api
    ?module=stats
    &action=dailyavggasprice
    &startdate=2024-02-01
    &enddate=2024-02-28
    &sort=asc
    &apikey=YourApiKeyToken 
```

> Try this endpoint in your [**browser**](https://api.xdcscan.io/api?module=stats\&action=dailyavggasprice\&startdate=2024-02-01\&enddate=2024-02-28\&sort=asc\&apikey=YourApiKeyToken) :link:

{% tabs %}
{% tab title="Request" %}
Query Parameters

| Parameter    | Description                                                                             |
| ------------ | --------------------------------------------------------------------------------------- |
| startdate    | the starting date in `yyyy-MM-dd` format, eg. `2019-01-31`                              |
| enddate      | the ending date in `yyyy-MM-dd` format, eg. `2019-02-28`                                |
| sort         | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending |
| {% endtab %} |                                                                                         |

{% tab title="Response" %}
Sample Response

```
{
   "status":"1",
   "message":"OK",
   "result":[
      {
         "UTCDate":"2019-02-01",
         "unixTimeStamp":"1548979200",
         "maxGasPrice_Wei":"60814303896257",
         "minGasPrice_Wei":"432495",
         "avgGasPrice_Wei":"13234562600"
      },
      {
         "UTCDate":"2019-02-27",
         "unixTimeStamp":"1551225600",
         "maxGasPrice_Wei":"42000000000000",
         "minGasPrice_Wei":"1000000",
         "avgGasPrice_Wei":"16334617513"
      },
      {
         "UTCDate":"2019-02-28",
         "unixTimeStamp":"1551312000",
         "maxGasPrice_Wei":"237222222222257",
         "minGasPrice_Wei":"100000000",
         "avgGasPrice_Wei":"18834674068"
      }
   ]
}
```

{% endtab %}
{% endtabs %}
