Service node πŸ“ž RPC calls

Introduction

This is a list of JSON2.0 RPC calls to be used with Oxen Service Nodes, along with examples of each.

get_quorum_state

Get the quorum state which is the list of public keys of the nodes who are voting, and the list of public keys of the nodes who are being tested.
Testnet Example
1
curl -X POST http://127.0.0.1:38157/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_quorum_state", "params": {"height": 200}}' -H 'Content-Type: application/json'
Copied!
Result
1
{
2
"id": "0",
3
"jsonrpc": "2.0",
4
"result": {
5
"nodes_to_test":
6
["578e5ee53150a3276dd3c411cb6313324a63b530cf3651f5c15e3d0ca58ceddd",
7
…
8
"c917034e9fcd0e9b0d423638664bbfc36eb8a2eeb68a1ff8bed8be5f699bc3c0"],
9
"quorum_nodes":
10
["fc86a737756b6ed9f81233d22da3baee32537f3087901c3e94384be85ca1a9ee",
11
…
12
"ee597c5c7bbf1452e689a785f1133fc1355889b4111955d54cb5ed826cd35a32"],
13
"status": "OK",
14
"untrusted": false
15
}
16
}
Copied!
Nodes have been omitted with β€œ...” for brevity in nodes_to_test and quorum_nodes.
Inputs
    Int height
The height to query the quorum state for
Outputs
    String[] nodes_to_test
An array of public keys identifying service nodes which are being tested for the queried height.
    String[] quorum_state
An array of public keys identifying service nodes which are responsible for voting on the queried height.

get_staking_requirement

Get the required amount of $OXEN to become an Oxen Service Node at the queried height. For stagenet and testnet values, ensure the daemon is started with the --stagenet or --testnet flags respectively.
Testnet Example
1
curl -X POST http://127.0.0.1:38157/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_staking_requirement", "params": {β€œheight”: 111111}}' -H 'Content-Type: application/json'
Copied!
Result
1
{
2
"id": "0",
3
"jsonrpc": "2.0",
4
"result": {
5
"staking_requirement": 100000000000,
6
"status": "OK"
7
}
8
}
Copied!
Inputs
    Int height
The height to query the staking requirement for
Outputs
    Uint64 staking_requirement
The staking requirement in Oxen atomic units for the queried height

get_service_node_key

Get the service node public key of the queried daemon. The daemon must be started in --service-node mode otherwise this RPC command will fail.
Testnet Example
1
curl -X POST http://127.0.0.1:38157/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_service_node_key"}' -H 'Content-Type: application/json'
Copied!
Result
1
{
2
"id": "0",
3
"jsonrpc": "2.0",
4
"result": {
5
"service_node_pubkey": "8d56c1fa0304884e612ee2efe763b2c50991a66329418fd084a3f23c75399f34",
6
"status": "OK"
7
}
8
}
Copied!
Inputs
    N/A
Outputs
    String service_node_pubkey
The public key identifying the queried service node
get_service_nodes
Get the metadata currently associated with the queried service node public keys such as, registration height and contributors, etc. If no public key is specified, this returns all the metadata for every service node the queried daemon currently knows about.
Testnet Example
1
curl -X POST http://127.0.0.1:38157/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_service_nodes", β€œparams”: {β€œservice_node_pubkeys”: []}}' -H 'Content-Type: application/json'
Copied!
Result
1
{
2
"id": "0",
3
"jsonrpc": "2.0",
4
"result": {
5
"service_node_states": [{
6
"contributors": [{
7
"address": "T6T6kZfTEf5JGw2SgLrGuxRNFxRTf51fvbbcCYW949RsKjX75JMA1B1d8CT4VbwfGR8uf3f3AJSTaBHGpN3QRG2N2LyiksWVg",
8
"amount": 100000000000,
9
"reserved": 100000000000
10
}],
11
"last_reward_block_height": 2968,
12
"last_reward_transaction_index": 4294967295,
13
"last_uptime_proof": 0,
14
"operator_address": "T6T6kZfTEf5JGw2SgLrGuxRNFxRTf51fvbbcCYW949RsKjX75JMA1B1d8CT4VbwfGR8uf3f3AJSTaBHGpN3QRG2N2LyiksWVg",
15
"portions_for_operator": 18446744073709551612,
16
"registration_height": 1860,
17
"service_node_pubkey": "3afa36a4855a429f5eac1b2f8e7e77657a2e862999ab4d59e473826f9b15f2da",
18
"staking_requirement": 100000000000,
19
"total_contributed": 100000000000,
20
"total_reserved": 100000000000
21
}],
22
"status": "OK"
23
}
24
}
Copied!
Inputs
    String[] service_node_pubkeys
An array of service node public keys in strings that you wish to query metadata for. If an empty array is given, this RPC command returns all service nodes it knows about.
Outputs
    Entry[] service_node_states
The array of metadata for the queried service node(s)
    String service_node_pubkey
The queried service node’s identifying public key
    Uint64 registration_height
The height at which the registration transaction arrived on the blockchain
    Uint64 last_reward_block_height
The last block height this service node received a reward. Rewards are sent to service nodes whom have been waiting longest since their last reward and are then sent to the back of the queue.
    Uint64 last_reward_transaction_index
The position in the queue to receive a reward for the service nodes grouped in the last_reward_block_height.
    Uint64 last_uptime_proof
Unix epoch timestamp of the last time this daemon has received a ping from the queried service node.
    Contribution[] contributors
An array consisting of all the addresses that have contributed to the queried service node.
    Uint64 Contribution.amount
The amount of $OXEN in atomic units the contributor has staked.
    Uint64 Contribution.reserved
The amount of $OXEN in atomic units the contributor has reserved and must fulfill to completely contribute their part to the service node. Amount is equal to reserved once the contributor has fully contributed their part.
    String Contribution.address
The $OXEN address that funds must come from to fulfill the contribution requirement.
    Uint64 total_contributed
The total $OXEN currently contributed going towards the staking requirement.
    Uint64 total_reserved
The total $OXEN that has been reserved by all contributors. The remaining $OXEN is open for other contributors to increase their stake towards the service node.
    Uint64 portions_for_operator
The operator cut expressed as a value from 0 -> STAKING_PORTIONS (defined in oxen/src/cryptonote_config.h) which is the fee taken from the service node reward and given to the operator address before rewards are distributed to the contributors.
    Uint64 operator_address
The wallet address which is the primary owner of the service node and also the address which the operator cut is sent to.
Last modified 12d ago
Export as PDF
Copy link