Skip to main content

cfx_getCode

Returns the code at given address at given time (epoch number).

Params

(2)

1. addr (required)

string
Match pattern:
^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$

2. block_hash_or_epoch_number (required)

No schema defined

Result

(cfx_getCode_result)
string
Match pattern:
^0x[0-9a-f]*$

Examples

Request

curl -X POST --data \
'{
"method": "cfx_getCode",
"params": [
"CFXTEST:TYPE.USER:AATGGCS6J4VMKE5M10WY04SKDZ7D27RDX2CZXKDMY3"
],
"jsonrpc": "2.0",
"id": 1
}' \
-H "Content-Type: application/json" \
localhost:12539

Result

"0x"

Endpoint

Params

addr

block_hash_or_epoch_number

Unsupported field schema for field root: Unknown field type undefined.

{
  "nullable": true
}

Request

curl -X POST --data \
'{
"method": "cfx_getCode",
"params": [
null,
null
],
"jsonrpc": "2.0",
"id": 1
}' \
-H "Content-Type: application/json" \
https://test.confluxrpc.com