API介绍
本 API 文档旨在为开发者、web3用户及企业用户提供全面、易用的X Layer区块链浏览器 API 接口说明。通过本 API,您可以便捷地访问X Layer链上的各类数据,包括区块、交易、账户、合约、代币等信息,助力您快速开发区块链相关的应用和服务。
文档内容包括:
- 高级检索与筛选:支持多条件筛选、分页、排序等高级查询能力,满足多样化的数据分析需求。
- 区块数据查询:获取区块的详细信息,包括区块高度、哈希、时间戳、出块人、区块奖励等。
- 账户与余额:获取账户的基本信息、余额、交易历史等。
- 交易信息检索:查询单笔或多笔交易的详细数据,包括交易哈希、发送方、接收方、金额、手续费、状态等。
- 合约与代币:查询智能合约详情、合约事件、代币信息(如ERC-20、ERC-721)、持有人列表等。
- 事件日志查询:查询事件日志,包括调用方法、参数、交易时间等。
快速入门[quickstart-guide]
API 鉴权
在开始使用 API 之前,你需要先生成 API key。
生成API key
- 请点击这里生成API key
- 点击 连接钱包 创建或登录账户。我们推荐选择 OKX Web3 钱包 (无缝并快速) ,你也可以使用其他钱包。
- 选择好钱包后,点击验证,钱包处将弹出一个窗口。在钱包内确认签名。
- 在需要创建 API key 的项目处点击 API key 按钮。
- 点击 创建 API key 按钮。
- 输入 API key 的名称和密码(Passphrase),点击创建生成相应的 API key。 一旦密码(Passphrase) 丢失,将无法再使用 API key。请牢记密码(Passphrase)。
账户绑定
绑定邮箱和手机号到你的账户
- 点击「立即绑定」按钮,并切换到「设置」标签页。
- 正确填写你的邮箱和手机号(如果你发现无法在手机号国家选择列表中找到你的国家/地区,主要原因是你选择的区域被限制使用web3 API 服务)
- 输入验证码,完成验证流程
鉴权
所有对 API 发起访问的请求都需要包括下面信息来进行身份认证
OK-ACCESS-KEY: API keyOK-ACCESS-TIMESTAMP:发起请求的时间 (UTC) 。ISO 格式,如:2020-12-08T09:08:57.715ZOK-ACCESS-PASSPHRASE: 创建 API key 时指定的 passphraseOK-ACCESS-SIGN: 签名
签名步骤
- 第一步:将
timestamp、method、requestPath、body拼接成一个字符串 - 第二步:以 HMAC SHA256 算法 和 secret key (在创建 API key 时生成) 对预哈希字符串 (第一步产生的结果) 进行签名
- 第三步:以 Base64 算法对签名进行编码
解释
- 例如,
sign=CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA256(timestamp + 'GET' + '/api/v5/xlayer/block/block-fills', SecretKey)) - 其中,
timestamp与OK-ACCESS-TIMESTAMP必须相同 - 其中,
GET是method(HTTP请求方法,字母全部大写) - 其中,
/api/v5/xlayer/block/block-fills是requestPath(请求接口路径) - 其中,
body为空。如果请求没有请求体(通常为GET请求),那body可省略
注意
- 时间戳与服务端时差不得超过 30 秒
POST请求需包含原始请求体参与签名计算- Secret key 仅创建时可见,请通过安全渠道存储
区块链基础数据
获取区块数据、地址数据、交易数据、代币数据、交易日志数据。某些 API 还支持地址链上数据的批量查询。
区块数据
区块数据的接口,可获取X Layer链上的区块列表,区块交易明细,区块详情等信息
查询区块详情
获取公链的区块详情。
HTTP请求
GET /api/v5/xlayer/block/block-fills
请求示例
GET /api/v5/xlayer/block/block-fills?chainShortName=xlayer&height=31118669
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| height | String | 是 | 区块高度 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"chainFullName": "X Layer",
"chainShortName": "XLAYER",
"hash": "0xb697649cd67e790749dee213a430e40c109565d7cc76db631032330365ab4550",
"height": "31118669",
"validator": "0x610de9141a2c51a9a9624278aa97fbe54b27c102",
"blockTime": "1755483959000",
"txnCount": "4",
"amount": "0",
"blockSize": "1594",
"mineReward": "0.000958705000023418",
"totalFee": "0.000958705000023418",
"feeSymbol": "OKB",
"ommerBlock": "0",
"merkleRootHash": "0x3c1ef0615fa4de876c768f0cc76ccc375f1b2ccf38335853581470566407d130",
"gasUsed": "958705",
"gasLimit": "0",
"gasAvgPrice": "0.000000001",
"state": "",
"burnt": "0",
"txnInternal": "67",
"miner": "0x610de9141a2c51a9a9624278aa97fbe54b27c102",
"difficuity": "0",
"nonce": "0",
"tips": "0",
"confirm": "3537",
"baseFeePerGas": "0"
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| hash | String | 块哈希 |
| height | String | 区块高度 |
| validator | String | 出块者/超级节点/验证人 |
| blockTime | String | 出块时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| txnCount | String | 该区块包含的普通交易个数 |
| amount | String | 交易金额 |
| blockSize | String | 区块大小,单位是:bytes |
| mineReward | String | 区块奖励,块收益等于mineReward+totalFee,以手续费币种为单位 |
| totalFee | String | 该区块所有手续费总和,以手续费币种为单位 |
| feeSymbol | String | 手续费币种 |
| ommerBlock | String | 叔块数量 |
| merkleRootHash | String | 梅克尔根哈希 |
| gasUsed | String | gas消耗 |
| gasLimit | String | gas限额 |
| gasAvgPrice | String | gas均价,单位为OKB |
| state | String | 块状态,确认中:pending、确认完成:done |
| burnt | String | 销毁手续费数量 |
| txnInternal | String | 该区块包含的内部交易个数 |
| miner | String | 打包该区块的矿工地址Hash |
| difficulty | String | 打包该区块时的难度 |
| nonce | String | 在PoW区块链中,nonce用于描述挖矿难度 |
| tips | String | 块内最高小费,交易发起方为了优先打包自己的交易,愿意付给出块者的最大Gas单价 |
| confirm | String | 已确认区块数 |
| baseFeePerGas | String | 每Gas基础费,单位为OKB |
查询区块列表
获取公链的区块列表信息,仅返回近1万条区块列表数据。
HTTP请求
GET /api/v5/xlayer/block/block-list
请求示例
GET /api/v5/xlayer/block/block-list?chainShortName=xlayer&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| height | String | 否 | 区块高度 |
| limit | String | 否 | 每一页返回的条数,默认返回最近的20条,最多100条 |
| page | String | 否 | 页码 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "10000",
"chainFullName": "X Layer",
"chainShortName": "XLAYER",
"blockList": [
{
"hash": "0x70d4e7c0ddc5993ded572728e02761c0a10ccae28f3133b43dfbad3bb0aa6fd4",
"height": "31122982",
"validator": "0x610de9141a2c51a9a9624278aa97fbe54b27c102",
"blockTime": "1755486326000",
"txnCount": "12",
"blockSize": "2497",
"mineReward": "0.00200257336085162",
"totalFee": "0.00200257336085162",
"feeSymbol": "OKB",
"avgFee": "0.000166881113404302",
"ommerBlock": "0",
"gasUsed": "1947524",
"gasLimit": "0",
"gasAvgPrice": "0.000000001028266332",
"state": "",
"burnt": ""
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| blockList | Array | 交易列表 |
| > hash | String | 块hash |
| > height | String | 区块高度 |
| > validator | String | 出块者/超级节点/验证人 |
| > blockTime | String | 出块时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| > txnCount | String | 该区块包含的交易条数 |
| > blockSize | String | 区块大小,单位是:bytes |
| > mineReward | String | 区块奖励,块收益等于mineReward+totalFee |
| > totalFee | String | 该区块所有手续费总和 |
| > feeSymbol | String | 手续费币种 |
| > avgFee | String | 每笔交易平均手续费 |
| > ommerBlock | String | 叔块数量 |
| > gasUsed | String | gas消耗 |
| > gasLimit | String | gas限额 |
| > gasAvgPrice | String | gas均价 |
| > state | String | 块状态 确认中:pending 确认完成:done |
| > burnt | String | 销毁手续费数量 |
查询区块交易列表
获取公链下的某一区块里的交易列表。
HTTP请求
GET /api/v5/xlayer/block/transaction-list
请求示例
GET /api/v5/xlayer/block/transaction-list?chainShortName=xlayer&height=31118669&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| height | String | 是 | 区块高度 |
| protocolType | String | 否 | 不同类型的交易 普通交易:transaction 内部交易:internal 20代币:token_20 721代币:token_721 1155代币:token_1155 10代币:token_10 默认是transaction |
| limit | String | 否 | 返回条数,默认返回最近的20条,最多100条 |
| page | String | 否 | 页码 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "4",
"chainFullName": "X Layer",
"chainShortName": "XLAYER",
"blockList": [
{
"txid": "0xc2ff505188032d2aee7b5debeac40fdc54bed3f25dfded07093aebb74dbd7841",
"methodId": "0xa53711f9",
"blockHash": "0xb697649cd67e790749dee213a430e40c109565d7cc76db631032330365ab4550",
"height": "31118669",
"transactionTime": "1755483959000",
"from": "0x2aff4f126e0c44a565583edbf512be316e13883f",
"isFromContract": false,
"isToContract": true,
"to": "0x47fc11bbe1fef8f07d5797f3b2b43345417603bd",
"amount": "0",
"transactionSymbol": "OKB",
"txfee": "0.000274528",
"state": "success",
"tokenId": "",
"tokenContractAddress": ""
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| blockList | Array | 交易列表 |
| > txid | String | 交易哈希 |
| > methodId | String | 方法 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| > from | String | 发送方地址 |
| > isFromContract | Bol | From地址是否是合约地址 |
| > isToContract | Bol | To地址是否是合约地址 |
| > to | String | 接收方地址 |
| > amount | String | 交易数量 |
| > transactionSymbol | String | 交易数量对应的币种 |
| > txfee | String | 手续费 |
| > state | String | 交易状态 success:成功 fail:失败 pending:等待确认 |
| > tokenId | String | NFT的ID |
| > tokenContractAddress | String | 代币合约地址 |
批量查询区块交易列表
批量获取公链下的某些区块的交易列表,最多返回最近10000笔交易。
HTTP请求
GET /api/v5/xlayer/block/transaction-list-multi
请求示例
GET /api/v5/xlayer/block/transaction-list-multi?chainShortName=xlayer&startBlockHeight=31118669&endBlockHeight=31118670&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| startBlockHeight | String | 是 | 开始查询的区块高度 |
| endBlockHeight | String | 是 | 结束查询的区块高度 |
| protocolType | String | 否 | 不同类型的交易 普通交易:transaction 内部交易:internal 20代币:token_20 721代币:token_721 1155代币:token_1155 默认是transaction |
| limit | String | 否 | 返回条数,默认返回最近的20条,最多100条 |
| page | String | 否 | 页码 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "12",
"transactionList": [
{
"height": "31118670",
"txId": "0x41c1001e8fb26edd4b2ccf9856daa0e90a0c523466bb90378529536269523619",
"methodId": "0xc480dd84",
"blockHash": "0xe5472915fcd492f0c0b65103959925888d4bae32ae008ba87bca85b48fc59225",
"transactionTime": "1755483960000",
"from": "0x4323c64481650c3edcad6be9f4feaa85931005ac",
"isFromContract": false,
"isToContract": true,
"to": "0xed65f249af632aba04737b570be3680e98d5ea37",
"amount": "0",
"transactionSymbol": "OKB",
"txFee": "0.000865481865481",
"state": "success",
"tokenId": "",
"tokenContractAddress": ""
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| transactionList | Array | 交易列表 |
| > txId | String | 交易哈希 |
| > methodId | String | 方法 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| > from | String | 发送方地址 |
| > isFromContract | Bol | From地址是否是合约地址 |
| > isToContract | Bol | To地址是否是合约地址 |
| > to | String | 接收方地址 |
| > amount | String | 交易数量 |
| > transactionSymbol | String | 交易数量对应的币种 |
| > txFee | String | 手续费 |
| > state | String | 交易状态 success:成功 fail:失败 pending:等待确认 |
| > tokenId | String | NFT的ID |
| > tokenContractAddress | String | 代币合约地址 |
地址数据
地址数据功能模块的接口,可以获取富豪地址排行榜、地址余额、地址基本信息、地址交易列表等相关数据
查询地址详情
获取某个地址详细信息,可获取地址余额、代币余额、合约调用次数、合约对应代币等信息。
HTTP请求
GET /api/v5/xlayer/address/information-evm
请求示例
GET /api/v5/xlayer/address/information-evm?address=0x1e4a5963abfd975d8c9021ce480b42188849d41d&chainShortName=xlayer
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| address | String | 是 | 地址 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"address": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"balance": "0",
"balanceSymbol": "OKB",
"transactionCount": "608262",
"firstTransactionTime": "",
"lastTransactionTime": "1755569321000",
"contractAddress": true,
"createContractAddress": "0x2a3dd3eb832af982ec71669e178424b10dca2ede",
"createContractTransactionHash": "0x1c17ce8a0afdd2ca0ff546ef3076f1f6ebb867072db6a27029a2a4ab6764825b",
"contractCorrespondingToken": "USDT",
"contractCalls": "328353",
"contractCallingAddresses": "27164"
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| address | String | 普通地址 |
| balance | String | 本链币余额 |
| balanceSymbol | String | 本链币余额币种 |
| transactionCount | String | 该地址交易次数 |
| firstTransactionTime | String | 该地址发生第一笔交易时间 |
| lastTransactionTime | String | 该地址最近一次发生交易时间 |
| contractAddress | Bol | 是否为智能合约地址 |
| createContractAddress | String | 创建该智能合约的地址 |
| createContractTransactionHash | String | 创建该智能合约的交易hash |
| contractCorrespondingToken | String | 该地址对应的代币,即通过该合约地址发行的代币 |
| contractCalls | String | 30天内合约被调用的次数 |
| contractCallingAddresses | String | 30天内调用合约的地址总数 |
查询地址代币余额详情
获取某个地址代币余额明细,可以获取该地址上的所有代币余额信息。
HTTP请求
GET /api/v5/xlayer/address/token-balance
请求示例
GET /api/v5/xlayer/address/token-balance?chainShortName=xlayer&address=0x1e4a5963abfd975d8c9021ce480b42188849d41d&protocolType=token_20&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| address | String | 是 | 地址 |
| protocolType | String | 是 | 合约协议类型 20代币:token_20 721代币:token_721 1155代币:token_1155 |
| tokenContractAddress | String | 否 | 代币合约地址 |
| page | String | 否 | 页码 |
| limit | String | 否 | 返回条数,默认返回最近的20条,最多50条 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"limit": "1",
"page": "1",
"totalPage": "2",
"tokenList": [
{
"symbol": "USDT",
"tokenContractAddress": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"tokenType": "ERC20",
"holdingAmount": "614.05118",
"priceUsd": "1.00062",
"valueUsd": "614.4318917316",
"tokenId": ""
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| tokenList | Array | 代币列表 |
| > symbol | String | 该地址对应的代币 |
| > tokenContractAddress | String | 该地址对应的代币合约地址 |
| > holdingAmount | String | 代币持仓数量 |
| > priceUsd | String | 代币美元价格 |
| > valueUsd | String | 代币总的美元价值 |
| > tokenId | String | NFT 的ID |
查询地址交易列表
获取交易列表,仅返回近1万条交易数据。
HTTP请求
GET /api/v5/xlayer/address/transaction-list
请求示例
GET /api/v5/xlayer/address/transaction-list?chainShortName=xlayer&address=0x69c236e021f5775b0d0328ded5eac708e3b869df&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| address | String | 是 | 地址 |
| protocolType | String | 否 | 不同类型的交易 交易:transaction 内部交易:internal 20代币:token_20 721代币:token_721 1155代币:token_1155 10代币:token_10 trx转账:trx 默认是transaction |
| tokenContractAddress | String | 否 | 代币合约地址 |
| startBlockHeight | String | 否 | 开始搜索的区块号 |
| endBlockHeight | String | 否 | 结束搜索的区块号 |
| isFromOrTo | String | 否 | from,筛选from地址为查询地址的交易;to,筛选to地址为查询地址的交易; |
| page | String | 否 | 页码,默认返回第一页 |
| limit | String | 否 | 返回条数,默认返回最近的20条,最多100条 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "10000",
"chainFullName": "X Layer",
"chainShortName": "XLAYER",
"transactionLists": [
{
"txId": "0x6bb9fe97af19ba7a3c887b3f96be59031a6d7026fbc1252113753d5aaedf3c6c",
"methodId": "0x9871efa4",
"blockHash": "0xe3a02cf4636b6f7442e3e5b6c2a8f4400b1f1bb68bc99b742a7c116e61a0f474",
"height": "31117930",
"transactionTime": "1755483543000",
"from": "0xd0f04833849ba63938f3bafefb55646fa642fee9",
"to": "0x69c236e021f5775b0d0328ded5eac708e3b869df",
"isFromContract": false,
"isToContract": true,
"amount": "0",
"transactionSymbol": "OKB",
"txFee": "0.000187223000748892",
"state": "fail",
"tokenId": "",
"tokenContractAddress": "",
"challengeStatus": "",
"l1OriginHash": ""
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| transactionLists | Array | 交易列表 |
| > txId | String | 交易哈希 |
| > methodId | String | 方法 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块 |
| > transactionTime | String | 交易时间,pending交易返回广播时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| > from | String | 发送方地址 |
| > to | String | 接收方地址 |
| > isFromContract | Bol | From地址是否是合约地址 |
| > isToContract | Bol | To地址是否是合约地址 |
| > amount | String | 交易数量 |
| > transactionSymbol | String | 交易数量对应的币种 |
| > txFee | String | 手续费 |
| > state | String | 交易状态 success 成功 fail 失败 pending 等待确认 |
| > tokenId | String | NFT的ID |
| > tokenContractAddress | String | 交易数量对应的币种的合约地址 |
| > challengeStatus | String | 挑战期状态 |
| > l1OriginHash | String | L1执行交易哈希 |
查询地址普通交易列表
获取地址相关的普通交易列表。
HTTP请求
GET /api/v5/xlayer/address/normal-transaction-list
请求示例
GET /api/v5/xlayer/address/normal-transaction-list?chainShortName=xlayer&limit=1&address=0x69c236e021f5775b0d0328ded5eac708e3b869df
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| address | String | 是 | 地址 |
| startBlockHeight | String | 否 | 开始区块高度 |
| endBlockHeight | String | 否 | 最终区块高度 |
| isFromOrTo | String | 否 | from,筛选from地址为查询地址的交易;to,筛选to地址为查询地址的交易; |
| page | String | 否 | 页码,默认返回第一页 |
| limit | String | 否 | 返回条数,默认返回最近的20条,最多100条 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"limit": "1",
"page": "1",
"totalPage": "10000",
"transactionList": [
{
"txId": "0xac13f71830c237aaae8debab0a37ed03c5baf3525c76d5fd2dcb3a20ca201ae2",
"methodId": "0x9871efa4",
"nonce": "7",
"gasPrice": "1017500300",
"gasLimit": "456747",
"gasUsed": "129549",
"blockHash": "0x0bfa9e97961084aa399288c81ac03e46bfc9d055ae38598ffb8e060af0c420f6",
"height": "30664630",
"transactionTime": "1755240660000",
"from": "0x7b63a9eaaa7f1e651f3dceea1c9935fab217624a",
"to": "0x69c236e021f5775b0d0328ded5eac708e3b869df",
"isFromContract": false,
"isToContract": true,
"amount": "0.05",
"symbol": "OKB",
"txFee": "0.0001318161463647",
"state": "success",
"transactionType": "0"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| transactionList | Array | 交易列表 |
| > txId | String | 交易哈希 |
| > methodId | String | 方法 |
| > nonce | String | 发起者地址发起的第几笔交易 |
| > gasPrice | String | gas价格 |
| > gasLimit | String | gas限额 |
| > gasUsed | String | gas消耗 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| > from | String | 发送方地址 |
| > to | String | 接收方地址 |
| > isFromContract | Bol | From地址是否是合约地址 |
| > isToContract | Bol | To地址是否是合约地址 |
| > amount | String | 交易数量 |
| > symbol | String | 交易数量对应的币种 |
| > txFee | String | 手续费 |
| > state | String | 交易状态success 成功fail 失败pending 等待确认 |
| > transactionType | String | 交易类型 0:原始交易类型 1:EIP2930 2:EIP1559 |
查询地址内部交易列表
获取地址相关的内部交易列表。
HTTP请求
GET /api/v5/xlayer/address/internal-transaction-list
请求示例
GET /api/v5/xlayer/address/internal-transaction-list?chainShortName=xlayer&address=0x1e4a5963abfd975d8c9021ce480b42188849d41d&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| address | String | 是 | 地址 |
| startBlockHeight | String | 否 | 开始区块高度 |
| endBlockHeight | String | 否 | 最终区块高度 |
| isFromOrTo | String | 否 | from,筛选from地址为查询地址的交易;to,筛选to地址为查询地址的交易 |
| page | String | 否 | 页码,默认返回第一页 |
| limit | String | 否 | 返回条数,默认返回最近的20条,最多100条 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"limit": "1",
"page": "1",
"totalPage": "10000",
"transactionList": [
{
"txId": "0x06eadc91e56112be1ea348fa61fc58b5aa4637dd128d9b823a876340d78157df",
"operation": "call",
"blockHash": "0xaebfc9302cce84b17cc14b6a865b7ee452ecfc58d1bd6e01d3a512a2d8878bae",
"height": "31276541",
"transactionTime": "1755569401000",
"from": "0x8869230d573bc68446d4a4a3e08ff93a5d59e797",
"to": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"isFromContract": true,
"isToContract": true,
"amount": "0",
"symbol": "OKB",
"state": "success"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| transactionList | Array | 交易列表 |
| > txId | String | 交易哈希 |
| > operation | String | 操作类型 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| > from | String | 发送方地址 |
| > to | String | 接收方地址 |
| > isFromContract | Bol | From地址是否是合约地址 |
| > isToContract | Bol | To地址是否是合约地址 |
| > amount | String | 交易数量 |
| > state | String | 交易状态success 成功fail 失败 |
| > symbol | String | 交易数量对应的币种 |
查询地址代币交易列表
获取地址相关的代币交易交易列表。
HTTP请求
GET /api/v5/xlayer/address/token-transaction-list
请求示例
GET /api/v5/xlayer/address/token-transaction-list?chainShortName=xlayer&address=0x1e4a5963abfd975d8c9021ce480b42188849d41d&protocolType=token_20&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| address | String | 是 | 地址 |
| protocolType | String | 是 | 代币类型,20代币:token_20,721代币:token_721,1155代币:token_1155,10代币:token_10,默认为token_20 |
| tokenContractAddress | String | 否 | 代币合约地址 |
| startBlockHeight | String | 否 | 开始区块高度 |
| endBlockHeight | String | 否 | 最终区块高度 |
| isFromOrTo | String | 否 | from,筛选from地址为查询地址的交易;to,筛选to地址为查询地址的交易; |
| page | String | 否 | 页码,默认返回第一页 |
| limit | String | 否 | 返回条数,默认返回最近的20条,最多100条 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"limit": "1",
"page": "1",
"totalPage": "22",
"transactionList": [
{
"txId": "0x7fe5534171a274293b6c4fa84dd4364fe108d0df3991f65258ce1a5921a4e2ab",
"blockHash": "0x339f1013e5ec02b33c99ce77c96758f4ca09db1a779e544f12384413f3f2959d",
"height": "23681833",
"transactionTime": "1752298217000",
"from": "0x6fe6dc264e1c8bfa06909ee847a744b37bb346df",
"to": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"tokenContractAddress": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"tokenId": "",
"amount": "20.58",
"symbol": "USDT",
"isFromContract": true,
"isToContract": true
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| transactionList | Array | 交易列表 |
| > txId | String | 交易哈希 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块高度 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| > from | String | 发送方地址 |
| > to | String | 接收方地址 |
| > isFromContract | Bol | From地址是否是合约地址 |
| > isToContract | Bol | To地址是否是合约地址 |
| > tokenContractAddress | String | 代币的合约地址 |
| > amount | String | 交易数量 |
| > symbol | String | 交易数量对应的币种 |
| > tokenId | String | NFT 的ID |
查询指定区块普通交易列表
可以批量查询最多20个地址的普通交易,需要限制查询的开始区块高度以及结束的区块高度,两者差距不能超过10000个区块。
HTTP请求
GET /api/v5/xlayer/address/normal-transaction-list-multi
请求示例
GET /api/v5/xlayer/address/normal-transaction-list-multi?chainShortName=xlayer&address=0x69c236e021f5775b0d0328ded5eac708e3b869df,0xa1d2c4533d867ce4623681f68df84d9cad73cb6b&endBlockHeight=30666228&startBlockHeight=30666225
请求参数
| 参数名 | 类型 | 必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| address | String | 是 | 地址,最多可以输入20个地址,以,分隔 |
| startBlockHeight | String | 是 | 开始搜索的区块号 |
| endBlockHeight | String | 是 | 结束搜索的区块号 |
| isFromOrTo | String | 否 | from,筛选from地址为查询地址的交易;to,筛选to地址为查询地址的交易 |
| page | String | 否 | 页码 |
| limit | String | 否 | 每页返回的数据条数,默认最小20条,最多100条 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "20",
"totalPage": "1",
"transactionList": [
{
"txId": "0x05203bf6a5537085f04f9aea12df9cb0dd84e838e2b9a176507dd268d240c546",
"methodId": "0xb80c2f09",
"blockHash": "0x0544b739806c5c28e953e6cba7be1df160407a083a9e295dc2900e6c338f43dc",
"height": "30666228",
"transactionTime": "1755241379000",
"from": "0xb574f51e9f1ff7df6b0965a49a5656b30d2d9dab",
"to": "0x69c236e021f5775b0d0328ded5eac708e3b869df",
"isFromContract": false,
"isToContract": true,
"amount": "0",
"symbol": "OKB",
"txFee": "0.0002503569034629",
"gasLimit": "920976",
"gasUsed": "230490",
"gasPrice": "1086194210",
"nonce": "1",
"transactionType": "0"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 页码 |
| limit | String | 每页返回的数据条数,默认最小20条,最多100条 |
| totalPage | String | 总共的页数 |
| transactionList | Array | 交易列表 |
| > txId | String | 交易哈希 |
| > methodId | String | 标识智能合约函数的短哈希 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块高度 |
| > transactionTime | String | 交易发生的时间;Unix时间戳的毫秒数格式,如1597026383085 |
| > from | String | 交易发送方的地址,多个地址,以,分隔 |
| > to | String | 交易接受方的地址,多个地址,以,分隔 |
| > isFromContract | Bol | from地址是否是合约地址 |
| > isToContract | Bol | to地址是否是合约地址 |
| > amount | String | 代币数量 |
| > symbol | String | 交易代币的符号 |
| > txFee | String | 交易的手续费(单位ETH) |
| > gasLimit | String | gas最大使用量 |
| > gasUsed | String | 实际的gas使用量(单位Wei) |
| > gasPrice | String | gas价格(单位Wei) |
| > nonce | String | 发起者地址发起的第几笔交易 |
| > transactionType | String | 交易类型 0:原始交易类型 1:EIP2930 2:EIP1559 |
查询指定区块内部交易列表
可以批量查询最多20个地址的内部交易,需要限制查询的开始区块高度以及结束的区块高度,两者差距不能超过10000个区块。
HTTP请求
GET /api/v5/xlayer/address/internal-transaction-list-multi
请求示例
GET /api/v5/xlayer/address/internal-transaction-list-multi?chainShortName=xlayer&address=0x1e4a5963abfd975d8c9021ce480b42188849d41d,0x74b7f16337b8972027f6196a17a631ac6de26d22&endBlockHeight=18374470&startBlockHeight=18370000&limit=1
请求参数
| 参数名 | 类型 | 必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| address | String | 是 | 地址,最多可以输入20个地址,以,分隔 |
| startBlockHeight | String | 是 | 开始搜索的区块号 |
| endBlockHeight | String | 是 | 结束搜索的区块号 |
| page | String | 否 | 页码 |
| limit | String | 否 | 每页返回的数据条数,默认最小20条,最多100条 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "24",
"transactionList": [
{
"txId": "0xb3419122edd3f45387d4cf8603b45003d514fd7ba9c1c5218d88f6d284905693",
"blockHash": "0x1fa9214b1cfaafa7fcb3fcd9200e5ca2bd59e59e76360a67a4fa797707772079",
"height": "18372896",
"transactionTime": "1750114210000",
"operation": "call",
"from": "0xc7545904de04200b3d4676827cdc9977a0d032d5",
"to": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"isFromContract": true,
"isToContract": true,
"amount": "0"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 页码 |
| limit | String | 每页返回的数据条数,默认最小20条,最多100条 |
| totalPage | String | 总共的页数 |
| transactionList | Array | 交易列表 |
| > txId | String | 交易哈希 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块高度 |
| > transactionTime | String | 交易发生的时间;Unix时间戳的毫秒数格式,如1597026383085 |
| > operation | String | 操作类型 |
| > from | String | 交易发送方的地址,多个地址,以,分隔 |
| > to | String | 交易接受方的地址,多个地址,以,分隔 |
| > isFromContract | Bol | from地址是否是合约地址 |
| > isToContract | Bol | to地址是否是合约地址 |
| > amount | String | 代币数量 |
查询主链币持仓地址列表
获取某个公链的主链币持仓地址列表,仅返回余额Top 10000的地址信息。
HTTP请求
GET /api/v5/xlayer/address/native-token-position-list
请求示例
GET /api/v5/xlayer/address/native-token-position-list?chainShortName=xlayer&limit=3
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| page | String | 否 | 页码 |
| limit | String | 否 | 每页返回的数据条数,默认20条,最多100条 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "3",
"totalPage": "3334",
"positionList": [
{
"rank": "1",
"symbol": "OKB",
"holderAddress": "0x2a3dd3eb832af982ec71669e178424b10dca2ede",
"amount": "340282366920938000000"
},
{
"rank": "2",
"symbol": "OKB",
"holderAddress": "0x611f7bf868a6212f871e89f7e44684045ddfb09d",
"amount": "130934.4995103933"
},
{
"rank": "3",
"symbol": "OKB",
"holderAddress": "0xa1d2c4533d867ce4623681f68df84d9cad73cb6b",
"amount": "43340.318559400665"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 页码 |
| limit | String | 每页返回的数据条数,默认最小20条,最多100条 |
| totalPage | String | 总共的页数 |
| positionList | Array | 持仓列表 |
| > rank | String | 地址余额排名 |
| > symbol | String | 持仓币种 |
| > address | String | 持仓地址 |
| > amount | String | 持仓数量 |
交易数据
交易数据功能模块的接口,可获取某个链的交易信息,交易列表。
查询公链交易列表
获取公链的交易列表,仅返回近1万条交易数据。
HTTP请求
GET /api/v5/xlayer/transaction/transaction-list
请求示例
GET /api/v5/xlayer/transaction/transaction-list?limit=1&chainShortName=xlayer
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| blockHash | String | 否 | 区块哈希 |
| height | String | 否 | 区块高度 |
| limit | String | 否 | 每一页返回的条数,默认返回最近的20条,最多100条 |
| page | String | 否 | 页码 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "10000",
"chainFullName": "X Layer",
"chainShortName": "XLAYER",
"transactionList": [
{
"txid": "0x7db1728b0825fe747a0fbea9e5c5a07fec01e77c8684a6e2df912db408189dc7",
"blockHash": "0x6af529ac10583632da1ad9a74ed5f303c52c7ed98b3d35590c8be9f3d1ace7f9",
"height": "31136625",
"transactionTime": "1755494041000",
"input": "0xf6ead32d92fb5ad6b99749f9083e20d58bdcdcdc",
"output": "0x99594db61870ef0bc825547b242114488e32521e",
"isInputContract": false,
"isOutputContract": true,
"amount": "0",
"transactionSymbol": "OKB",
"txfee": "0.000277729000277729",
"methodId": "0x786809ad",
"transactionType": "0",
"state": "success"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| transactionList | Array | 交易列表 |
| > txid | String | 交易哈希 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块高度 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| > input | String | 输入地址,如果存在多个地址,以英文逗号分隔 |
| > output | String | 输出地址 ,如果存在多个地址,以英文逗号分隔 |
| > isFromContract | Bol | input地址是否是合约地址 |
| > isToContract | Bol | output地址是否是合约地址 |
| > amount | String | 交易数量 |
| > transactionSymbol | String | 交易数量对应的币种 |
| > txfee | String | 手续费 |
| > methodId | String | 方法 |
| > transactionType | String | 交易类型0:原始交易类型 1:EIP2930 2:EIP1559 |
| > state | String | 交易状态 success 成功 fail 失败 pending 等待确认 |
查询公链大额交易列表
获取公链上的大额交易列表。
HTTP请求
GET /api/v5/xlayer/transaction/large-transaction-list
请求示例
GET /api/v5/xlayer/transaction/large-transaction-list?chainShortName=xlayer&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| type | String | 否 | 查询交易数量大于该数量的交易,最低限额为100;若未填写,默认为100 |
| blockHash | String | 否 | 区块哈希 |
| height | String | 否 | 区块高度 |
| limit | String | 否 | 每一页返回的条数,默认返回最近的20条,最多100条 |
| page | String | 否 | 页码 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "10000",
"chainFullName": "X Layer",
"chainShortName": "XLAYER",
"transactionList": [
{
"txid": "0x2fffea8d78e32e742326d0d9b3309ad3c17e06caccbec8c2e51eb844f9369c86",
"blockHash": "0x2dbc439ca3be95cf2283f9066bc8a91848e76566b04f225c1e26ce665d6128e0",
"height": "31135875",
"transactionTime": "1755493597000",
"input": "0x94f79cc5884f02f5038f5a8c0d78658c86832c73",
"output": "0x51883502679b7e3eb3e822dc54d9c0e45ff11f41",
"isInputContract": false,
"isOutputContract": false,
"amount": "113.81610704542136",
"transactionSymbol": "OKB",
"txfee": "0.000021",
"methodId": "",
"transactionType": "0",
"state": "success"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| transactionList | Array | 交易列表 |
| > txid | String | 交易哈希 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| > input | String | 输入,如果存在多个地址,以,分隔 |
| > output | String | 输出,如果存在多个地址,以,分隔 |
| > isInputContract | Bol | input地址是否是合约地址 |
| > isOutputContract | Bol | output地址是否是合约地址 |
| > amount | String | 数量 |
| > transactionSymbol | String | 交易数量对应的币种 |
| > txfee | String | 手续费 |
| > methodId | String | 方法 |
| > transactionType | String | 交易类型0:原始交易类型 1:EIP2930 2:EIP1559 |
| > state | String | 交易状态success 成功fail 失败 pending 等待确认 |
查询公链未确认交易列表
获取公链上的未确认交易列表信息,仅返回近1万条交易数据。
HTTP请求
GET /api/v5/xlayer/transaction/unconfirmed-transaction-list
请求示例
GET /api/v5/xlayer/transaction/unconfirmed-transaction-list?chainShortName=xlayer&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| limit | String | 否 | 每一页返回的条数,默认返回最近的20条,最多100条 |
| page | String | 否 | 页码 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "0",
"chainFullName": "X Layer",
"chainShortName": "XLAYER",
"transactionList": []
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| transactionList | Array | 交易列表 |
| > txid | String | 交易哈希 |
| > height | String | 交易发生的区块 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| > isInputContract | Bol | input地址是否是合约地址 |
| > isOutputContract | Bol | output地址是否是合约地址 |
| > input | String | 输入,如果存在多个地址,以,分隔 |
| > output | String | 输出,如果存在多个地址,以,分隔 |
| > amount | String | 交易数量 |
| > transactionSymbol | String | 交易数量对应的币种 |
| > txfee | String | 手续费 |
| > methodId | String | 方法 |
| > transactionType | String | 交易类型0:原始交易类型 1:EIP2930 2:EIP1559 |
| > randomNumber | String | 随机数 |
| > state | String | 交易状态success 成功 fail 失败 pending 等待确认 |
查询指定交易哈希内部交易
通过交易哈希获取内部交易。
HTTP请求
GET /api/v5/xlayer/transaction/internal-transaction-detail
请求示例
GET /api/v5/xlayer/transaction/internal-transaction-detail?chainShortName=xlayer&txId=0x1af59bfbca54ad5ed218b22916c311ea32093a648f45f1ff2c01bc28c5554b6f&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| txId | String | 是 | 交易Hash |
| limit | String | 否 | 每一页返回的条数,默认返回最近的20条,最多100条 |
| page | String | 否 | 页码 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "16",
"internalTransactionDetails": [
{
"txId": "0x1af59bfbca54ad5ed218b22916c311ea32093a648f45f1ff2c01bc28c5554b6f",
"from": "0x69c236e021f5775b0d0328ded5eac708e3b869df",
"to": "0xc71f9e1de80eb505c0cb3bbf90ae6593130e5d25",
"height": "31277273",
"transactionTime": "1755569805000",
"isFromContract": true,
"isToContract": true,
"operation": "staticcall",
"amount": "0",
"state": "success"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| internalTransactionDetails | Array | 内部交易详情 |
| > txId | String | 交易哈希 |
| > height | String | 交易发生的区块高度 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式 |
| > from | String | 交易发送方的地址 |
| > to | String | 交易接受方的地址 |
| > isFromContract | Bol | from地址是否是合约地址 |
| > isToContract | Bol | to地址是否是合约地址 |
| > operation | String | 操作类型 |
| > amount | String | 交易数量 |
| > state | String | 交易状态 |
查询指定交易哈希代币交易
通过交易哈希获取代币交易。
HTTP请求
GET /api/v5/xlayer/transaction/token-transaction-detail
请求示例
GET /api/v5/xlayer/transaction/token-transaction-detail?chainShortName=xlayer&txId=0x1af59bfbca54ad5ed218b22916c311ea32093a648f45f1ff2c01bc28c5554b6f&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| txId | String | 是 | 交易哈希 |
| protocolType | String | 否 | 不同类型的交易 |
| limit | String | 否 | 每一页返回的条数,默认返回最近的20条,最多100条 |
| page | String | 否 | 页码 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "3",
"tokenTransferDetails": [
{
"txId": "0x1af59bfbca54ad5ed218b22916c311ea32093a648f45f1ff2c01bc28c5554b6f",
"from": "0x7914c6170c4781db3989078d76c8f007151de673",
"to": "0xc71f9e1de80eb505c0cb3bbf90ae6593130e5d25",
"height": "31277273",
"transactionTime": "1755569805000",
"isFromContract": false,
"isToContract": true,
"tokenContractAddress": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"symbol": "USDT",
"amount": "300"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| tokenTransferDetails | Array | 代币交易详情 |
| > txId | String | 交易哈希 |
| > height | String | 交易发生的区块高度 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式 |
| > from | String | 交易发送方的地址 |
| > to | String | 交易接受方的地址 |
| > isFromContract | Bol | from地址是否是合约地址 |
| > isToContract | Bol | to地址是否是合约地址 |
| > tokenContractAddress | String | 代币合约地址 |
| > symbol | String | 交易代币的符号 |
| > amount | String | 交易数量 |
查询指定交易哈希交易明细
获取公链链上交易基础信息。
该接口为老接口,建议使用该模块下其他接口查询交易详细信息
HTTP请求
GET /api/v5/xlayer/transaction/transaction-fills
请求示例
GET /api/v5/xlayer/transaction/transaction-fills?chainShortName=xlayer&txid=0x88c719ff4e6be26a81d642f5bbc6408e64dbd3dfdc9ef170a14d4fcf1c1db10c
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| txid | String | 是 | 交易哈希,最多可批量查询20笔交易,以英文逗号分隔 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"chainFullName": "X Layer",
"chainShortName": "XLAYER",
"txid": "0x88c719ff4e6be26a81d642f5bbc6408e64dbd3dfdc9ef170a14d4fcf1c1db10c",
"height": "31136282",
"transactionTime": "1755493834000",
"amount": "0.25830859001436063",
"transactionSymbol": "OKB",
"txfee": "0.000021",
"index": "2",
"confirm": "7",
"inputDetails": [
{
"inputHash": "0x55bd572ece54c253888f96bb1722fbc237c6936f",
"isContract": false,
"amount": ""
}
],
"outputDetails": [
{
"outputHash": "0xd6e86442e5227bd135cf656be48117d43ce92e3b",
"isContract": false,
"amount": ""
}
],
"state": "success",
"gasLimit": "21000",
"gasUsed": "21000",
"gasPrice": "0.000000001",
"totalTransactionSize": "",
"virtualSize": "428",
"weight": "",
"nonce": "6",
"transactionType": "0",
"methodId": "",
"errorLog": "",
"inputData": "0x",
"isAaTransaction": false,
"tokenTransferDetails": [],
"contractDetails": []
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| txid | String | 交易哈希 |
| height | String | 交易发生的区块 |
| transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| transactionType | String | 交易类型 0:原始交易类型 1:EIP2930 2:EIP1559 |
| amount | String | 交易数量 |
| transactionSymbol | String | 交易数量对应的币种 |
| methodId | String | 方法 |
| errorLog | String | 交易失败日志 |
| inputData | String | 输入数据 |
| txfee | String | 手续费 |
| index | String | 交易在区块里的位置索引 |
| confirm | String | 已确认区块数 |
| inputDetails | Array | 输入地址列表 |
| > inputHash | String | 发起交易的hash地址 |
| > isContract | Bol | 发起交易的地址是否是合约地址 true:是 ;false:否 |
| > amount | String | 该地址的交易数量 |
| outputDetails | Array | 输出地址列表 |
| > outputHash | String | 接收交易的hash地址 |
| > isContract | Bol | 接收交易的地址是否是合约地址 true:是 ;false:否 |
| > amount | String | 该地址的交易数量 |
| state | String | 交易状态 success:成功 fail:失败 pending:等待确认 |
| gasLimit | String | gas限额 |
| gasUsed | String | gas消耗 |
| gasPrice | String | gas价格 |
| totalTransactionSize | String | 总交易大小 |
| virtualSize | String | 虚拟交易大小 |
| weight | String | 交易重量 |
| nonce | String | 发起者地址发起的第几笔交易 |
| isAaTransaction | Bol | 是否为AA交易 |
| tokenTransferDetails | Array | 代币转账明细,最多返回20条,可通过新接口GET /api/v5/xlayer/transaction/internal-transaction-detail和GET /api/v5/xlayer/transaction/token-transaction-detail查询更多数据 |
| > index | String | 该交易在区块里的位置索引 |
| > token | String | 代币名称 |
| > tokenContractAddress | String | 代币合约地址 |
| > symbol | String | 代币符号 |
| > from | String | 转出代币地址 |
| > to | String | 接收代币地址 |
| > isFromContract | Bol | 转出代币地址是否是合约地址 |
| > isToContract | Bol | 接收代币地址是否是合约地址 |
| > tokenId | String | NFT的ID |
| > amount | String | 转账数量 |
| contractDetails | Array | 合约调用转账明细 |
| > index | String | 该交易在区块里的位置索引 |
| > from | String | 转出代币地址 |
| > to | String | 接收代币地址 |
| > isFromContract | Bol | 转出代币地址是否是合约地址 |
| > isToContract | Bol | 接收代币地址是否是合约地址 |
| > amount | String | 转账数量 |
| > gasLimit | String | gas限额 |
批量查询交易明细
通过交易哈希获取交易明细信息。
HTTP请求
GET /api/v5/xlayer/transaction/transaction-multi
请求示例
GET /api/v5/xlayer/transaction/transaction-multi?chainShortName=xlayer&txId=0x88c719ff4e6be26a81d642f5bbc6408e64dbd3dfdc9ef170a14d4fcf1c1db10c
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| txId | String | 是 | 交易哈希,多笔交易以,分隔 最多20个txId |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"txId": "0x88c719ff4e6be26a81d642f5bbc6408e64dbd3dfdc9ef170a14d4fcf1c1db10c",
"methodId": "",
"blockHash": "0x3ad8f2db660966e4f5b1bc54fb16e7d10ce43d23831f3ded93f27b5f8e1fa343",
"height": "31136282",
"transactionTime": "1755493834000",
"from": "0x55bd572ece54c253888f96bb1722fbc237c6936f",
"to": "0xd6e86442e5227bd135cf656be48117d43ce92e3b",
"isFromContract": false,
"isToContract": false,
"amount": "0.258308590014360608",
"symbol": "OKB",
"nonce": "6",
"txFee": "0.000021",
"gasPrice": "1000000000",
"gasLimit": "21000",
"gasUsed": "21000",
"state": "success",
"transactionType": "0"
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| txId | String | 交易哈希 |
| methodId | String | 方法 |
| blockHash | String | 区块哈希 |
| height | String | 交易发生的区块 |
| transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| from | String | 发送方地址 |
| to | String | 接收方地址 |
| isFromContract | Bol | From地址是否是合约地址 |
| isToContract | Bol | To地址是否是合约地址 |
| amount | String | 交易数量 |
| symbol | String | 交易数量对应的币种 |
| nonce | String | 发起者地址发起的第几笔交易 |
| gasLimit | String | gas限额 |
| gasUsed | String | gas消耗 |
| gasPrice | String | gas价格 |
| txFee | String | 手续费 |
| state | String | 交易状态: success 成功 fail 失败 pending 等待确认 |
| transactionType | String | 交易类型 0:原始交易类型 1:EIP2930 2:EIP1559 |
批量查询内部交易
通过交易哈希批量获取内部交易。
HTTP请求
GET /api/v5/xlayer/transaction/internal-transaction-multi
请求示例
GET /api/v5/xlayer/transaction/internal-transaction-multi?chainShortName=xlayer&txId=0x1af59bfbca54ad5ed218b22916c311ea32093a648f45f1ff2c01bc28c5554b6f&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| txId | String | 是 | 交易哈希,多笔交易以,分隔 最多20个txId |
| limit | String | 否 | 每一页返回的条数,默认返回最近的20条,最多100条 |
| page | String | 否 | 页码 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "16",
"transactionList": [
{
"txId": "0x1af59bfbca54ad5ed218b22916c311ea32093a648f45f1ff2c01bc28c5554b6f",
"blockHash": "0xe4e63daf5828275b9ddf278220ceaae6e533d504201d7279702bb03e51df55b7",
"height": "31277273",
"transactionTime": "1755569805000",
"operation": "staticcall",
"from": "0x69c236e021f5775b0d0328ded5eac708e3b869df",
"to": "0xc71f9e1de80eb505c0cb3bbf90ae6593130e5d25",
"isFromContract": true,
"isToContract": true,
"amount": "0"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| internalTransactionDetails | Array | 内部交易详情 |
| > txId | String | 交易哈希 |
| > height | String | 交易发生的区块高度 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式 |
| > operation | String | 操作类型 |
| > from | String | 交易发送方的地址 |
| > to | String | 交易接受方的地址 |
| > isFromContract | Bol | from地址是否是合约地址 |
| > isToContract | Bol | to地址是否是合约地址 |
| > amount | String | 交易数量 |
批量查询代币交易
通过交易哈希批量获取代币交易。
HTTP请求
GET /api/v5/xlayer/transaction/token-transfer-multi
请求示例
GET /api/v5/xlayer/transaction/token-transfer-multi?chainShortName=xlayer&txId=0x1af59bfbca54ad5ed218b22916c311ea32093a648f45f1ff2c01bc28c5554b6f&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| txId | String | 是 | 交易哈希,多笔交易以,分隔 最多20个txId |
| protocolType | String | 否 | 不同类型的交易 |
| limit | String | 否 | 每一页返回的条数,默认返回最近的20条,最多100条 |
| page | String | 否 | 页码 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "3",
"transactionList": [
{
"txId": "0x1af59bfbca54ad5ed218b22916c311ea32093a648f45f1ff2c01bc28c5554b6f",
"blockHash": "0xe4e63daf5828275b9ddf278220ceaae6e533d504201d7279702bb03e51df55b7",
"height": "31277273",
"transactionTime": "1755569805000",
"from": "0x7914c6170c4781db3989078d76c8f007151de673",
"to": "0xc71f9e1de80eb505c0cb3bbf90ae6593130e5d25",
"isFromContract": false,
"isToContract": true,
"amount": "300",
"tokenId": "",
"symbol": "USDT",
"tokenContractAddress": "0x1e4a5963abfd975d8c9021ce480b42188849d41d"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| tokenTransferDetails | Array | 代币交易详情 |
| > txId | String | 交易哈希 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块高度 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式 |
| > from | String | 交易发送方的地址 |
| > to | String | 交易接受方的地址 |
| > isFromContract | Bol | from地址是否是合约地址 |
| > isToContract | Bol | to地址是否是合约地址 |
| > tokenContractAddress | String | 代币合约地址 |
| > amount | String | 交易数量 |
| > symbol | String | 交易代币的符号 |
| > tokenId | String | NFT的ID |
代币数据
代币数据功能模块接口,可以获取一条链上所有的代币列表和代币详情
查询代币列表
获取某条公链上某个代币的基本信息,支持筛选代币的发行时间,可查询最新发行的代币,代币发行时间的筛选跨度最长为1年。
HTTP请求
GET /api/v5/xlayer/token/token-list
请求示例
GET /api/v5/xlayer/token/token-list?chainShortName=xlayer&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| protocolType | String | 否 | 合约协议类型 20代币:token_20 721代币:token_721 1155代币:token_1155 10代币:token_10 默认是token_20 |
| tokenContractAddress | String | 否 | 代币合约地址 |
| startTime | String | 否 | 查询发行时间晚于该时间的代币,Unix时间戳的毫秒数格式,如 1597026383085;startTime与endTime之差最长不超过1年 |
| endTime | String | 否 | 查询发行时间早于该时间的代币,Unix时间戳的毫秒数格式,如 1597026383085;startTime与endTime之差最长不超过1年 |
| orderBy | String | 否 | 按照不同指标降序返回,仅针对20代币 totalMarketCap:按代币总市值从高到低返回 transactionAmount24h :按代币24h交易金额从高到低返回 默认按市值从高到低返回 |
| page | String | 否 | 页码 |
| limit | String | 否 | 返回条数,默认返回最近的20条,最多50条 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "5708",
"chainFullName": "X Layer",
"chainShortName": "XLAYER",
"tokenList": [
{
"tokenFullName": "Tether USD",
"token": "USDT",
"precision": "6",
"tokenContractAddress": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"protocolType": "ERC20",
"addressCount": "130358",
"totalSupply": "26555873.0171",
"circulatingSupply": "158626664755.6",
"price": "1.00061",
"website": "",
"totalMarketCap": "158644113688.72",
"issueDate": "1711855673000",
"transactionAmount24h": "8326653.482096258",
"tvl": "176084.18571530422",
"logoUrl": "https://static.oklink.com/cdn/web3/currency/token/pre/534352-0xf55bec9cafdbe8730f096aa55dad6d22d44099df-1.png/type=default_350_0?v=1735291372501"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| tokenList | Array | 代币列表 |
| > tokenFullName | String | 代币名字全称:USDCoin |
| > token | String | 代币名字简称:USDC |
| > precision | String | 精度 |
| > tokenContractAddress | String | 代币合约地址 |
| > protocolType | String | 代币合约协议类型 |
| > addressCount | String | 持币地址数 |
| > totalSupply | String | 最大供应量 |
| > circulatingSupply | String | 该代币在所有链上的总流通量 |
| > price | String | 价格,USD为单位 |
| > website | String | 官方网站 |
| > totalMarketCap | String | 该代币在所有链上的总市值 |
| > issueDate | String | 代币发行日期 |
| > transactionAmount24h | String | 代币24h交易金额,单位为美元,仅支持20代币 |
| > tvl | String | 代币的总锁仓市值 |
| > logoUrl | String | 代币logo的url |
查询代币持仓列表
获取某条公链上某个代币的持仓列表,仅返回余额为top10000的地址。
HTTP请求
GET /api/v5/xlayer/token/position-list
请求示例
GET /api/v5/xlayer/token/position-list?chainShortName=xlayer&tokenContractAddress=0x1e4a5963abfd975d8c9021ce480b42188849d41d&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| tokenContractAddress | String | 是 | 代币合约地址 |
| holderAddress | String | 否 | 持仓地址 |
| page | String | 否 | 页码 |
| limit | String | 否 | 返回条数,默认返回最近的20条,最多100条 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "10000",
"chainFullName": "X Layer",
"chainShortName": "XLAYER",
"circulatingSupply": "158626664755.6",
"positionList": [
{
"holderAddress": "0xb543ef701c5f5f00de7eb98fd8138b0e33327893",
"amount": "0.000006",
"valueUsd": "0.00000600354",
"positionChange24h": "",
"rank": "1"
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| circulatingSupply | String | 总流通量 |
| positionList | Array | 持仓列表 |
| > holderAddress | String | 持仓地址 |
| > amount | String | 持仓数量 |
| > valueUsd | String | 持仓价值,以美金为单位 |
| > positionChange24h | String | 24小时持仓量变化 |
| > rank | String | 持仓量排名 |
查询代币转帐详情
获取某条公链上指定代币的转账详情。
HTTP请求
GET /api/v5/xlayer/token/transaction-list
请求示例
GET /api/v5/xlayer/token/transaction-list?chainShortName=xlayer&tokenContractAddress=0x1e4a5963abfd975d8c9021ce480b42188849d41d&limit=1
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| tokenContractAddress | String | 是 | 代币合约地址 |
| maxAmount | String | 否 | 筛选交易数量区间,最大数量 |
| minAmount | String | 否 | 筛选交易数量区间,最小数量 |
| page | String | 否 | 页码 |
| limit | String | 否 | 返回条数,默认返回最近的20条,最多100条 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"page": "1",
"limit": "1",
"totalPage": "10000",
"chainFullName": "X Layer",
"chainShortName": "XLAYER",
"totalTransfer": "1332602",
"transactionList": [
{
"txid": "0xfb049c749434287e1064cbfccc800d2c35b35b1b2659b4686a3bc6ad6efd663b",
"blockHash": "0xab788f2c037770b00ee5eade14257caa85aa92f2c7b0212329cc0e76661b1d89",
"height": "31129117",
"transactionTime": "1755489752000",
"from": "0xee796e9e58ae7b248ee34b752835b4eda11ec8a5",
"to": "0xc71f9e1de80eb505c0cb3bbf90ae6593130e5d25",
"isToContract": true,
"amount": "500",
"transactionSymbol": "USDT",
"methodId": "0x751962f6",
"tokenContractAddress": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"protocolType": "ERC20",
"state": "success",
"tokenId": ""
}
]
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| totalTransfer | String | 代币总转账次数 |
| transactionList | Array | 交易列表 |
| > txid | String | 交易哈希 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块高度 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| > to | String | 接收方,多个地址,逗号分隔 |
| > from | String | 发送方,多个地址,逗号分隔 |
| > isFromContract | Bol | input地址是否是合约地址 |
| > isToContract | Bol | output地址是否是合约地址 |
| > amount | String | 交易数量 |
| > transactionSymbol | String | 交易数量对应的币种 |
| > methodId | String | 方法 |
| > tokenContractAddress | String | 代币合约地址 |
| > protocolType | String | 代币协议类型 |
| > state | String | 交易状态 成功: success 失败: fail等待确认: pending |
| > tokenId | String | NFT代币ID,适用于721和1155代币 |
日志数据
日志数据功能模块的接口,可根据区块和地址、地址和 topic、地址、交易不同维度查询事件日志数据。
查询指定区块和地址事件日志
根据区块高度和地址查询交易事件日志,仅返回近 1000 个结果。
HTTP请求
GET /api/v5/xlayer/log/by-block-and-address
请求示例
GET /api/v5/xlayer/log/by-block-and-address?chainShortName=xlayer&startBlockHeight=31276750&endBlockHeight=31276774&address=0x1e4a5963abfd975d8c9021ce480b42188849d41d
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| startBlockHeight | String | 是 | 开始查询的区块高度 |
| endBlockHeight | String | 是 | 结束查询的区块高度 |
| address | String | 是 | 触发事件日志的智能合约的地址 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"height": "31276755",
"address": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x00000000000000000000000047e0ae1ec92e0f991b2e8ebdfffa4fee951b88ec",
"0x000000000000000000000000c71f9e1de80eb505c0cb3bbf90ae6593130e5d25"
],
"data": "0x00000000000000000000000000000000000000000000000000000000001e8480",
"methodId": "0x9871efa4",
"blockHash": "0xcee678998e2adee0aaad139f0cc2e355773641e56631a924d4ea65043179cc5e",
"transactionTime": "1755569518000",
"logIndex": "1",
"txId": "0x154f79639fa6592cb0b56819143e1a31a08a9f71516a7fc2ebc7309c5588e4e8"
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| height | String | 区块高度 |
| address | String | 触发事件日志的智能合约的地址 |
| topics | Array | 事件日志的topic |
| data | String | 事件的非索引参数 |
| blockHash | String | 区块哈希 |
| methodId | String | 调用方法 |
| transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| logIndex | String | 事件日志在区块中的位置索引 |
| txId | String | 交易哈希 |
查询指定地址和 topic 事件日志
根据地址和 topic0 查询交易事件日志,仅返回近 1000 个结果。
HTTP请求
GET /api/v5/xlayer/log/by-address-and-topic
请求示例
GET /api/v5/xlayer/log/by-address-and-topic?chainShortName=xlayer&address=0x69c236e021f5775b0d0328ded5eac708e3b869df&topic0=0x1bb43f2da90e35f7b0cf38521ca95a49e68eb42fac49924930a5bd73cdf7576c
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| address | String | 是 | 触发事件日志的智能合约的地址 |
| topic0 | String | 是 | 事件日志的topic0 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"height": "31128669",
"address": "0x69c236e021f5775b0d0328ded5eac708e3b869df",
"topics": [
"0x1bb43f2da90e35f7b0cf38521ca95a49e68eb42fac49924930a5bd73cdf7576c"
],
"data": "0x000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000e538905cf8410324e03a5a23c1c177a474d59b2b0000000000000000000000007bed4ac3a43fab89e3f8ab7710ed8d0f44d72a53000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000016345785d8a0000",
"methodId": "0x01617fab",
"blockHash": "0x4dd5ef469cc2a28be3a39b2ace1711bc747ac3487ab9d05dc53bfff03dc470a7",
"transactionTime": "1755489505000",
"logIndex": "4",
"txId": "0xd1f0fd77b4aa0493a0ab85b199b79644aeeb8f47ef05ec72a44310695c8d07eb"
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| height | String | 区块高度 |
| address | String | 触发事件日志的智能合约的地址 |
| topics | Array | 事件日志的topic |
| data | String | 事件的非索引参数 |
| blockHash | String | 区块哈希 |
| methodId | String | 调用方法 |
| transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| logIndex | String | 事件日志在区块中的位置索引 |
| txId | String | 交易哈希 |
查询指定地址事件日志
根据地址查询交易事件日志,仅返回近 1000 个结果。
HTTP请求
GET /api/v5/xlayer/log/by-address
请求示例
GET /api/v5/xlayer/log/by-address?chainShortName=xlayer&address=0x1e4a5963abfd975d8c9021ce480b42188849d41d
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| address | String | 是 | 触发事件日志的智能合约的地址 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"height": "31276868",
"address": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x00000000000000000000000063ab3204ed7303fc7ad739ce4d15cbc65ef095aa",
"0x000000000000000000000000c71f9e1de80eb505c0cb3bbf90ae6593130e5d25"
],
"data": "0x0000000000000000000000000000000000000000000000000000000006ea11cd",
"methodId": "0x9871efa4",
"blockHash": "0xac930a9aaf8d10b279204c224bd0d736514f3c9b2762de14091a21185c72a23f",
"transactionTime": "1755569577000",
"logIndex": "1",
"txId": "0xbfc5a6ec106a30e060183a93b27e8e6c3470c69d4b542c019e33a95ad404a60b"
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| height | String | 区块高度 |
| address | String | 触发事件日志的智能合约的地址 |
| topics | Array | 事件日志的topic |
| data | String | 事件的非索引参数 |
| blockHash | String | 区块哈希 |
| methodId | String | 调用方法 |
| transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| logIndex | String | 事件日志在区块中的位置索引 |
| txId | String | 交易哈希 |
查询指定哈希事件日志
根据交易哈希查询交易事件日志,仅返回近 1000 个结果。
HTTP请求
GET /api/v5/xlayer/log/by-transaction
请求示例
GET /api/v5/xlayer/log/by-transaction?chainShortName=xlayer&txId=0x8afe0f22fffd564b0af7db45a0c1718f20ff92b7091b0b843c4f00dba4b2cd0b
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| txId | String | 是 | 交易哈希 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"height": "31128380",
"address": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000458209474e786d424d03b9937069ab3f0badd47e",
"0x000000000000000000000000d1c2d511c0963901cfb602a1e801afec529d81c3"
],
"data": "0x0000000000000000000000000000000000000000000000000000000000c2ef61",
"methodId": "0xa9059cbb",
"blockHash": "0x1251f714d627e7cb53c52373f1c7082c5748bfa2a3f8c78f14a21f43d6fc9a50",
"transactionTime": "1755489346000",
"logIndex": "1",
"txId": "0x8afe0f22fffd564b0af7db45a0c1718f20ff92b7091b0b843c4f00dba4b2cd0b"
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| height | String | 区块高度 |
| address | String | 触发事件日志的智能合约的地址 |
| topics | Array | 事件日志的topic |
| data | String | 事件的非索引参数 |
| blockHash | String | 区块哈希 |
| methodId | String | 调用方法 |
| transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| logIndex | String | 事件日志在区块中的位置索引 |
| txId | String | 交易哈希 |
开发者工具
提供代理合约和普通合约验证等 API 工具。
合约验证
验证合约源代码是一种项目开源的方式,便于终端用户查看合约,提高合约的透明度。
该功能模块接口,支持提交合约源代码进行合约验证、验证代理合约、查询已验证合约的合约 ABI 和源代码。
验证合约源代码
通过上传合约源代码,X Layer浏览器会将编译后的合约字节码和区块链上的字节码进行匹配,并将其显示在浏览器的合约页面中。
您可使用验证合约源代码 API,进行合约的快速验证,提高验证效率。合约验证的平均处理时间在 30-60s 之间。
HTTP请求
POST /api/v5/xlayer/contract/verify-source-code
请求示例
POST /api/v5/xlayer/contract/verify-source-code
body
{
"chainShortName":"XLAYER",
"contractAddress":"0x9Dca580D2c8B8e19e9d77345a5b4C2820B25b386",
"contractName":"HelloWorld",
"sourceCode":"pragma solidity ^0.7.6;↵contract HelloWorl {↵ string public greet = 'Hello Worl!';↵}",
"codeFormat":"solidity-single-file",
"compilerVersion":"v0.7.6+commit.7338295f",
"optimization":"1",
"optimizationRuns":"200",
"contractAbi":"0xfce353f66162630000000000000000000000000",
"evmVersion":"tangerineWhistle",
"viaIr":false,
"libraryInfo":[
{
"libraryName":"libraryName1",
"libraryAddress":"0xCfE28868F6E0A24b7333D22D8943279e76aC2cdc"
},
{
"libraryName":"libraryName2",
"libraryAddress":"0xCfE28868F6E0A24b7333D22D8943279e76aC2cdc"
},
{
"libraryName":"libraryName3",
"libraryAddress":"0xCfE28868F6E0A24b7333D22D8943279e76aC2cdc"
}
]
}
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| contractAddress | String | 是 | 合约地址 |
| contractName | String | 是 | 合约名称 |
| sourceCode | String | 是 | 合约源代码;如果合约使用 imports,需要将代码连接成一个文件(即 flattening),可以使用 Solidity flatteners 工具SolidityFlattery(由@DaveAppleton开发) |
| codeFormat | String | 是 | 代码格式,支持solidity-single-file、solidity-standard-json-input、Vyper |
| compilerVersion | String | 否 | 使用的编译器版本,如v0.7.6+commit.7338295f、vyper:0.2.11,可在 X Layer 浏览器-合约验证查看支持的编译器版本;codeFormat为 solidity-standard-json-input时非必填,其他必填 |
| optimization | String | 否 | 编译合约时是否使用了优化,0无优化,1有优化;codeFormat为 solidity-standard-json-input时非必填,其他必填 |
| optimizationRuns | String | 否 | 执行优化时运行代码的次数 |
| contractAbi | String | 否 | 合约ABI |
| evmVersion | String | 否 | 编译合约的EVM版本,若编译时使用了默认版本无需填写;其他指定版本如:tangerineWhistle,spuriousDragon,byzantium |
| licenseType | String | 否 | 开源许可证类型 |
| viaIr | Bol | 否 | 是否引入基于IR的代码生成器,请与编译时的设置保持一致;true / false,默认为false |
| libraryInfo | Array | 否 | 合约中引用的库的信息;libraryName和libraryAddress需要进行一一匹配;最多支持10个不同的库对 |
| > libraryName | String | 否 | 库名称 |
| > libraryAddress | String | 否 | 库地址,如0xCfE28868F6E0A24b7333D22D8943279e76aC2cdc |
返回结果
{
"code": "0",
"msg": "",
"data": [
"eb5c06099d3841359d398541166343fe"
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| guid | String | 若提交成功会返回GUID,可根据该GUID查询验证结果 |
查询合约源代码验证结果
您可以在提交源代码验证之后,根据返回的 GUID 查询验证结果。
HTTP请求
POST /api/v5/xlayer/contract/check-verify-result
请求示例
POST /api/v5/xlayer/contract/check-verify-result
body
{
"chainShortName":"XLAYER",
"guid":"eb5c06099d3841359d398541166343fe"
}
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| guid | String | 是 | 根据GUID查询合约源代码验证结果 |
返回结果
{
"code": "0",
"msg": "",
"data": [
"Success"
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| result | String | 合约源代码验证结果;Success代表验证通过,Fail代表未通过验证,Pending代表验证中 |
验证代理合约
验证代理合约是否按照预期调用实现合约。
HTTP请求
POST /api/v5/xlayer/contract/verify-proxy-contract
请求示例
POST /api/v5/xlayer/contract/verify-proxy-contract
body
{
"chainShortName": "XLAYER",
"proxyContractAddress": "0xfeee12d53ddb7ce61ee467ddf7243212a953174a",
"expectedImplementation": "0x0ecbefc71524068cf18f9d4e50d787e134ee70b8"
}
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| proxyContractAddress | String | 是 | 代理合约地址 |
| expectedImplementation | String | 否 | 验证该代理合约转发调用的实现合约是否为该地址 |
返回结果
{
"code": "0",
"msg": "",
"data": [
"4f2e75682f75410f958c0a3bbf754358"
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| guid | String | 若提交成功会返回GUID,可根据该GUID查询验证结果 |
查询代理合约验证结果
您可以在提交代理合约验证之后,根据返回的 GUID 查询验证结果。
HTTP请求
POST /api/v5/xlayer/contract/check-proxy-verify-result
请求示例
POST /api/v5/xlayer/contract/check-proxy-verify-result
body
{
"chainShortName":"XLAYER",
"guid":"4f2e75682f75410f958c0a3bbf754358"
}
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| guid | String | 是 | 根据GUID查询代理合约验证结果 |
返回结果
{
"code": "0",
"msg": "The proxy's (0x826427966fb2e7edee940c5d99b7d66062faef2e) implementation contract is found at 0xd4a2dca4e03713d5bf7d2173237058466a9c1be4 and is successfully updated.",
"data": []
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| result | String | 代理合约源代码验证结果 若验证通过,则返回实现合约的合约地址;若验证失败,则返回“未检测到该代理合约的实现合约” |
查询已验证合约的合约 ABI 和源代码
查询已验证合约的合约 ABI、源代码等基本信息,或查询已验证代理合约的实现合约地址信息。
HTTP请求
GET /api/v5/xlayer/contract/verify-contract-info
请求示例
GET /api/v5/xlayer/contract/verify-contract-info?chainShortName=xlayer&contractAddress=0xcF80631b469A54dcba8c8ee1aF84505f496ed248
请求参数
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| contractAddress | String | 是 | 合约地址 |
返回结果
{
"code": "0",
"msg": "",
"data": [
{
"sourceCode": "// proxy.sol - execute actions atomically through the proxy's identity\r\n\r\n// Copyright (C) 2017 DappHub, LLC\r\n\r\n// This program is free software: you can redistribute it and/or modify\r\n// it under the terms of the GNU General Public License as published by\r\n// the Free Software Foundation, either version 3 of the License, or\r\n// (at your option) any later version.\r\n\r\n// This program is distributed in the hope that it will be useful,\r\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\n// GNU General Public License for more details.\r\n\r\n// You should have received a copy of the GNU General Public License\r\n// along with this program. If not, see <http://www.gnu.org/licenses/>.\r\n\r\npragma solidity ^0.4.23;\r\n\r\ncontract DSAuthority {\r\n function canCall(\r\n address src, address dst, bytes4 sig\r\n ) public view returns (bool);\r\n}\r\n\r\ncontract DSAuthEvents {\r\n event LogSetAuthority (address indexed authority);\r\n event LogSetOwner (address indexed owner);\r\n}\r\n\r\ncontract DSAuth is DSAuthEvents {\r\n DSAuthority public authority;\r\n address public owner;\r\n\r\n constructor() public {\r\n owner = msg.sender;\r\n emit LogSetOwner(msg.sender);\r\n }\r\n\r\n function setOwner(address owner_)\r\n public\r\n auth\r\n {\r\n owner = owner_;\r\n emit LogSetOwner(owner);\r\n }\r\n\r\n function setAuthority(DSAuthority authority_)\r\n public\r\n auth\r\n {\r\n authority = authority_;\r\n emit LogSetAuthority(authority);\r\n }\r\n\r\n modifier auth {\r\n require(isAuthorized(msg.sender, msg.sig));\r\n _;\r\n }\r\n\r\n function isAuthorized(address src, bytes4 sig) internal view returns (bool) {\r\n if (src == address(this)) {\r\n return true;\r\n } else if (src == owner) {\r\n return true;\r\n } else if (authority == DSAuthority(0)) {\r\n return false;\r\n } else {\r\n return authority.canCall(src, this, sig);\r\n }\r\n }\r\n}\r\n\r\ncontract DSNote {\r\n event LogNote(\r\n bytes4 indexed sig,\r\n address indexed guy,\r\n bytes32 indexed foo,\r\n bytes32 indexed bar,\r\n uint wad,\r\n bytes fax\r\n ) anonymous;\r\n\r\n modifier note {\r\n bytes32 foo;\r\n bytes32 bar;\r\n\r\n assembly {\r\n foo := calldataload(4)\r\n bar := calldataload(36)\r\n }\r\n\r\n emit LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data);\r\n\r\n _;\r\n }\r\n}\r\n\r\n// DSProxy\r\n// Allows code execution using a persistant identity This can be very\r\n// useful to execute a sequence of atomic actions. Since the owner of\r\n// the proxy can be changed, this allows for dynamic ownership models\r\n// i.e. a multisig\r\ncontract DSProxy is DSAuth, DSNote {\r\n DSProxyCache public cache; // global cache for contracts\r\n\r\n constructor(address _cacheAddr) public {\r\n require(setCache(_cacheAddr));\r\n }\r\n\r\n function() public payable {\r\n }\r\n\r\n // use the proxy to execute calldata _data on contract _code\r\n function execute(bytes _code, bytes _data)\r\n public\r\n payable\r\n returns (address target, bytes32 response)\r\n {\r\n target = cache.read(_code);\r\n if (target == 0x0) {\r\n // deploy contract & store its address in cache\r\n target = cache.write(_code);\r\n }\r\n\r\n response = execute(target, _data);\r\n }\r\n\r\n function execute(address _target, bytes _data)\r\n public\r\n auth\r\n note\r\n payable\r\n returns (bytes32 response)\r\n {\r\n require(_target != 0x0);\r\n\r\n // call contract in current context\r\n assembly {\r\n let succeeded := delegatecall(sub(gas, 5000), _target, add(_data, 0x20), mload(_data), 0, 32)\r\n response := mload(0) // load delegatecall output\r\n switch iszero(succeeded)\r\n case 1 {\r\n // throw if delegatecall failed\r\n revert(0, 0)\r\n }\r\n }\r\n }\r\n\r\n //set new cache\r\n function setCache(address _cacheAddr)\r\n public\r\n auth\r\n note\r\n returns (bool)\r\n {\r\n require(_cacheAddr != 0x0); // invalid cache address\r\n cache = DSProxyCache(_cacheAddr); // overwrite cache\r\n return true;\r\n }\r\n}\r\n\r\n// DSProxyFactory\r\n// This factory deploys new proxy instances through build()\r\n// Deployed proxy addresses are logged\r\ncontract DSProxyFactory {\r\n event Created(address indexed sender, address indexed owner, address proxy, address cache);\r\n mapping(address=>bool) public isProxy;\r\n DSProxyCache public cache = new DSProxyCache();\r\n\r\n // deploys a new proxy instance\r\n // sets owner of proxy to caller\r\n function build() public returns (DSProxy proxy) {\r\n proxy = build(msg.sender);\r\n }\r\n\r\n // deploys a new proxy instance\r\n // sets custom owner of proxy\r\n function build(address owner) public returns (DSProxy proxy) {\r\n proxy = new DSProxy(cache);\r\n emit Created(msg.sender, owner, address(proxy), address(cache));\r\n proxy.setOwner(owner);\r\n isProxy[proxy] = true;\r\n }\r\n}\r\n\r\n// DSProxyCache\r\n// This global cache stores addresses of contracts previously deployed\r\n// by a proxy. This saves gas from repeat deployment of the same\r\n// contracts and eliminates blockchain bloat.\r\n\r\n// By default, all proxies deployed from the same factory store\r\n// contracts in the same cache. The cache a proxy instance uses can be\r\n// changed. The cache uses the sha3 hash of a contract's bytecode to\r\n// lookup the address\r\ncontract DSProxyCache {\r\n mapping(bytes32 => address) cache;\r\n\r\n function read(bytes _code) public view returns (address) {\r\n bytes32 hash = keccak256(_code);\r\n return cache[hash];\r\n }\r\n\r\n function write(bytes _code) public returns (address target) {\r\n assembly {\r\n target := create(0, add(_code, 0x20), mload(_code))\r\n switch iszero(extcodesize(target))\r\n case 1 {\r\n // throw if contract failed to deploy\r\n revert(0, 0)\r\n }\r\n }\r\n bytes32 hash = keccak256(_code);\r\n cache[hash] = target;\r\n }\r\n}",
"contractName": "DSProxy",
"compilerVersion": "v0.4.23+commit.124ca40d",
"compilerType": "solc",
"optimization": "1",
"optimizationRuns": "200",
"contractAbi": "[{\"constant\":false,\"inputs\":[{\"indexed\":false,\"name\":\"owner_\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_target\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"execute\",\"outputs\":[{\"name\":\"response\",\"type\":\"bytes32\"}],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_code\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"execute\",\"outputs\":[{\"name\":\"target\",\"type\":\"address\"},{\"name\":\"response\",\"type\":\"bytes32\"}],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"cache\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"indexed\":false,\"name\":\"authority_\",\"type\":\"address\"}],\"name\":\"setAuthority\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_cacheAddr\",\"type\":\"address\"}],\"name\":\"setCache\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"authority\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"indexed\":false,\"name\":\"_cacheAddr\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"constant\":false,\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"constant\":false,\"inputs\":[{\"indexed\":true,\"name\":\"sig\",\"type\":\"bytes4\"},{\"indexed\":true,\"name\":\"guy\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"foo\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"bar\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"wad\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"fax\",\"type\":\"bytes\"}],\"name\":\"LogNote\",\"payable\":false,\"type\":\"event\"},{\"constant\":false,\"inputs\":[{\"indexed\":true,\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"LogSetAuthority\",\"payable\":false,\"type\":\"event\"},{\"constant\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"LogSetOwner\",\"payable\":false,\"type\":\"event\"}]",
"evmVersion": "Default",
"licenseType": "No License (None)",
"libraryInfo": "",
"proxy": "0",
"implementation": "",
"swarmSource": "bzzr://e498874c9ba9e75028e0c84f1b1d83b2dad5de910c59b837b32e5a190794c5e1"
}
]
}
返回参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| sourceCode | String | 合约源代码 |
| contractName | String | 合约名称 |
| compilerVersion | String | 使用的编译器版本 |
| compilerType | String | 编译器类型 |
| optimization | String | 编译合约时是否使用了优化,0无优化,1有优化 |
| optimizationRuns | String | 执行优化运行代码的次数 |
| contractAbi | String | 合约ABI |
| evmVersion | String | 编译合约的EVM版本 |
| licenseType | String | 开源许可证类型 |
| libraryInfo | Array | 合约中引用的库的信息 |
| > libraryName | String | 库名称 |
| > libraryAddress | String | 库地址,如0xCfE28868F6E0A24b7333D22D8943279e76aC2cdc |
| proxy | String | 是否为代理合约,0表示不是代理合约,1表示是代理合约 |
| implementation | String | 代理合约的实现合约的地址 |
| swarmSource | String | 合约源代码的Swarm的哈希值 |
支持与帮助
错误码
向服务器发出请求时,服务器会通过发出HTTP 代码和错误代码来响应用户的请求。请参考下表进一步了解 API 调用失败时返回的不同错误码和错误提示。
返回示例
{
"code": "50038",
"msg": "This chain does not currently support.",
"data": []
}
以下是我们使用的错误代码及其含义:
通用类
| 错误提示 | HTTP 状态码 | 错误码 |
|---|---|---|
| 操作成功 | 200 | 0 |
| body不能为空 | 400 | 50000 |
| 服务暂时不可用,请稍后重试 | 503 | 50001 |
| 非法的json数据 | 400 | 50002 |
| 接口请求超时(不代表请求成功或者失败,请检查请求结果) | 400 | 50004 |
| 接口已下线或无法使用 | 410 | 50005 |
| 无效的Content_Type,请使用"application/json"格式 | 400 | 50006 |
| 账户被封禁 | 200 | 50007 |
| 账户不存在 | 200 | 50008 |
| 账户因清算被暂停使用 | 200 | 50009 |
| 用户ID为空 | 200 | 50010 |
| 用户请求频率过快,超过该接口允许的限额 | 429 | 50011 |
| 账户状态无效 | 429 | 50012 |
| 当前系统繁忙,请稍后重试 | 200 | 50013 |
| 必填参数{0}不能为空 | 400 | 50014 |
| 参数{0}和{1}不能同时为空 | 400 | 50015 |
| 参数{0}和{1}不匹配 | 400 | 50016 |
| 参数{0}和{1}不能同时存在 | 200 | 50024 |
| 参数{0}传值个数超过最大限制{1} | 200 | 50025 |
| 系统错误 | 500 | 50026 |
| 您没有该API接口的访问权限,需要升级您的账户付费等级 | 403 | 50030 |
| 参数{%}错误 | 400 | 50036 |
| 代币不存在 | 200 | 50037 |
| 该公链不支持 | 200 | 50038 |
| 该警报ID没有历史处理记录 | 200 | 50039 |
| 此区块高度无数据 | 200 | 50040 |
| 当前不支持该代币的历史余额查询 | 200 | 50041 |
| 该代币不支持风险扫描 | 200 | 50042 |
| 您的账户行为触发了风险控制,API功能已冻结。可以通过apiservice@oklink.com与我们联系。 | 200 | 50043 |
| 数据不存在 | 400 | 50044 |
| 客户端操作错误 | 400 | 50045 |
| 根据法律法规,您所在的国家或地区无法使用 X Layer API 服务 | 400 | 50047 |
鉴权类
| 错误提示 | HTTP 状态码 | 错误码 |
|---|---|---|
| Api 已被冻结,请联系客服处理 | 400 | 50100 |
| 请求时间戳过期 | 401 | 50102 |
| 请求头"OK_ACCESS_KEY"不能为空 | 401 | 50103 |
| 请求头"OK_ACCESS_PASSPHRASE"不能为空 | 401 | 50104 |
| 请求头"OK_ACCESS_PASSPHRASE"错误 | 401 | 50105 |
| 请求头"OK_ACCESS_SIGN"不能为空 | 401 | 50106 |
| 请求头"OK_ACCESS_TIMESTAMP"不能为空 | 401 | 50107 |
| 无效的IP | 401 | 50110 |
| 无效的OK_ACCESS_KEY | 401 | 50111 |
| 无效的OK_ACCESS_TIMESTAMP | 401 | 50112 |
| 无效的签名 | 401 | 50113 |
| 无效的授权 | 401 | 50114 |
| 无效的请求类型 | 405 | 50115 |
| 超过了历史数据查询的范围 | 400 | 50117 |
业务类
| 错误提示 | HTTP 状态码 | 错误码 |
|---|---|---|
| {0}参数错误 | 404 | 51000 |
| 您填写的outputAddress地址在该交易中没有找到。 | 200 | 51001 |
| 这个索引所指定的outputAddress在这个交易中不存在。 | 200 | 51002 |
| 该笔交易Hash在区块链上未解析到交易信息,无法确定该笔交易风险详情。 | 200 | 51003 |