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"
}
}