# Blocks

## Get Block Number by Timestamp

\[[https://docs.etherscan.io/api-endpoints/blocks#get-block-number-by-timestamp](https://docs.etherscan.io/api-endpoints/blocks#get-block-number-by-timestamp)]

Returns the block number that was mined at a certain timestamp.

{% tabs %}
{% tab title="Mantle" %}
```
https://api.w3w.ai/mantle/v1/developer/api
   ?module=block
   &action=getblocknobytime
   &timestamp=1700561183
   &closest=before
   &apikey=YourApiKeyToken
```

> Try this endpoint in your [**browser**](https://api.w3w.ai/mantle/v1/developer/api?module=block\&action=getblocknobytime\&timestamp=1700561183\&closest=before\&apikey=YourApiKeyToken) :link:
{% endtab %}

{% tab title="Monad Testnet" %}
```
https://api.socialscan.io/monad-testnet/v1/developer/api
   ?module=block
   &action=getblocknobytime
   &timestamp=1742536751
   &closest=before
   &apikey=8f9d3e27-a516-4c08-b235-7d94f02ca91b
```

> Try this endpoint in your [**browser**](https://api.socialscan.io/monad-testnet/v1/developer/api?module=block\&action=getblocknobytime\&timestamp=1742536751\&closest=before\&apikey=8f9d3e27-a516-4c08-b235-7d94f02ca91b) :link:
{% endtab %}
{% endtabs %}

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

<table><thead><tr><th width="239">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>timestamp</td><td>the <code>integer</code> representing the Unix timestamp in <strong>seconds</strong>.</td></tr><tr><td>closest</td><td>the closest available block to the provided timestamp, either <code>before</code> or <code>after</code></td></tr></tbody></table>
{% endtab %}

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

```
{
    "status": "1",
    "message": "OK",
    "result": 22350175
}
```
{% endtab %}
{% endtabs %}

## Get Daily Average Block Size

\[[https://docs.etherscan.io/api-endpoints/blocks#get-daily-average-block-size](https://docs.etherscan.io/api-endpoints/blocks#get-daily-average-block-size)]

Returns the daily average block size within a date range.

{% tabs %}
{% tab title="Mantle" %}
```
https://api.w3w.ai/mantle/v1/developer/api
   ?module=stats
   &action=dailyavgblocksize
   &startdate=2023-10-01
   &enddate=2023-10-28
   &sort=asc
   &apikey=YourApiKeyToken
```

> Try this endpoint in your [**browser**](https://api.w3w.ai/mantle/v1/developer/api?module=stats\&action=dailyavgblocksize\&startdate=2023-10-01\&enddate=2023-10-28\&sort=asc\&apikey=YourApiKeyToken) :link:
{% endtab %}

{% tab title="Monad Testnet" %}
```
https://api.socialscan.io/monad-testnet/v1/developer/api
   ?module=stats
   &action=dailyavgblocksize
   &startdate=2025-02-01
   &enddate=2025-02-28
   &sort=asc
   &apikey=8f9d3e27-a516-4c08-b235-7d94f02ca91b
```

> Try this endpoint in your [**browser**](https://api.socialscan.io/monad-testnet/v1/developer/api?module=stats\&action=dailyavgblocksize\&startdate=2025-02-01\&enddate=2025-02-28\&sort=asc\&apikey=8f9d3e27-a516-4c08-b235-7d94f02ca91b) :link:
{% endtab %}
{% endtabs %}

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

<table><thead><tr><th width="239">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>startdate</td><td>the starting date in <code>yyyy-MM-dd</code> format, eg. <code>2023-10-01</code></td></tr><tr><td>enddate</td><td>the ending date in <code>yyyy-MM-dd</code> format, eg. <code>2023-10-28</code></td></tr><tr><td>sort</td><td>the sorting preference, use <code>asc</code> to sort by ascending and <code>desc</code> to sort by descending</td></tr></tbody></table>
{% endtab %}

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

```
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "UTCDate": "2023-10-01",
            "unixTimeStamp": "1696089600",
            "averageBlockSize": "1029.1555438763168622"
        },
        {
            "UTCDate": "2023-10-28",
            "unixTimeStamp": "1698422400",
            "averageBlockSize": "999.4082466713384723"
        }
    ]
}
```
{% endtab %}
{% endtabs %}

## Get Daily Block Count and Rewards

\[[https://docs.etherscan.io/api-endpoints/blocks#get-daily-block-count-and-rewards](https://docs.etherscan.io/api-endpoints/blocks#get-daily-block-count-and-rewards)]

Returns the number of blocks mined daily and the amount of block rewards.

{% tabs %}
{% tab title="Mantle" %}
```
https://api.w3w.ai/mantle/v1/developer/api
   ?module=stats
   &action=dailyblkcount
   &startdate=2023-10-01
   &enddate=2023-10-28
   &sort=asc
   &apikey=YourApiKeyToken
```

> Try this endpoint in your [**browser**](https://api.w3w.ai/mantle/v1/developer/api?module=stats\&action=dailyblkcount\&startdate=2023-10-01\&enddate=2023-10-28\&sort=asc\&apikey=YourApiKeyToken) :link:
{% endtab %}

{% tab title="Monad Testnet" %}
```
https://api.socialscan.io/monad-testnet/v1/developer/api
   ?module=stats
   &action=dailyblkcount
   &startdate=2025-02-01
   &enddate=2025-02-28
   &sort=asc
   &apikey=8f9d3e27-a516-4c08-b235-7d94f02ca91b
```

> Try this endpoint in your [**browser**](https://api.socialscan.io/monad-testnet/v1/developer/api?module=stats\&action=dailyblkcount\&startdate=2025-02-01\&enddate=2025-02-28\&sort=asc\&apikey=8f9d3e27-a516-4c08-b235-7d94f02ca91b) :link:
{% endtab %}
{% endtabs %}

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

<table><thead><tr><th width="239">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>startdate</td><td>the starting date in <code>yyyy-MM-dd</code> format, eg. <code>2023-10-01</code></td></tr><tr><td>enddate</td><td>the ending date in <code>yyyy-MM-dd</code> format, eg. <code>2023-10-28</code></td></tr><tr><td>sort</td><td>the sorting preference, use <code>asc</code> to sort by ascending and <code>desc</code> to sort by descending</td></tr></tbody></table>
{% endtab %}

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

```
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "UTCDate": "2023-10-01",
            "unixTimeStamp": "1696089600",
            "blockCount": "296823"
        },
        {
            "UTCDate": "2023-10-28",
            "unixTimeStamp": "1698422400",
            "blockCount": "178375"
        }
    ]
}
```
{% endtab %}
{% endtabs %}

## Get Daily Average Time for A Block to be Included in the Ethereum Blockchain

\[[https://docs.etherscan.io/api-endpoints/blocks#get-daily-average-time-for-a-block-to-be-included-in-the-ethereum-blockchain](https://docs.etherscan.io/api-endpoints/blocks#get-daily-average-time-for-a-block-to-be-included-in-the-ethereum-blockchain)]

Returns the daily average of time needed for a block to be successfully mined.

{% tabs %}
{% tab title="Mantle" %}
```
https://api.w3w.ai/mantle/v1/developer/api
   ?module=stats
   &action=dailyavgblocktime
   &startdate=2023-10-01
   &enddate=2023-10-28
   &sort=asc
   &apikey=YourApiKeyToken
```

> Try this endpoint in your [**browser**](https://api.w3w.ai/mantle/v1/developer/api?module=stats\&action=dailyavgblocktime\&startdate=2023-10-01\&enddate=2023-10-28\&sort=asc\&apikey=YourApiKeyToken) :link:
{% endtab %}

{% tab title="Monad Testnet" %}
```
https://api.socialscan.io/monad-testnet/v1/developer/api
   ?module=stats
   &action=dailyavgblocktime
   &startdate=2025-01-01
   &enddate=2025-02-28
   &sort=asc
   &apikey=8f9d3e27-a516-4c08-b235-7d94f02ca91b
```

> Try this endpoint in your [**browser**](https://api.socialscan.io/monad-testnet/v1/developer/api?module=stats\&action=dailyavgblocktime\&startdate=2025-01-01\&enddate=2025-02-28\&sort=asc\&apikey=8f9d3e27-a516-4c08-b235-7d94f02ca91b) :link:
{% endtab %}
{% endtabs %}

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

<table><thead><tr><th width="239">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>startdate</td><td>the starting date in <code>yyyy-MM-dd</code> format, eg. <code>2023-10-01</code></td></tr><tr><td>enddate</td><td>the ending date in <code>yyyy-MM-dd</code> format, eg. <code>2023-10-28</code></td></tr><tr><td>sort</td><td>the sorting preference, use <code>asc</code> to sort by ascending and <code>desc</code> to sort by descending</td></tr></tbody></table>
{% endtab %}

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

```
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "UTCDate": "2023-10-01",
            "unixTimeStamp": "1696089600",
            "blockTime_sec": "0.29"
        },
        {
            "UTCDate": "2023-10-28",
            "unixTimeStamp": "1698422400",
            "blockTime_sec": "0.48"
        }
    ]
}
```
{% endtab %}
{% endtabs %}
