Version 1.0.1
.
RPC methods controlling the node.
Order the node to shutdown.
Parameters:
{}
Returns:
nothing
Get node software version.
Parameters:
{}
Returns:
string
Set mock time for the node.
The value 0 is equivalent to "Nothing", making the node use real, wall-clock time. WARNING: This function is strictly used for testing purposes. Using it will obstruct normal node functionality.
Parameters:
{ "time": number }
Returns:
nothing
Get the best block ID, which is the tip of the blockchain (i.e., longest chain, or mainchain).
Parameters:
{}
Returns:
hex string
Get block ID at a given height in the mainchain.
Returns None
(null) if the block at the given height does not exist.
Parameters:
{ "height": number }
Returns:
EITHER OF
1) hex string
2) null
Returns a hex-encoded serialized block with the given id.
Returns None
(null) if a block with the given id is not found.
Note that genesis cannot be retrieved with this function.
Parameters:
{ "id": hex string }
Returns:
EITHER OF
1) hex string
2) null
Same as get_block, but returns the block information in json format.
Parameters:
{ "id": hex string }
Returns:
EITHER OF
1) json
2) null
Returns hex-encoded serialized blocks from the mainchain starting from a given block height.
The number of returned blocks can be capped using the max_count
parameter.
Parameters:
{
"from": number,
"max_count": number,
}
Returns:
[ hex string, .. ]
Returns mainchain block ids with heights in the range start_height..end_height using the given step;
Parameters:
{
"start_height": number,
"end_height": number,
"step": non-zero number,
}
Returns:
[ [
number,
hex string,
], .. ]
Returns the TxOutput for a specified UtxoOutPoint.
Returns None
(null) if the UtxoOutPoint is not found or is already spent.
Parameters:
{ "outpoint": {
"source_id": EITHER OF
1) {
"type": "Transaction",
"content": { "tx_id": hex string },
}
2) {
"type": "BlockReward",
"content": { "block_id": hex string },
},
"index": number,
} }
Returns:
EITHER OF
1) object
2) null
Submit a block to be included in the blockchain.
Note that the submission does not circumvent any validation process. This function is used by the wallet to submit valid blocks after successful staking.
Parameters:
{ "block_hex": hex string }
Returns:
nothing
Invalidate the specified block and its descendants.
Use this function with caution, as invalidating a block that the network approves of can lead to staying behind.
Parameters:
{ "id": hex string }
Returns:
nothing
Reset failure flags for the specified block and its descendants.
Parameters:
{ "id": hex string }
Returns:
nothing
Get block height in mainchain, given a block id.
Parameters:
{ "block_id": hex string }
Returns:
EITHER OF
1) number
2) null
Get best block height in mainchain.
Parameters:
{}
Returns:
number
Returns last common block id and height of two chains. Returns None if no blocks are found and therefore the last common ancestor is unknown.
Parameters:
{
"first_block": hex string,
"second_block": hex string,
}
Returns:
EITHER OF
1) [
hex string,
number,
]
2) null
Returns the balance of the pool associated with the given pool id.
The balance contains both delegated balance and staker balance.
Returns None
(null) if the pool is not found.
Parameters:
{ "pool_address": string }
Returns:
EITHER OF
1) { "atoms": number string }
2) null
Returns the balance of the staker (pool owner) of the pool associated with the given pool address.
This excludes the delegation balances.
Returns None
(null) if the pool is not found.
Parameters:
{ "pool_address": string }
Returns:
EITHER OF
1) { "atoms": number string }
2) null
Given a pool defined by a pool address, and a delegation address, returns the amount of coins owned by that delegation in that pool.
Parameters:
{
"pool_address": string,
"delegation_address": string,
}
Returns:
EITHER OF
1) { "atoms": number string }
2) null
Get token information, given a token id, in address form.
Parameters:
{ "token_id": string }
Returns:
EITHER OF
1) {
"type": "FungibleToken",
"content": {
"token_id": hex string,
"token_ticker": {
"text": EITHER OF
1) string
2) null,
"hex": hex string,
},
"number_of_decimals": number,
"metadata_uri": {
"text": EITHER OF
1) string
2) null,
"hex": hex string,
},
"circulating_supply": { "atoms": number string },
"total_supply": EITHER OF
1) {
"type": "Fixed",
"content": { "amount": { "atoms": number string } },
}
2) { "type": "Lockable" }
3) { "type": "Unlimited" },
"is_locked": bool,
"frozen": EITHER OF
1) {
"type": "NotFrozen",
"content": { "freezable": bool },
}
2) {
"type": "Frozen",
"content": { "unfreezable": bool },
},
"authority": bech32 string,
},
}
2) {
"type": "NonFungibleToken",
"content": {
"token_id": hex string,
"creation_tx_id": hex string,
"creation_block_id": hex string,
"metadata": {
"creator": EITHER OF
1) hex string
2) null,
"name": {
"text": EITHER OF
1) string
2) null,
"hex": hex string,
},
"description": {
"text": EITHER OF
1) string
2) null,
"hex": hex string,
},
"ticker": {
"text": EITHER OF
1) string
2) null,
"hex": hex string,
},
"icon_uri": EITHER OF
1) {
"text": EITHER OF
1) string
2) null,
"hex": hex string,
}
2) null,
"additional_metadata_uri": EITHER OF
1) {
"text": EITHER OF
1) string
2) null,
"hex": hex string,
}
2) null,
"media_uri": EITHER OF
1) {
"text": EITHER OF
1) string
2) null,
"hex": hex string,
}
2) null,
"media_hash": hex string,
},
},
}
3) null
Get order information, given an order id, in address form.
Parameters:
{ "order_id": string }
Returns:
EITHER OF
1) {
"conclude_key": bech32 string,
"initially_asked": EITHER OF
1) {
"type": "Coin",
"content": { "amount": { "atoms": number string } },
}
2) {
"type": "Token",
"content": {
"id": hex string,
"amount": { "atoms": number string },
},
},
"initially_given": EITHER OF
1) {
"type": "Coin",
"content": { "amount": { "atoms": number string } },
}
2) {
"type": "Token",
"content": {
"id": hex string,
"amount": { "atoms": number string },
},
},
"give_balance": { "atoms": number string },
"ask_balance": { "atoms": number string },
"nonce": EITHER OF
1) number
2) null,
}
2) null
Exports a "bootstrap file", which contains all blocks
Parameters:
{
"file_path": string,
"include_orphans": bool,
}
Returns:
nothing
Imports a bootstrap file's blocks to this node
Parameters:
{ "file_path": string }
Returns:
nothing
Return generic information about the chain, including the current best block, best block height and more.
Parameters:
{}
Returns:
{
"best_block_height": number,
"best_block_id": hex string,
"best_block_timestamp": { "timestamp": number },
"median_time": { "timestamp": number },
"is_initial_block_download": bool,
}
Subscribe to chainstate events, such as new tip.
After a successful subscription, the node will message the subscriber with a message on every event.
Parameters:
{}
Produces:
{
"type": "NewTip",
"content": {
"id": hex string,
"height": number,
},
}
Unsubscribe using chainstate_unsubscribe_to_events
.
Note: Subscriptions only work over WebSockets.
Returns True if a transaction defined by the given id is found in the mempool.
Parameters:
{ "tx_id": hex string }
Returns:
bool
Returns True if a transaction defined by the given id is found in the mempool's orphans.
An orphan transaction is a transaction with one or more inputs, whose utxos cannot be found.
Parameters:
{ "tx_id": hex string }
Returns:
bool
Returns the transaction defined by the provided id, given that it is in the pool.
The returned transaction is returned in an object that contains more information about the transaction.
Returns None
(null) if the transaction is not found.
Parameters:
{ "tx_id": hex string }
Returns:
EITHER OF
1) {
"id": hex string,
"status": EITHER OF
1) "InMempool"
2) "InMempoolDuplicate"
3) "InOrphanPool"
4) "InOrphanPoolDuplicate",
"transaction": hex string,
}
2) null
Get all mempool transactions in a Vec/List, with hex-encoding.
Notice that this call may be expensive. Use it with caution. This function is mostly used for testing purposes.
Parameters:
{}
Returns:
[ hex string, .. ]
Submit a transaction to the mempool.
Note that submitting a transaction to the mempool does not guarantee broadcasting it. Use the p2p rpc interface for that.
Parameters:
{
"tx": hex string,
"options": { "trust_policy": EITHER OF
1) "Trusted"
2) "Untrusted" },
}
Returns:
nothing
Return the id of the best block, as seen by the mempool.
Typically this agrees with chainstate, but there could be some delay in responding to chainstate.
Parameters:
{}
Returns:
hex string
The total estimated used memory by the mempool.
Parameters:
{}
Returns:
number
Get the maximum allowed size of all transactions in the mempool.
Parameters:
{}
Returns:
number
Set the maximum allowed size of all transactions in the mempool.
The parameter is either a string, can be written with proper units, such as "100 MB", or "500 KB", or an integer taken as bytes.
Parameters:
{ "max_size": String with units, such as MB/KB/GB, or integer for bytes }
Returns:
nothing
Get the current fee rate of the mempool, that puts the transaction in the top X MBs of the mempool. X, in this description, is provided as a parameter.
Parameters:
{ "in_top_x_mb": number }
Returns:
{ "amount_per_kb": { "atoms": number string } }
Get the curve data points that represent the fee rate as a function of transaction size.
Parameters:
{}
Returns:
[ [
number,
{ "amount_per_kb": { "atoms": number string } },
], .. ]
Subscribe to mempool events, such as tx processed.
After a successful subscription, the node will message the subscriber with a message on every event.
Parameters:
{}
Produces:
EITHER OF
1) {
"type": "NewTip",
"content": {
"id": hex string,
"height": number,
},
}
2) {
"type": "TransactionProcessed",
"content": {
"tx_id": hex string,
"origin": EITHER OF
1) {
"type": "Local",
"content": { "origin": EITHER OF
1) { "type": "Mempool" }
2) { "type": "P2p" }
3) { "type": "PastBlock" } },
}
2) {
"type": "Remote",
"content": { "peer_id": number },
},
"relay": EITHER OF
1) { "type": "DoRelay" }
2) { "type": "DontRelay" },
"successful": bool,
},
}
Unsubscribe using mempool_unsubscribe_to_events
.
Note: Subscriptions only work over WebSockets.
Enable or disable networking
Parameters:
{ "enable": bool }
Returns:
nothing
Attempt to connect to a remote node (just once).
For persistent connections see add_reserved_node
should be used.
Keep in mind that add_reserved_node
works completely differently.
Parameters:
{ "addr": string }
Returns:
nothing
Disconnect peer, given its id.
Parameters:
{ "peer_id": number }
Returns:
nothing
List banned peers and their ban expiry time.
Parameters:
{}
Returns:
[ [
string,
{ "time": [
secs number,
nanos number,
] },
], .. ]
Ban a peer by their address for a given amount of time.
Parameters:
{
"address": string,
"duration": [
secs number,
nanos number,
],
}
Returns:
nothing
Unban a banned peer by their IP address.
Parameters:
{ "address": string }
Returns:
nothing
List peers that have been discouraged.
Discouragement is similar to banning, except that inbound connections from such peers are still allowed.
Peers are discouraged automatically if they misbehave.
Parameters:
{}
Returns:
[ [
string,
{ "time": [
secs number,
nanos number,
] },
], .. ]
Undiscourage a previously discouraged peer by their IP address.
Parameters:
{ "address": string }
Returns:
nothing
Get the number of peers connected to this node.
Parameters:
{}
Returns:
number
Get p2p bind address(es) of this node.
Parameters:
{}
Returns:
[ string, .. ]
Get details of connected peers.
Parameters:
{}
Returns:
[ {
"peer_id": number,
"address": string,
"peer_role": EITHER OF
1) "Inbound"
2) "OutboundFullRelay"
3) "OutboundBlockRelay"
4) "OutboundReserved"
5) "OutboundManual"
6) "Feeler",
"ban_score": number,
"user_agent": string,
"software_version": string,
"ping_wait": EITHER OF
1) number
2) null,
"ping_last": EITHER OF
1) number
2) null,
"ping_min": EITHER OF
1) number
2) null,
}, .. ]
Get addresses of reserved nodes.
Parameters:
{}
Returns:
[ string, .. ]
Add the address to the reserved nodes list.
The node will try to keep connections open to all reserved peers. A reserved peer is a peer that you trust and you want your node to remain connected to, no matter what they do.
Parameters:
{ "addr": string }
Returns:
nothing
Remove the address from the reserved nodes list.
Existing connection to the peer is not closed.
Parameters:
{ "addr": string }
Returns:
nothing
Submits a transaction to mempool, and if it is valid, broadcasts it to the network as well.
Parameters:
{
"tx": hex string,
"options": { "trust_policy": EITHER OF
1) "Trusted"
2) "Untrusted" },
}
Returns:
nothing
When called, the job manager will be notified to send a signal to all currently running jobs to stop running to stop block production.
Parameters:
{}
Returns:
number
When called, the job manager will be notified to send a signal to the specified job to stop running.
Parameters:
{ "job_id": hex string }
Returns:
bool
Generate a block with the given transactions.
Parameters:
input_data
: The input data for block generation, such as staking key.transactions
: The transactions prioritized to be included in the block. Notice that it's the responsibility of the caller to ensure that the transactions are valid. If the transactions are not valid, the block will be rejected and will not be included in the blockchain. It's preferable to usetransaction_ids
instead, where the mempool will ensure that the transactions are valid against the current state of the blockchain.transaction_ids
: The transaction IDs of the transactions to be included in the block from the mempool.packing_strategy
: Whether or not to include transactions from the mempool in the block, other than the ones specified intransaction_ids
.
Parameters:
{
"input_data": hex string,
"transactions": [ hex string, .. ],
"transaction_ids": [ hex string, .. ],
"packing_strategy": EITHER OF
1) "FillSpaceFromMempool"
2) "LeaveEmptySpace",
}
Returns:
hex string
Get the public key to be used for end-to-end encryption.
Parameters:
{}
Returns:
hex string
Same as generate_block
, but with end-to-end encryption.
The end-to-end encryption helps in protecting the signing key, so that it is much harder for an eavesdropper to get it with pure http/websocket connection. The e2e_public_key is the pubic key for end-to-end encryption of the client.
Parameters:
{
"encrypted_input_data": [ number, .. ],
"e2e_public_key": hex string,
"transactions": [ hex string, .. ],
"transaction_ids": [ hex string, .. ],
"packing_strategy": EITHER OF
1) "FillSpaceFromMempool"
2) "LeaveEmptySpace",
}
Returns:
hex string
Collect the search data needed by the timestamp_searcher
module.
See timestamp_searcher::collect_timestamp_search_data
for the details about
the parameters.
Parameters:
{
"pool_id": hex string,
"min_height": number,
"max_height": EITHER OF
1) number
2) null,
"seconds_to_check_for_height": number,
"all_timestamps_between_blocks": bool,
}
Returns:
hex string