交易结果查询接口
更新时间:2020-04-09
交易结果查询接口
接口描述
根据交易Hash,查询交易的上链结果。
权限说明
API权限认证采用Basic Auth方式,请求发起人需要具有合法的Username和Password才能发起请求,其中Username和Password详见所创建的以太坊网络。查看以太坊网络
注意事项
如果请求中没有用户认证信息(即匿名访问),返回401 Unauthorized
,错误信息:401 Authorization Required
。
服务域名
以太坊合约网关接口服务域名地址<ContractGateWayHost>
详见BBE中所创建的以太坊网络详情。查看以太坊网络
请求结构
Plain Text
1GET /v2/ethereum/tx/{txId}
2 Host: <ContractGateWayHost>
请求头域
除公共头域外,无其它特殊头域。
请求参数
名称 | 类型 | 位置 | 描述 | 是否必须 |
---|---|---|---|---|
txId | String | URL参数 | 交易Hash | 必须 |
响应头域
除公共头域外,无其它特殊头域。
响应参数
名称 | 类型 | 描述 |
---|---|---|
requestId | String | 用户请求Id |
result | JsonObject | 交易结果数据 |
status | Integer | 交易状态,1表示成功,0表示失败 |
from | String | 合约调用者地址 |
contract | String | 合约地址 |
ethValue | Integer | 向合约发送的以太币数量 |
gas | Integer | 交易消耗的gas |
transactionHash | String | 交易hash |
nonce | Integer | nonce值 |
blockNumber | Integer | 交易所在区块高度 |
blockHash | String | 区块Hash |
currBlockNumber | Integer | 当前区块高度 |
logs | Array | 交易输出日志 |
请求示例
Plain Text
1 GET /v2/ethereum/tx/0x208140b148622f260f354c38d9424722949cb1b31f542cd33125630dfa6c9809 HTTP/1.1
2 Host: 106.12.189.XXX:8080
交易已打包到区块中响应示例
Plain Text
1HTTP/1.1 200 OK
2 Date: Wed, Thu, 19 Sep 2019 07:59:04 GMT
3 Content Type: application/json; charset=utf-8
4 Content-Length: 1399
5
6 {
7 "requestId": "e23a3d74-966c-4b35-8c87-e33ada7e93da",
8 "result": {
9 "status": 1,
10 "from": "0x7244Ea287849942bAAC280B1912A575aEeCCc792",
11 "contract": "0x134BFd7a3D43ca3b4599718045156ADa22EC8591",
12 "ethValue": 0,
13 "gas": 41136,
14 "transactionHash": "0x208140b148622f260f354c38d9424722949cb1b31f542cd33125630dfa6c9809",
15 "nonce": 52,
16 "blockNumber": 101467,
17 "blockHash": "0xcaf81f10e0874a8490b85df95b223b04dd83f3054dd96989149df3e95fc03ee1",
18 "currBlockNumber": 101730,
19 "logs": [
20 {
21 "address": "0x134bfd7a3d43ca3b4599718045156ada22ec8591",
22 "topics": [
23 "0x0d81390ade415b1e4a25c6b5d8fca3bc67227e5d3835677b0ff6db0128262d2e",
24 "0x0000000000000000000000007244ea287849942baac280b1912a575aeeccc792",
25 "0x000000000000000000000000000000000000000000000000000000000000006f"
26 ],
27 "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000036262650000000000000000000000000000000000000000000000000000000000",
28 "blockNumber": "0x18c5b",
29 "transactionHash": "0x208140b148622f260f354c38d9424722949cb1b31f542cd33125630dfa6c9809",
30 "transactionIndex": "0x1",
31 "blockHash": "0xcaf81f10e0874a8490b85df95b223b04dd83f3054dd96989149df3e95fc03ee1",
32 "logIndex": "0x1",
33 "removed": false
34 }
35 ]
36 }
37}
交易在区块中不存在响应示例
Plain Text
1HTTP/1.1 200 OK
2 Date: Thu, 19 Sep 2019 07:59:04 GMT
3 Content-Type: application/json; charset=utf-8
4 Content-Length: 91
5
6{
7 "requestId": "1bd2ed0d-8bfc-4d6f-ac7a-c550430a3ead",
8 "result": {}
9}
调用合约方法详见:调用合约方法接口