获取链上历史统计数据#
以天为维度查询指定公链的历史统计数据,包括每日新增地址数、交易笔数、合约调用次数、交易手续费与网络利用率,按时间倒序、游标分页返回。仅部分主流公链支持。
支持的链:见获取公链信息 API 支持的链(apiName:stats)。
请求地址#
GET
https://web3.okx.com/api/v6/explorer/info/stats请求参数#
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| chainIndex | String | 是 | 链唯一标识,如 ETH 为 1、BTC 为 0;支持范围见获取公链信息 API 支持的链 |
| startTime | String | 否 | 查询开始时间;Unix 时间戳的毫秒数格式,如 1597026383085;startTime 与 endTime 之差最长不超过 1 年 |
| endTime | String | 否 | 查询结束时间,返回早于该日期的统计数据;Unix 时间戳的毫秒数格式,如 1597026383085 |
| cursor | String | 否 | 分页游标;首页不传,翻页时原样回传上次响应返回的 cursor |
| limit | String | 否 | 每页返回条数,默认 20 条,最多 100 条 |
响应参数#
| 参数名 | 类型 | 描述 |
|---|---|---|
| limit | String | 本页条数上限 |
| cursor | String | 下一页游标;空串表示没有更多。请求时原样回传,客户端不应解析或构造 |
| statsHistoryList | Array | 历史统计数据列表 |
| > time | String | 日期,以天为维度;Unix 时间戳的毫秒数格式,如 1597026383085 |
| > newAddressCount | String | 每日新增地址数 |
| > totalTransactionCount | String | 每日总交易笔数 |
| > totalContractCalls | String | 每日链上合约被调用的次数之和 |
| > transactionFee | String | 每日支付给验证者的交易手续费,单位为本链币 |
| > networkUtilization | String | 每日网络利用率,即每日总 gas used / 每日总 gas limit |
请求示例#
shell
curl --location --request GET 'https://web3.okx.com/api/v6/explorer/info/stats?chainIndex=1&limit=2' \
--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'
响应示例#
json
{
"code": "0",
"msg": "",
"data": [
{
"limit": "2",
"cursor": "1753545600000",
"statsHistoryList": [
{
"time": "1753632000000",
"newAddressCount": "95321",
"totalTransactionCount": "1345678",
"totalContractCalls": "2456789",
"transactionFee": "1023.45",
"networkUtilization": "0.5234"
},
{
"time": "1753545600000",
"newAddressCount": "92104",
"totalTransactionCount": "1312456",
"totalContractCalls": "2401233",
"transactionFee": "987.12",
"networkUtilization": "0.5108"
}
]
}
]
}
