本文原文连接 点击这里获取Etherscan API 中文文档(完整版) 完整内容排版更好,推荐读者前往阅读。html
帐号及地址相关的 API,接口的参数说明请参考Etherscan API 约定, 文档中不单独说明。web
译者注: 英文 `balance` 有人翻译为`金额`,译者习惯称为`余额`。 帐号和地址大部分也是指一个意思。
接口:api
/api?module=account&action=balance&address=0x&tag=latest&apikey=YourApiKeyToken
返回:浏览器
{ status: "1", message: "OK", result: "40807178566070000000000" }
说明:翻译
余额的单位都是最小单位wei
, 更多单位换算可阅读:以太单位换算设计
请求样例URL,点击可在浏览器查看效果。3d
接口:code
/api?module=account&action=balancemulti&address=0xabc,0x63..,0x198..&tag=latest&apikey=YourApiKeyToken
使用,
来分割地址,一次请求最多20个帐号。htm
返回:blog
{ status: "1", message: "OK", result: [ { account: "0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a", balance: "40807178566070000000000" }, { account: "0x63a9975ba31b0b9626b34300f7f627147df1f526", balance: "332567136222827062478" } ] }
请求样例URL
接口:
/api?module=account&action=txlist&address=&apikey=YourApiKeyToken
可选参数:startblock
、endblock
、sort
返回:
{ "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
示意图:
Solidity 中文文档(完整版) ethers.js 中文文档(完整版) Web3.js 中文文档(完整版) Truffle 中文文档(完整版)