Introduction
This document provides detailed descriptions of the Remote Procedure Call (RPC) commands available in the Salvium daemon. These RPC commands allow developers and users to interact programmatically with a Salvium node, enabling a wide range of operations from basic network information retrieval to advanced blockchain management tasks.
General Structure
Each RPC command has the following general structure:
- HTTP Method: Typically POST.
- Endpoint:
/json_rpc
- Request Format: JSON
- Response Format: JSON
A typical request will include the method name, parameters (if any), and a unique identifier for the request. The response will include the result or an error message.
Example Request:
{
"jsonrpc": "2.0",
"id": "0",
"method": "<RPC method>",
"params": {
// Parameters (if any)
}
}
Example Response:
{
"jsonrpc": "2.0",
"id": "0",
"result": {
// Result data
},
"error": {
// Error details (if any)
}
}
Available RPC Commands
Get Info
Description: Retrieves general information about the Salvium node, including the version, network status, and block height.
Request:
- Method:
get_info
- Parameters: None
Response:
{
"version": "<version>",
"status": "<status>",
"height": <block_height>,
"target_height": <target_block_height>,
"difficulty": <difficulty>,
"hashrate": <hashrate>,
"tx_count": <tx_count>,
"tx_pool_size": <tx_pool_size>,
"incoming_connections_count": <incoming_connections>,
"outgoing_connections_count": <outgoing_connections>,
"white_peerlist_size": <white_peerlist_size>
}
Get Block Count
Description: Returns the total number of blocks in the blockchain.
Request:
- Method:
get_block_count
- Parameters: None
Response:
{
"count": <block_count>,
"status": "<status>"
}
Get Block Hash
Description: Returns the hash of a specific block.
Request:
- Method:
get_block_hash
- Parameters: An array containing the block height.
Response:
{
"hash": "<block_hash>"
}
New Methods Specific to Salvium
Get Supply Info
Description: Returns information about the total supply of assets in the Salvium blockchain.
Request:
- Method:
get_supply_info
- Parameters: None
Response:
{
"supply": {
"total_supply": <total_supply>,
"circulating_supply": <circulating_supply>,
"max_supply": <max_supply>
},
"status": "<status>"
}
Get Yield Info
Description: Returns information about the yield generated by staking or other yield-generating activities in the Salvium blockchain.
Request:
- Method:
get_yield_info
- Parameters: None
Response:
{
"yield": {
"total_yield": <total_yield>,
"average_yield_rate": <average_yield_rate>,
"yield_distribution": [
{
"asset_type": "<asset_type>",
"yield_amount": <yield_amount>
}
]
},
"status": "<status>"
}
Get Output Distribution
Description: Returns the distribution of outputs by amounts, including the asset type for ring confidential transactions (RCT).
Request:
- Method:
get_output_distribution
- Parameters: Object containing “amounts”, “from_height”, “to_height”, “cumulative”, and “rct_asset_type”.
Response:
{
"distributions": [
{
"amount": <amount>,
"distribution": [ /* distribution array */ ],
"base": <base_height>,
"rct_asset_type": "<rct_asset_type>"
}
],
"status": "<status>"
}
Get Blocks Fast
Description: Retrieves blocks in a more optimized manner, including the indices of per-asset output types.
Request:
- Method:
get_blocks_fast
- Parameters: Object containing “block_ids”, “start_height”, “prune”, “no_miner_tx”, and “include_raw_data”.
Response:
{
"blocks": [
{
"block": "<block_data>",
"txs": [ /* array of transactions */ ],
"output_indices": [
{
"asset_type": "<asset_type>",
"indices": [ /* output indices per asset type */ ]
}
],
"include_raw_data": <boolean>
}
],
"status": "<status>"
}
Send Raw Transaction
Description: Submits a raw transaction to the network. This command has been extended to include the source asset type.
Request:
- Method:
send_raw_tx
- Parameters: Object containing “tx_as_hex”, “do_not_relay”, and “source_asset_type”.
Response:
{
"status": "<status>",
"tx_hash": "<transaction_hash>"
}