本文原文链接
点击这里获取Etherscan API 中文文档(完整版)
完整内容排版更好,推荐读者前往阅读。

账号(Account)

账号及地址相关的 API,接口的参数说明请参考Etherscan API 约定, 文档中不单独说明。

获取单个账号余额

 译者注:    英文 `balance` 有人翻译为`金额`,译者习惯称为`余额`。    账号和地址大部分也是指一个意思。

接口:

/api?module=account&action=balance&address=0x&tag=latest&apikey=YourApiKeyToken

返回:

{    status: "1",    message: "OK",    result: "40807178566070000000000"}

说明:

余额的单位都是最小单位wei, 更多单位换算可阅读:以太单位换算

请求样例URL,点击可在浏览器查看效果。

获取多个账号余额

接口:

/api?module=account&action=balancemulti&address=0xabc,0x63..,0x198..&tag=latest&apikey=YourApiKeyToken

使用,来分割地址,一次请求最多20个账号。

返回:

{status: "1",message: "OK",result: [{account: "0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a",balance: "40807178566070000000000"},{account: "0x63a9975ba31b0b9626b34300f7f627147df1f526",balance: "332567136222827062478"}]}

请求样例URL

获取地址(普通)交易列表

接口:

/api?module=account&action=txlist&address=&apikey=YourApiKeyToken

可选参数:startblockendblocksort

返回:

{    "status": "1",    "message": "OK",    "result": [{        "blockNumber": "47884",        "timeStamp": "1438947953",        "hash": "0xad1c27dd8d0329dbc400021d7477b34ac41e84365bd54b45a4019a15deb10c0d",        "nonce": "0",        "blockHash": "0xf2988b9870e092f2898662ccdbc06e0e320a08139e9c6be98d0ce372f8611f22",        "transactionIndex": "0",        "from": "0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a",        "to": "0x2910543af39aba0cd09dbb2d50200b3e800a63d2",        "value": "5000000000000000000",        "gas": "23000",        "gasPrice": "400000000000",        "isError": "0",        "txreceipt_status": "",        "input": "0x454e34354139455138",        "contractAddress": "",        "cumulativeGasUsed": "21612",        "gasUsed": "21612",        "confirmations": "7525550"    }]}

说明:

isError: 0= 没错, 1=出错
最多返回最近的10000个交易

返回字段中出现的关键字可参考以太坊设计与实现-术语。

请求样例URL

也可以使用分页,参数说明请参考Etherscan API 约定,分页请求样例URL

点击获取Etherscan API 中文文档(完整版)

示意图:

相关文档推荐:

Solidity 中文文档(完整版)
ethers.js 中文文档(完整版)
Web3.js 中文文档(完整版)
Truffle 中文文档(完整版)