Portal pentru dezvoltatori
Temă

Get Block List#

Retrieve the block list for a specified chain, returned from newest to oldest by block height. Use the height parameter to locate the block at a specific height.

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

Request URL#

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

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.
heightStringNoBlock height (digits only). When provided, returns the block at that height; when omitted, returns the latest block list.
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.
chainIndexStringUnique identifier of the chain.
blockListArrayBlock list.
> hashStringBlock hash.
> heightStringBlock height.
> validatorStringBlock producer / super node / validator.
> blockTimeStringBlock time, as a Unix timestamp in milliseconds, e.g., 1597026383085.
> txnCountStringNumber of transactions contained in the block.
> blockSizeStringBlock size, in bytes.
> mineRewardStringBlock reward. Total block earnings equal mineReward + totalFee.
> totalFeeStringSum of all transaction fees in the block.
> feeSymbolStringTransaction fee currency.
> avgFeeStringAverage transaction fee per transaction.
> ommerBlockStringNumber of ommer (uncle) blocks.
> gasUsedStringGas used.
> gasLimitStringGas limit.
> gasAvgPriceStringAverage gas price.
> stateStringBlock state: pending when confirming, done when confirmed. Chains where this does not apply return an empty string "".
> burntStringAmount of transaction fees burnt.

Request Example#

shell
curl --location --request GET 'https://web3.okx.com/api/v6/explorer/block/block-list?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": "2",
            "chainIndex": "1",
            "blockList": [
                {
                    "hash": "0xba9ded5ca1ec9adb9451bf062c9de309d9552fa0f0254a7b982d3daf7ae436cd",
                    "height": "19000000",
                    "validator": "beaverbuild",
                    "blockTime": "1705146239000",
                    "txnCount": "150",
                    "blockSize": "57619",
                    "mineReward": "0.044304750347454041",
                    "totalFee": "0.352967975656501696",
                    "feeSymbol": "ETH",
                    "avgFee": "0.0023",
                    "ommerBlock": "0",
                    "gasUsed": "12849554",
                    "gasLimit": "30000000",
                    "gasAvgPrice": "0.000000027468899821",
                    "state": "",
                    "burnt": "0.308663225309047655"
                }
            ]
        }
    ]
}