Geliştirici portalı
Tema

Get Block Statistics#

Retrieve daily historical block statistics for a chain, including the number of blocks produced, average block size, block rewards, and average block interval. Data is returned by date from most recent to oldest. Only some major chains are supported (BTC, ETH, TRON, and major EVM chains).

Supported chains: see Get Block API Supported Chains (apiName: block-stats).

Request URL#

GET
https://web3.okx.com/api/v6/explorer/block/block-stats

Request Parameters#

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier of the chain, e.g., 1 for ETH, 0 for BTC. See Get Block API Supported Chains for supported values.
startTimeStringNoQuery start time, as a Unix timestamp in milliseconds, e.g., 1597026383085. The interval between startTime and endTime must not exceed 1 year.
endTimeStringNoQuery end time, as a Unix timestamp in milliseconds, e.g., 1597026383085. The interval between startTime and endTime must not exceed 1 year.
cursorStringNoPagination cursor. Pass the cursor returned by the previous response; omit it on the first request.
limitStringNoNumber of results to return. Defaults to the most recent 20, up to a maximum of 100.

Response Parameters#

ParameterTypeDescription
limitStringMaximum number of results per page.
cursorStringCursor for the next page; an empty string means no more pages. Pass it back as-is; clients should not parse or construct it.
blockHistoryListArrayHistorical block statistics.
> timeStringDate, at daily granularity, as a Unix timestamp in milliseconds, e.g., 1597026383085.
> blockCountStringTotal number of blocks produced that day.
> blockSizeStringAverage block size that day, in bytes.
> mineRewardStringTotal block rewards that day.
> rewardSymbolStringCurrency of the total block rewards that day.
> avgBlockIntervalStringAverage block interval that day, in seconds.

Request Example#

shell
curl --location --request GET 'https://web3.okx.com/api/v6/explorer/block/block-stats?chainIndex=1&limit=20' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z'

Response Example#

json
{
    "code": "0",
    "msg": "",
    "data": [
        {
            "limit": "20",
            "cursor": "MTcwNTA1OTgzOTAwMA",
            "blockHistoryList": [
                {
                    "time": "1705104000000",
                    "blockCount": "7126",
                    "blockSize": "98510",
                    "mineReward": "327.5041",
                    "rewardSymbol": "ETH",
                    "avgBlockInterval": "12.12"
                },
                {
                    "time": "1705017600000",
                    "blockCount": "7130",
                    "blockSize": "97236",
                    "mineReward": "331.2087",
                    "rewardSymbol": "ETH",
                    "avgBlockInterval": "12.11"
                }
            ]
        }
    ]
}