LogoLogo
HomeAPI PROTwitter
Etherscan V2
Etherscan V2
  • Introduction
  • Getting an API Key
  • Rate Limits
  • Supported Chains
  • V1 to V2 API Migration Guide
  • 🔍Use Cases
    • Accounting/Taxes
  • 🎯API Endpoints
    • Nametags
    • Accounts
    • Contracts
    • Transactions
    • Blocks
    • Logs
    • Geth/Parity Proxy
    • Tokens
    • Gas Tracker
    • Stats
    • L2 Deposits/Withdrawals
    • Usage
  • 🏆API PRO
    • Etherscan API PRO
  • 🍳Cookbook
    • Track Uniswap V4 DEX Trades
  • Get An Address's Full Transaction History
  • ✅Contract Verification
    • Verify with Foundry
    • Verify with Hardhat
    • Verify with Remix
  • Common Verification Errors
  • 🤝Support
    • FAQ
    • Legacy V1 Docs
    • Checking Usage
    • Common Error Messages
    • Getting Help
  • Visit Etherscan.io
Powered by GitBook
On this page
  1. 🎯API Endpoints

Blocks

PreviousTransactionsNextLogs

Last updated 7 months ago

CtrlK
  • Get Block And Uncle Rewards by BlockNo
  • Get Block Transactions Count by BlockNo
  • Get Estimated Block Countdown Time by BlockNo
  • Get Block Number by Timestamp
  • Get Daily Average Block Size
  • Get Daily Block Count and Rewards
  • Get Daily Block Rewards
  • Get Daily Average Time for A Block to be Included in the Ethereum Blockchain
  • Get Daily Uncle Block Count and Rewards

Endpoints with are under the API Pro subscription. To upgrade your API plan, browse through the Etherscan APIs page.

Get Block And Uncle Rewards by BlockNo

Returns the block reward and 'Uncle' block rewards.

https://api.etherscan.io/v2/api
   ?chainid=1
   &module=block
   &action=getblockreward
   &blockno=2165403
   &apikey=YourApiKeyToken

Try this endpoint in your browser 🔗

Query Parameters

Parameter
Description

blockno

the integer block number to check block rewards for eg. 12697906

Sample Response

{
   "status":"1",
   "message":"OK",
   "result":{
      "blockNumber":"2165403",
      "timeStamp":"1472533979",
      "blockMiner":"0x13a06d3dfe21e0db5c016c03ea7d2509f7f8d1e3",
      "blockReward":"5314181600000000000",
      "uncles":[
         {
            "miner":"0xbcdfc35b86bedf72f0cda046a3c16829a2ef41d1",
            "unclePosition":"0",
            "blockreward":"3750000000000000000"
         },
         {
            "miner":"0x0d0c9855c722ff0c78f21e43aa275a5b8ea60dce",
            "unclePosition":"1",
            "blockreward":"3750000000000000000"
         }
      ],
      "uncleInclusionReward":"312500000000000000"
   }
}

​​ ⏳ Tip : The timestamp field is denoted in Unix timestamp.

Get Block Transactions Count by BlockNo

Returns the number of transactions in a specified block.

This endpoint is only available on Etherscan, `chainId` 1

https://api.etherscan.io/v2/api
   ?chainid=1
   &module=block
   &action=getblocktxnscount
   &blockno=2165403
   &apikey=YourApiKeyToken

Try this endpoint in your browser 🔗

Query Parameters

Parameter
Description

blockno

the integer block number to get the transaction count for, eg. 2165403

Sample Response

{
   "status":"1",
   "message":"OK",
   "result":{
      "block":2165403,
      "txsCount":4,
      "internalTxsCount":0,
      "erc20TxsCount":0,
      "erc721TxsCount":0,
      "erc1155TxsCount":0
   }
}

Get Estimated Block Countdown Time by BlockNo

Returns the estimated time remaining, in seconds, until a certain block is mined.

https://api.etherscan.io/v2/api
   ?chainid=1
   &module=block
   &action=getblockcountdown
   &blockno=16701588
   &apikey=YourApiKeyToken

Try this endpoint in your browser 🔗

Query Parameters

Parameter
Description

blockno

the integer block number to estimate time remaining to be mined eg. 12697906

Sample Response

{
   "status":"1",
   "message":"OK",
   "result":{
      "CurrentBlock":"12715477",
      "CountdownBlock":"16701588",
      "RemainingBlock":"3986111",
      "EstimateTimeInSec":"52616680.2"
   }
}

Get Block Number by Timestamp

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

https://api.etherscan.io/v2/api
   ?chainid=1
   &module=block
   &action=getblocknobytime
   &timestamp=1578638524
   &closest=before
   &apikey=YourApiKeyToken

Try this endpoint in your browser 🔗

Query Parameters

Parameter
Description

timestamp

the integer representing the Unix timestamp in seconds.

closest

the closest available block to the provided timestamp, either before or after

⏳ Tip : Convert a regular date-time to a Unix timestamp.

Sample Response

{
   "status":"1",
   "message":"OK",
   "result":"12712551"
}

Get Daily Average Block Size

Returns the daily average block size within a date range.

https://api.etherscan.io/v2/api
   ?chainid=1
   &module=stats
   &action=dailyavgblocksize
   &startdate=2019-02-01
   &enddate=2019-02-28
   &sort=asc
   &apikey=YourApiKeyToken

Try this endpoint in your browser 🔗

Query Parameters

Parameter
Description

startdate

the starting date in yyyy-MM-dd format, eg. 2019-02-01

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

Sample Response

{
   "status":"1",
   "message":"OK",
   "result":[
      {
         "UTCDate":"2019-02-01",
         "unixTimeStamp":"1548979200",
         "blockSize_bytes":20373
      },
      {
         "UTCDate":"2019-02-28",
         "unixTimeStamp":"1551312000",
         "blockSize_bytes":25117
      }
   ]
}

Get Daily Block Count and Rewards

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

https://api.etherscan.io/v2/api
   ?chainid=1
   &module=stats
   &action=dailyblkcount
   &startdate=2019-02-01
   &enddate=2019-02-28
   &sort=asc
   &apikey=YourApiKeyToken 

Try this endpoint in your browser 🔗

Query Parameters

Parameter
Description

startdate

the starting date in yyyy-MM-dd format, eg. 2019-02-01

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

Sample Response

{
   "status":"1",
   "message":"OK",
   "result":[
      {
         "UTCDate":"2019-02-01",
         "unixTimeStamp":"1548979200",
         "blockCount":4848,
         "blockRewards_Eth":"14929.464690870590355682"
      },
      {
         "UTCDate":"2019-02-28",
         "unixTimeStamp":"1551312000",
         "blockCount":4366,
         "blockRewards_Eth":"12808.485512162356907132"
      }
   ]
}

Get Daily Block Rewards

Returns the amount of block rewards distributed to miners daily.

https://api.etherscan.io/v2/api
   ?chainid=1
   &module=stats
   &action=dailyblockrewards
   &startdate=2019-02-01
   &enddate=2019-02-28
   &sort=asc
   &apikey=YourApiKeyToken 

Try this endpoint in your browser 🔗

Query Parameters

Parameter
Description

startdate

the starting date in yyyy-MM-dd format, eg. 2019-02-01

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

Sample Response

{
   "status":"1",
   "message":"OK",
   "result":[
      {
         "UTCDate":"2019-02-01",
         "unixTimeStamp":"1548979200",
         "blockRewards_Eth":"15300.65625"
      },
      {
         "UTCDate":"2019-02-28",
         "unixTimeStamp":"1551312000",
         "blockRewards_Eth":"12954.84375"
      }
   ]
}

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.

https://api.etherscan.io/v2/api
   ?chainid=1
   &module=stats
   &action=dailyavgblocktime
   &startdate=2019-02-01
   &enddate=2019-02-28
   &sort=asc
   &apikey=YourApiKeyToken 

Try this endpoint in your browser 🔗

Query Parameters

Parameter
Description

startdate

the starting date in yyyy-MM-dd format, eg. 2019-02-01

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

Sample Response

{
   "status":"1",
   "message":"OK",
   "result":[
      {
         "UTCDate":"2019-02-01",
         "unixTimeStamp":"1548979200",
         "blockTime_sec":"17.67"
      },
      {
         "UTCDate":"2019-02-28",
         "unixTimeStamp":"1551312000",
         "blockTime_sec":"19.61"
      }
   ]
}

Get Daily Uncle Block Count and Rewards

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

https://api.etherscan.io/v2/api
   ?chainid=1
   &module=stats
   &action=dailyuncleblkcount
   &startdate=2019-02-01
   &enddate=2019-02-28
   &sort=asc
   &apikey=YourApiKeyToken 

Try this endpoint in your browser 🔗

Query Parameters

Parameter
Description

startdate

the starting date in yyyy-MM-dd format, eg. 2019-02-01

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

Sample Response

{
   "status":"1",
   "message":"OK",
   "result":[
      {
         "UTCDate":"2019-02-01",
         "unixTimeStamp":"1548979200",
         "uncleBlockCount":287,
         "uncleBlockRewards_Eth":"729.75"
      },
      {
         "UTCDate":"2019-02-28",
         "unixTimeStamp":"1551312000",
         "uncleBlockCount":288,
         "uncleBlockRewards_Eth":"691.5"
      }
   ]
}