eth_getCode
返回指定地址部署的编译后的智能合约代码。
API请求
POST https://<network>.infura.io/v3/YOUR-PROJECT-ID
请求头:
Content-Type: application/json
请求参数:
- ADDRESS:要查询的地址,必需
- BLOCK PARAMETER:区块编号,或者字符串"latest"、 "earliest"、 "pending"
请求示例:
JSON-RPC over HTTPS POST:
curl https://mainnet.infura.io/v3/YOUR-PROJECT-ID \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getCode","params": ["0x06012c8cf97bead5deae237070f9587f8e7a266d", "0x65a8db"],"id":1}'
JSON-RPC over websockets:
wscat -c wss://mainnet.infura.io/ws/v3/YOUR-PROJECT-ID
>{"jsonrpc":"2.0","method":"eth_getCode","params": ["0x06012c8cf97bead5deae237070f9587f8e7a266d", "0x65a8db"],"id":1}
API响应
返回指定地址的合约代码。
响应结果示例:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x60606040..."
}