Etherscan API中文手册

账号API
account - 以太坊账号API模块 account/balance - 获取指定地址的余额 account/balancemulti - 获取多个地址的余额 account/txlist - 获取指定地址的普通交易 account/txlistinternal - 获取指定地址的内部交易 account/txlistinternal - 获取指定交易触发的内部交易 account/tokentx - 获取指定地址的ERC20代币转账交易 account/getminedblock - 获取指定地址挖出的区块
合约API
contract - 智能合约API模块 contract/getabi - 获取指定合约的ABI contract/getcode - 获取指定合约的源代码 contract/verifysourcecode - 验证指定合约的源代码 contract/checkverifystatus - 获取源代码验证结果
交易API
transaction - 交易API模块 transaction/getstatus - 获取指定交易的执行状态 transaction/gettxreceiptstatus - 获取指定交易的收据状态
区块API
block - 区块API模块 block/getblockreward - 获取指定区块奖励额
事件日志API
logs - 日志API模块 logs/getLogs - 获取以太坊日志
节点代理API
proxy - 节点代理API模块 proxy/eth_blockNumber - 获取链头区块编号 proxy/eth_getBlockByNumber - 获取指定编号的区块详情 proxy/eth_getUncleByBlockNumberAndIndex - 获取指定的叔伯区块详情 proxy/eth_getBlockTransactionCountByNumber - 获取指定编号区块的交易数量 proxy/eth_getTransactionByHash - 获取指定哈希交易的详情 proxy/eth_getTransactionByBlockNumberAndIndex - 获取指定区块及序号交易的详情 proxy/eth_getTransactionCount - 获取指定地址发生的交易数量 proxy/eth_sendRawTransaction - 发送裸交易 proxy/eth_getTransactionReceipt - 获取指定交易的收据 proxy/eth_call - 执行消息调用 proxy/eth_getCode - 获取指定地址的代码 proxy/eth_getStorageAt - 获取指定位置的内容 proxy/eth_gasPrice - 获取当前的gas价格 proxy/eth_estimateGas - 估算交易gas用量
通证/代币API
token - 代币API概述 stats/tokensupply - 获取指定ERC20代币的总供应量 account/tokenbalance - 获取指定账号的ERC20代币余额
统计API
stats - 统计API模块 stats/ethsupply - 获取以太币当前总量 stats/ethprice - 获取以太币最新价格 stats/chainsize - 获取节点数据大小
开发包
Etherscan开发包
在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

proxy/eth_getTransactionByHash - 获取指定哈希交易的详情

使用proxy模块的eth_getTransactionByHash方法获取指定编号区块 的交易详情。

API调用

GET|POST /api

查询|表单参数:

  • module:proxy
  • action:eth_getTransactionByHash
  • txhash:交易哈希
  • apikey:etherscan API密钥

API返回结果

返回结果为一个JSON对象,主要字段如下:

  • jsonrpc:RPC版本号,2.0
  • id:RPC请求编号
  • result:调用结果为交易详情,主要字段描述如下:
    • blockHash:区块哈希
    • blockNumber:区块编号
    • from:交易发起账号
    • gas:gas用量
    • gasPrice:gas价格
    • hash:交易哈希
    • input:交易额外数据
    • nonce:nonce值
    • to:接受账号
    • transactionIndex:交易序号
    • value:交易金额
    • v:
    • r:
    • s:

示例代码

以curl为例的调用代码如下,也可以点击这里查看浏览器中的运行结果:

~$ curl https://api.etherscan.io/api?module=proxy&action=eth_getTransactionByHash&txhash=0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1&apikey=YourApiKeyToken

返回结果如下:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0xf64a12502afc36db3d29931a2148e5d6ddaa883a2a3c968ca2fb293fa9258c68",
    "blockNumber": "0x70839",
    "from": "0xc80fb22930b303b55df9b89901889126400add38",
    "gas": "0x30d40",
    "gasPrice": "0xba43b7400",
    "hash": "0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1",
    "input": "0xfc36e15b0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a4861636b65726e65777300000000000000000000000000000000000000000000",
    "nonce": "0xa7",
    "to": "0x03fca6077d38dd99d0ce14ba32078bd2cda72d74",
    "transactionIndex": "0x0",
    "value": "0x0",
    "v": "0x1c",
    "r": "0xe7ccdba116aa95ae8d9bdd02f619a0cdfc1f60c5740b3899865822a80cd70218",
    "s": "0xf200df1921ea988d16280a0873b69cb782a54e8a596d15e700710c820c8d2a9e"
  }
}