[Account] eth_getCode
Returns code at a given address.
JSONRPC: eth_getCode
Request
- application/json
Body
Array [
- IntegerBlockNumber
- HexadecimalBlockNumber
- BlockTag
- BlockHash
]
params
undefined[]
required
Address 20-byte DATA
Address
BlockNumberOrHashOrTag
object
oneOf
the block number with type integer
number
the block number with type hexadecimal
string
the block tag [latest, pending, earliest]
string
the block hash
string
Responses
- 200
Returns code at a given address.
- application/json
- Schema
- Example (from schema)
Schema
error
object
result DATA
The code from the given address.
{
"jsonrpc": "2.0",
"id": 0,
"error": {
"code": -32700,
"message": "Parse error",
"data": "string"
},
"result": "0x600160008035811a818181146012578301005b601b6001356025565b8060005260206000f25b600060078202905091905056"
}
- curl
- python
- nodejs
- java
- Curl
curl -X 'POST' \
'https://public-en-kairos.node.kaia.io' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"method": "eth_getCode",
"id": 1,
"jsonrpc": "2.0",
"params": ["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "0x2"]
}'
- CURL
curl -L 'https://public-en-kairos.node.kaia.io/' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"method": "eth_getCode",
"id": 1,
"jsonrpc": "2.0",
"params": [
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"0x2"
]
}'
ResponseClear