cfx_getNextNonce
Returns the nonce should be filled in next sending transaction from given address at given time (epoch number).
- CURL
curl --request POST \
     --url https://main.confluxrpc.com \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "params": ["CFXTEST:TYPE.USER:AATGGCS6J4VMKE5M10WY04SKDZ7D27RDX2CZXKDMY3",null],
  "method": "cfx_getNextNonce"
}'
Params
addr required
Schema
type : string
Pattern : 
^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$epoch_number optional
Schema
type : any
Always valid
Result
Schema
type : string
Pattern : 
^0x([1-9a-f][0-9a-f]{0,63}|0)$Examples
- cfx_getNextNonce
- cfx_getNextNonce
- cfx_getNextNonce
- cfx_getNextNonce
- cfx_getNextNonce
- cfx_getNextNonce
- cfx_getNextNonce
- cfx_getNextNonce
- cfx_getNextNonce
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getNextNonce",
    "params": [
        "CFXTEST:TYPE.USER:AATGGCS6J4VMKE5M10WY04SKDZ7D27RDX2CZXKDMY3"
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
"0xd"
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getNextNonce",
    "params": [
        "CFXTEST:TYPE.USER:AATGGCS6J4VMKE5M10WY04SKDZ7D27RDX2CZXKDMY3",
        "latest_mined"
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
  "code": -32602,
  "message": "Invalid parameters: num",
  "data": "\"Latest mined epoch is not executed\""
}
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getNextNonce",
    "params": [
        "CFXTEST:TYPE.USER:AATGGCS6J4VMKE5M10WY04SKDZ7D27RDX2CZXKDMY3",
        "earliest"
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
  "code": -32016,
  "message": "Error processing request: State for epoch (number=0 hash=0x3fb9d350f95424c3c27fcf248d9a6f633a83c2a75c11ef887ea41540c85e7804) does not exist: out-of-bound StateAvailabilityBoundary { synced_state_height: 0, lower_bound: 70580001, upper_bound: 70587163, optimistic_executed_height: Some(70587163) }"
}
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getNextNonce",
    "params": [
        "CFXTEST:TYPE.USER:AATGGCS6J4VMKE5M10WY04SKDZ7D27RDX2CZXKDMY3",
        "latest_state"
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
"0xd"
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getNextNonce",
    "params": [
        "CFXTEST:TYPE.USER:AATGGCS6J4VMKE5M10WY04SKDZ7D27RDX2CZXKDMY3",
        "latest_confirmed"
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
"0xd"
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getNextNonce",
    "params": [
        "CFXTEST:TYPE.USER:AATGGCS6J4VMKE5M10WY04SKDZ7D27RDX2CZXKDMY3",
        "latest_finalized"
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
"0xd"
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getNextNonce",
    "params": [
        "CFXTEST:TYPE.USER:AATGGCS6J4VMKE5M10WY04SKDZ7D27RDX2CZXKDMY3",
        "latest_checkpoint"
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
  "code": -32016,
  "message": "Error processing request: State for epoch (number=70500000 hash=0x3dc71e0aa01c258cc1a2415ba54a4fb36a53ba19be4ea3be6e566e879a42ddd0) does not exist: out-of-bound StateAvailabilityBoundary { synced_state_height: 0, lower_bound: 70580001, upper_bound: 70587167, optimistic_executed_height: None }"
}
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getNextNonce",
    "params": [
        "CFXTEST:TYPE.NULL:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA6F0VRCSW",
        "latest_mined"
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
  "code": -32602,
  "message": "Invalid parameters: num",
  "data": "\"Latest mined epoch is not executed\""
}
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getNextNonce",
    "params": [
        "CFXTEST:TYPE.NULL:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA6F0VRCSW",
        "earliest"
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
  "code": -32016,
  "message": "Error processing request: State for epoch (number=0 hash=0x3fb9d350f95424c3c27fcf248d9a6f633a83c2a75c11ef887ea41540c85e7804) does not exist: out-of-bound StateAvailabilityBoundary { synced_state_height: 0, lower_bound: 70580001, upper_bound: 70587167, optimistic_executed_height: None }"
}