获取区块内交易列表#
查询指定区块内的交易列表,支持按交易类型(普通交易、内部交易、代币转移等)筛选。
支持的链:见获取区块 API 支持的链(apiName:transaction-list)。
请求地址#
GET
https://web3.okx.com/api/v6/explorer/block/transaction-list请求参数#
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| chainIndex | String | 是 | 链唯一标识,如 ETH 为 1、BTC 为 0;支持范围见获取区块 API 支持的链 |
| height | String | 是 | 区块高度(纯数字) |
| protocolType | String | 否 | 交易类型:普通交易 transaction(默认)、内部交易 internal、ERC-20 代币交易 token_transfer_20、ERC-721 代币交易 token_transfer_721、ERC-1155 代币交易 token_transfer_1155、TRC-10 代币交易 token_transfer_10 |
| cursor | String | 否 | 分页游标;取上次响应返回的 cursor,首次请求不传 |
| limit | String | 否 | 返回条数,默认返回最近的 20 条,最多 100 条 |
响应参数#
| 参数名 | 类型 | 描述 |
|---|---|---|
| limit | String | 本页条数上限 |
| cursor | String | 下一页游标;空串表示没有更多。请求时原样回传,客户端不应解析或构造 |
| chainIndex | String | 链唯一标识 |
| transactionList | Array | 区块内交易列表 |
| > txid | String | 交易哈希 |
| > methodId | String | 方法 id |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块高度 |
| > transactionTime | String | 交易时间;Unix 时间戳的毫秒数格式,如 1597026383085 |
| > from | String | 发送方地址 |
| > isFromContract | Boolean | from 地址是否为合约地址 |
| > isToContract | Boolean | to 地址是否为合约地址 |
| > to | String | 接收方地址 |
| > amount | String | 交易数量 |
| > transactionSymbol | String | 交易数量对应的币种 |
| > txfee | String | 手续费;仅普通交易(transaction)返回,其他类型为空串 "" |
| > state | String | 交易状态 |
| > tokenId | String | NFT 的 ID |
| > tokenContractAddress | String | 代币合约地址 |
请求示例#
shell
curl --location --request GET 'https://web3.okx.com/api/v6/explorer/block/transaction-list?chainIndex=1&height=19000000&protocolType=transaction' \
--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": "20",
"cursor": "2",
"chainIndex": "1",
"transactionList": [
{
"txid": "0x9a92dcd2a29ba1b195f6ee752f8be5da96b03b25ad38ae12de304a01048bf9c4",
"methodId": "0xa9059cbb",
"blockHash": "0xba9ded5ca1ec9adb9451bf062c9de309d9552fa0f0254a7b982d3daf7ae436cd",
"height": "19000000",
"transactionTime": "1705146239000",
"from": "0x28c6c06298d514db089934071355e5743bf21d60",
"isFromContract": false,
"isToContract": true,
"to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"amount": "0",
"transactionSymbol": "ETH",
"txfee": "0.001744128940281",
"state": "success",
"tokenId": "",
"tokenContractAddress": ""
}
]
}
]
}
