proxy/eth_getCode - 获取指定地址部署的代码
使用proxy模块的eth_getCode方法获取指定以太坊地址部署的代码
API调用
GET|POST /api
查询|表单参数:
- module:proxy
- action:eth_call
- address:要查询的以太坊地址
- tag:区块编号,latest表示最新区块
- apikey:etherscan API密钥
API返回结果
返回结果为一个JSON对象,主要字段如下:
- jsonrpc:RPC版本号,2.0
- id:RPC请求编号
- result:调用结果,该地址部署的代码,16进制字符串表示
- error:错误信息
示例代码
以curl为例的调用代码如下,也可以点击这里查看浏览器中的运行结果:
~$ curl https://api.etherscan.io/api?module=proxy&action=eth_getCode&address=0xf75e354c5edc8efed9b59ee9f67a80845ade7d0c&tag=latest&apikey=YourApiKeyToken
返回结果如下:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x3660008037602060003660003473273930d21e01ee25e4c219b63259d214872220a261235a5a03f21560015760206000f3"
}