To make a JSON-RPC request, send an HTTP POST request with a Content-Type: application/json header. The JSON request data should contain 4 fields:
jsonrpc: <string>, set to "2.0"
id: <number>, a unique client-generated identifying integer
method: <string>, a string containing the method to be invoked
params: <array>, a JSON array of ordered parameter values
The response output will be a JSON object with the following fields:
jsonrpc: <string>, matching the request specification
id: <number>, matching the request identifier
result: <array|number|object|string>, requested data or success confirmation
Requests can be sent in batches by sending an array of JSON-RPC request objects as the data for a single POST.
Definitions
Hash: A SHA-256 hash of a chunk of data.
Pubkey: The public key of a Ed25519 key-pair.
Transaction: A list of PUT instructions signed by a client keypair to authorize those actions.
Signature: An Ed25519 signature of transaction's payload data including instructions. This can be used to identify transactions.
Configuring State Commitment
For preflight checks and transaction processing, PUT nodes choose which bank state to query based on a commitment requirement set by the client. The commitment describes how finalized a block is at that point in time. When querying the ledger state, it's recommended to use lower levels of commitment to report progress and higher levels to ensure the state will not be rolled back.
In descending order of commitment (most finalized to least finalized), clients may specify:
"finalized" - the node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized
"confirmed" - the node will query the most recent block that has been voted on by supermajority of the cluster.
It incorporates votes from gossip and replay.
It does not count votes on descendants of a block, only direct votes on that block.
This confirmation level also upholds "optimistic confirmation" guarantees in release 1.3 and onwards.
"processed" - the node will query its most recent block. Note that the block may still be skipped by the cluster.
For processing many dependent transactions in series, it's recommended to use "confirmed" commitment, which balances speed with rollback safety. For total safety, it's recommended to use"finalized" commitment.
Example#
The commitment parameter should be included as the last element in the params array:
If commitment configuration is not provided, the node will default to "finalized" commitment
Only methods that query bank state accept the commitment parameter. They are indicated in the API Reference below.
RpcResponse Structure#
Many methods that take a commitment parameter return an RpcResponse JSON object comprised of two parts:
context : An RpcResponseContext JSON structure including a slot field at which the operation was evaluated.
value : The value returned by the operation itself.
Parsed Responses#
Some methods support an encoding parameter, and can return account or instruction data in parsed JSON format if "encoding":"jsonParsed" is requested and the node has a parser for the owning program. PUT nodes currently support JSON parsing for the following native and SPL programs:
The list of account parsers can be found here, and instruction parsers here.
Health Check
Although not a JSON RPC API, a GET /health at the RPC HTTP Endpoint provides a health-check mechanism for use by load balancers or other network infrastructure. This request will always return a HTTP 200 OK response with a body of "ok", "behind" or "unknown" based on the following conditions:
If one or more --known-validator arguments are provided to put-validator, "ok" is returned when the node has within HEALTH_CHECK_SLOT_DISTANCE slots of the highest known validator, otherwise "behind". "unknown" is returned when no slot information from known validators is not yet available.
"ok" is always returned if no known validators are provided.
JSON RPC API Reference#
getAccountInfo
Returns all information associated with the account of provided Pubkey
Parameters:#
<string> - Pubkey of account to query, as base-58 encoded string
(optional) <object> - Configuration object containing the following fields:
(optional) commitment: <string> - Commitment
(optional) encoding: <string> - encoding for Account data, either "base58" (slow), "base64", "base64+zstd", or "jsonParsed". "base58" is limited to Account data of less than 129 bytes. "base64" will return base64 encoded data for Account data of any size. "base64+zstd" compresses the Account data using Zstandard and base64-encodes the result. "jsonParsed" encoding attempts to use program-specific state parsers to return more human-readable and explicit account state data. If "jsonParsed" is requested but a parser cannot be found, the field falls back to "base64" encoding, detectable when the data field is type <string>.
(optional) dataSlice: <object> - limit the returned account data using the provided offset: <usize> and length: <usize> fields; only available for "base58", "base64" or "base64+zstd" encodings.
(optional) minContextSlot: <number> - set the minimum slot that the request can be evaluated at.
Results:#
The result will be an RpcResponse JSON object with value equal to:
<null> - if the requested account doesn't exist
<object> - otherwise, a JSON object containing:
lamports: <u64>, number of lamports assigned to this account, as a u64
owner: <string>, base-58 encoded Pubkey of the program this account has been assigned to
data: <[string, encoding]|object>, data associated with the account, either as encoded binary data or JSON format {<program>: <state>}, depending on encoding parameter
executable: <bool>, boolean indicating if the account contains a program (and is strictly read-only)
rentEpoch: <u64>, the epoch at which this account will next owe rent, as u64
Returns the balance of the account of provided Pubkey Parameters:#
<string> - Pubkey of account to query, as base-58 encoded string
(optional) <object> - Configuration object containing the following fields:
(optional) commitment: <string> - Commitment
(optional) minContextSlot: <number> - set the minimum slot that the request can be evaluated at.
Results:#
RpcResponse<u64> - RpcResponse JSON object with value field set to the balance
Returns identity and transaction information about a confirmed block in the ledger Parameters:#
<u64> - slot, as u64 integer
(optional) <object> - Configuration object containing the following optional fields:
(optional) encoding: <string> - encoding for each returned Transaction, either "json", "jsonParsed", "base58" (slow), "base64". If parameter not provided, the default encoding is "json". "jsonParsed" encoding attempts to use program-specific instruction parsers to return more human-readable and explicit data in the transaction.message.instructions list. If "jsonParsed" is requested but a parser cannot be found, the instruction falls back to regular JSON encoding (accounts, data, and programIdIndex fields).
(optional) transactionDetails: <string> - level of transaction detail to return, either "full", "accounts", "signatures", or "none". If parameter not provided, the default detail level is "full". If "accounts" are requested, transaction details only include signatures and an annotated list of accounts in each transaction. Transaction metadata is limited to only: fee, err, pre_balances, post_balances, pre_token_balances, and post_token_balances.
(optional) rewards: bool - whether to populate the rewards array. If parameter not provided, the default includes rewards.
(optional) commitment: <string> - Commitment; "processed" is not supported. If parameter not provided, the default is "finalized".
(optional) maxSupportedTransactionVersion: <number> - set the max transaction version to return in responses. If the requested block contains a transaction with a higher version, an error will be returned. If this parameter is omitted, only legacy transactions will be returned, and a block containing any versioned transaction will prompt the error.
Results:#
The result field will be an object with the following fields:
<null> - if specified block is not confirmed
<object> - if block is confirmed, an object with the following fields:
blockhash: <string> - the blockhash of this block, as base-58 encoded string
previousBlockhash: <string> - the blockhash of this block's parent, as base-58 encoded string; if the parent block is not available due to ledger cleanup, this field will return "11111111111111111111111111111111"
parentSlot: <u64> - the slot index of this block's parent
transactions: <array> - present if "full" transaction details are requested; an array of JSON objects containing:
transaction: <object|[string,encoding]> - Transaction object, either in JSON format or encoded binary data, depending on encoding parameter
meta: <object> - transaction status metadata object, containing null or:
err: <object|null> - Error if transaction failed, null if transaction succeeded. TransactionError definitions
fee: <u64> - fee this transaction was charged, as u64 integer
preBalances: <array> - array of u64 account balances from before the transaction was processed
postBalances: <array> - array of u64 account balances after the transaction was processed
innerInstructions: <array|null> - List of inner instructions or null if inner instruction recording was not enabled during this transaction
preTokenBalances: <array|undefined> - List of token balances from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction
postTokenBalances: <array|undefined> - List of token balances from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction
logMessages: <array|null> - array of string log messages or null if log message recording was not enabled during this transaction
rewards: <array|null> - transaction-level rewards, populated if rewards are requested; an array of JSON objects containing:
pubkey: <string> - The public key, as base-58 encoded string, of the account that received the reward
lamports: <i64>- number of reward lamports credited or debited by the account, as a i64
postBalance: <u64> - account balance in lamports after the reward was applied
rewardType: <string|undefined> - type of reward: "fee", "rent", "voting", "staking"
commission: <u8|undefined> - vote account commission when the reward was credited, only present for voting and staking rewards
DEPRECATED: status: <object> - Transaction status
"Ok": <null> - Transaction was successful
"Err": <ERR> - Transaction failed with TransactionError
loadedAddresses: <object|undefined> - Transaction addresses loaded from address lookup tables. Undefined if maxSupportedTransactionVersion is not set in request params.
writable: <array[string]> - Ordered list of base-58 encoded addresses for writable loaded accounts
readonly: <array[string]> - Ordered list of base-58 encoded addresses for readonly loaded accounts
returnData: <object|undefined> - the most-recent return data generated by an instruction in the transaction, with the following fields:
programId: <string>, the program that generated the return data, as base-58 encoded Pubkey
data: <[string, encoding]>, the return data itself, as base-64 encoded binary data
computeUnitsConsumed: <u64|undefined>, number of compute units consumed by the transaction
version: <"legacy"|number|undefined> - Transaction version. Undefined if maxSupportedTransactionVersion is not set in request params.
signatures: <array> - present if "signatures" are requested for transaction details; an array of signatures strings, corresponding to the transaction order in the block
rewards: <array|undefined> - block-level rewards, present if rewards are requested; an array of JSON objects containing:
pubkey: <string> - The public key, as base-58 encoded string, of the account that received the reward
lamports: <i64>- number of reward lamports credited or debited by the account, as a i64
postBalance: <u64> - account balance in lamports after the reward was applied
rewardType: <string|undefined> - type of reward: "fee", "rent", "voting", "staking"
commission: <u8|undefined> - vote account commission when the reward was credited, only present for voting and staking rewards
blockTime: <i64|null> - estimated production time, as Unix timestamp (seconds since the Unix epoch). null if not available
blockHeight: <u64|null> - the number of blocks beneath this block
Transactions are quite different from those on other blockchains. Be sure to review Anatomy of a Transaction to learn about transactions on PUT.
The JSON structure of a transaction is defined as follows:
signatures: <array[string]> - A list of base-58 encoded signatures applied to the transaction. The list is always of length message.header.numRequiredSignatures and not empty. The signature at index i corresponds to the public key at index i in message.accountKeys. The first one is used as the transaction id.
message: <object> - Defines the content of the transaction.
accountKeys: <array[string]> - List of base-58 encoded public keys used by the transaction, including by the instructions and for signatures. The first message.header.numRequiredSignatures public keys must sign the transaction.
header: <object> - Details the account types and signatures required by the transaction.
numRequiredSignatures: <number> - The total number of signatures required to make the transaction valid. The signatures must match the first numRequiredSignatures of message.accountKeys.
numReadonlySignedAccounts: <number> - The last numReadonlySignedAccounts of the signed keys are read-only accounts. Programs may process multiple transactions that load read-only accounts within a single PoH entry, but are not permitted to credit or debit lamports or modify account data. Transactions targeting the same read-write account are evaluated sequentially.
numReadonlyUnsignedAccounts: <number> - The last numReadonlyUnsignedAccounts of the unsigned keys are read-only accounts.
recentBlockhash: <string> - A base-58 encoded hash of a recent block in the ledger used to prevent transaction duplication and to give transactions lifetimes.
instructions: <array[object]> - List of program instructions that will be executed in sequence and committed in one atomic transaction if all succeed.
programIdIndex: <number> - Index into the message.accountKeys array indicating the program account that executes this instruction.
accounts: <array[number]> - List of ordered indices into the message.accountKeys array indicating which accounts to pass to the program.
data: <string> - The program input data encoded in a base-58 string.
addressTableLookups: <array[object]|undefined> - List of address table lookups used by a transaction to dynamically load addresses from on-chain address lookup tables. Undefined if maxSupportedTransactionVersion is not set.
accountKey: <string> - base-58 encoded public key for an address lookup table account.
writableIndexes: <array[number]> - List of indices used to load addresses of writable accounts from a lookup table.
readonlyIndexes: <array[number]> - List of indices used to load addresses of readonly accounts from a lookup table.
Inner Instructions Structure#
The PUT runtime records the cross-program instructions that are invoked during transaction processing and makes these available for greater transparency of what was executed on-chain per transaction instruction. Invoked instructions are grouped by the originating transaction instruction and are listed in order of processing.
The JSON structure of inner instructions is defined as a list of objects in the following structure:
index: number - Index of the transaction instruction from which the inner instruction(s) originated
instructions: <array[object]> - Ordered list of inner program instructions that were invoked during a single transaction instruction.
programIdIndex: <number> - Index into the message.accountKeys array indicating the program account that executes this instruction.
accounts: <array[number]> - List of ordered indices into the message.accountKeys array indicating which accounts to pass to the program.
data: <string> - The program input data encoded in a base-58 string.
Token Balances Structure#
The JSON structure of token balances is defined as a list of objects in the following structure:
accountIndex: <number> - Index of the account in which the token balance is provided for.
mint: <string> - Pubkey of the token's mint.
owner: <string|undefined> - Pubkey of token balance's owner.
programId: <string|undefined> - Pubkey of the Token program that owns the account.
uiTokenAmount: <object> -
amount: <string> - Raw amount of tokens as a string, ignoring decimals.
decimals: <number> - Number of decimals configured for token's mint.
uiAmount: <number|null> - Token amount as a float, accounting for decimals. DEPRECATED
uiAmountString: <string> - Token amount as a string, accounting for decimals.
getBlockHeight
Returns the current block height of the node Parameters:#
(optional) <object> - Configuration object containing the following fields:
(optional) commitment: <string> - Commitment
(optional) minContextSlot: <number> - set the minimum slot that the request can be evaluated at.
Returns recent block production information from the current or previous epoch.
Parameters:#
(optional) <object> - Configuration object containing the following optional fields:
(optional) commitment: <string> - Commitment
(optional) range: <object> - Slot range to return block production for. If parameter not provided, defaults to current epoch.
firstSlot: <u64> - first slot to return block production information for (inclusive)
(optional) lastSlot: <u64> - last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot
(optional) identity: <string> - Only return results for this validator identity (base-58 encoded)
Results:#
The result will be an RpcResponse JSON object with value equal to:
<object>
byIdentity: <object> - a dictionary of validator identities, as base-58 encoded strings. Value is a two element array containing the number of leader slots and the number of blocks produced.
range: <object> - Block production slot range
firstSlot: <u64> - first slot of the block production information (inclusive)
lastSlot: <u64> - last slot of block production information (inclusive)
Returns commitment for particular block Parameters:#
<u64> - block, identified by Slot
Results:#
The result field will be a JSON object containing:
commitment - commitment, comprising either:
<null> - Unknown block
<array> - commitment, array of u64 integers logging the amount of cluster stake in lamports that has voted on the block at each depth from 0 to MAX_LOCKOUT_HISTORY + 1
totalStake - total active stake, in lamports, of the current epoch
Returns a list of confirmed blocks between two slots
Parameters:#
<u64> - start_slot, as u64 integer
(optional) <u64> - end_slot, as u64 integer (must be no more than 500,000 blocks higher than the start_slot)
(optional) <object> - Configuration object containing the following field:
(optional) commitment: <string> - Commitment; "processed" is not supported. If parameter not provided, the default is "finalized".
Results:#
The result field will be an array of u64 integers listing confirmed blocks between start_slot and either end_slot, if provided, or latest confirmed block, inclusive. Max range allowed is 500,000 slots.
Returns a list of confirmed blocks starting at the given slot
Parameters:#
<u64> - start_slot, as u64 integer
<u64> - limit, as u64 integer (must be no more than 500,000 blocks higher than the start_slot)
(optional) <object> - Configuration object containing the following field:
(optional) commitment: <string> - Commitment; "processed" is not supported. If parameter not provided, the default is "finalized".
Results:#
The result field will be an array of u64 integers listing confirmed blocks starting at start_slot for up to limit blocks, inclusive.
Each validator reports their UTC time to the ledger on a regular interval by intermittently adding a timestamp to a Vote for a particular block. A requested block's time is calculated from the stake-weighted mean of the Vote timestamps in a set of recent blocks recorded on the ledger.
Parameters:#
<u64> - block, identified by Slot
Results:#
<i64> - estimated production time, as Unix timestamp (seconds since the Unix epoch)
<null> - timestamp is not available for this block
Returns information about all the nodes participating in the cluster
Parameters:#
None
Results:#
The result field will be an array of JSON objects, each with the following sub fields:
pubkey: <string> - Node public key, as base-58 encoded string
gossip: <string|null> - Gossip network address for the node
tpu: <string|null> - TPU network address for the node
rpc: <string|null> - JSON RPC network address for the node, or null if the JSON RPC service is not enabled
version: <string|null> - The software version of the node, or null if the version information is not available
featureSet: <u32|null > - The unique identifier of the node's feature set
shredVersion: <u16|null> - The shred version the node has been configured to use
(optional) <object> - Configuration object containing the following fields:
(optional) commitment: <string> - Commitment
(optional) minContextSlot: <number> - set the minimum slot that the request can be evaluated at.
Results:#
The result field will be an object with the following fields:
absoluteSlot: <u64>, the current slot
blockHeight: <u64>, the current block height
epoch: <u64>, the current epoch
slotIndex: <u64>, the current slot relative to the start of the current epoch
slotsInEpoch: <u64>, the number of slots in this epoch
transactionCount: <u64|null>, total number of transactions processed without error since genesis
(optional) <object> - Configuration object containing the following fields:
(optional) commitment: <string> - Commitment
(optional) minContextSlot: <number> - set the minimum slot that the request can be evaluated at.
Results:#
The result field will be an object with the following fields:
absoluteSlot: <u64>, the current slot
blockHeight: <u64>, the current block height
epoch: <u64>, the current epoch
slotIndex: <u64>, the current slot relative to the start of the current epoch
slotsInEpoch: <u64>, the number of slots in this epoch
transactionCount: <u64|null>, total number of transactions processed without error since genesis
Returns epoch schedule information from this cluster's genesis config
Parameters:#
None
Results:#
The result field will be an object with the following fields:
slotsPerEpoch: <u64>, the maximum number of slots in each epoch
leaderScheduleSlotOffset: <u64>, the number of slots before beginning of an epoch to calculate a leader schedule for that epoch
warmup: <bool>, whether epochs start short and grow
firstNormalEpoch: <u64>, first normal-length epoch, log2(slotsPerEpoch) - log2(MINIMUM_SLOTS_PER_EPOCH)
firstNormalSlot: <u64>, MINIMUM_SLOTS_PER_EPOCH * (2.pow(firstNormalEpoch) - 1)
NEW: This method is only available in put-core v1.9 or newer. Please use getFees for put-core v1.8
Get the fee the network will charge for a particular Message
Parameters:#
message: <string> - Base-64 encoded Message
(optional) <object> - Configuration object containing the following optional fields:
(optional) commitment: <string> - Commitment (used for retrieving blockhash)
(optional) minContextSlot: <number> - set the minimum slot that the request can be evaluated at.
Results:#
<u64|null> - Fee corresponding to the message at the specified blockhash
If one or more --known-validator arguments are provided to put-validator, "ok" is returned when the node has within HEALTH_CHECK_SLOT_DISTANCE slots of the highest known validator, otherwise an error is returned. "ok" is always returned if no known validators are provided.
Parameters:#
None
Results:#
If the node is healthy: "ok" If the node is unhealthy, a JSON RPC error response is returned. The specifics of the error response are UNSTABLE and may change in the future
(optional) <object> - Configuration object containing the following field:
(optional) commitment: <string> - Commitment
Results:#
The result field will be a JSON object with the following fields:
initial: <f64>, the initial inflation percentage from time 0
terminal: <f64>, terminal inflation percentage
taper: <f64>, rate per year at which inflation is lowered. Rate reduction is derived using the target slot time in genesis config
foundation: <f64>, percentage of total inflation allocated to the foundation
foundationTerm: <f64>, duration of foundation pool inflation in years
Returns the specific inflation values for the current epoch
Parameters:#
None
Results:#
The result field will be a JSON object with the following fields:
total: <f64>, total inflation
validator: <f64>, inflation allocated to validators
foundation: <f64>, inflation allocated to the foundation
epoch: <u64>, epoch for which these values are valid
Returns the inflation / staking reward for a list of addresses for an epoch
Parameters:#
<array> - An array of addresses to query, as base-58 encoded strings
(optional) <object> - Configuration object containing the following fields:
(optional) commitment: <string> - Commitment
(optional) epoch: <u64> - An epoch for which the reward occurs. If omitted, the previous epoch will be used
(optional) minContextSlot: <number> - set the minimum slot that the request can be evaluated at.
Results#
The result field will be a JSON array with the following fields:
epoch: <u64>, epoch for which reward occured
effectiveSlot: <u64>, the slot in which the rewards are effective
amount: <u64>, reward amount in lamports
postBalance: <u64>, post balance of the account in lamports
commission: <u8|undefined> - vote account commission when the reward was credited
Returns the 20 largest accounts, by lamport balance (results may be cached up to two hours)
Parameters:#
(optional) <object> - Configuration object containing the following optional fields:
(optional) commitment: <string> - Commitment
(optional) filter: <string> - filter results by account type; currently supported: circulating|nonCirculating
Results:#
The result will be an RpcResponse JSON object with value equal to an array of:
<object> - otherwise, a JSON object containing:
address: <string>, base-58 encoded address of the account
lamports: <u64>, number of lamports in the account, as a u64
NEW: This method is only available in put-core v1.9 or newer. Please use getRecentBlockhash for put-core v1.8
Returns the latest blockhash Parameters:#
(optional) <object> - Configuration object containing the following fields:
(optional) commitment: <string> - Commitment (used for retrieving blockhash)
(optional) minContextSlot: <number> - set the minimum slot that the request can be evaluated at.
Results:#
RpcResponse<object> - RpcResponse JSON object with value field set to a JSON object including:
blockhash: <string> - a Hash as base-58 encoded string
lastValidBlockHeight: <u64> - last block height at which the blockhash will be valid
Returns the leader schedule for an epoch Parameters:#
(optional) <u64> - Fetch the leader schedule for the epoch that corresponds to the provided slot. If unspecified, the leader schedule for the current epoch is fetched
(optional) <object> - Configuration object containing the following field:
(optional) commitment: <string> - Commitment
(optional) identity: <string> - Only return results for this validator identity (base-58 encoded)
Results:#
<null> - if requested epoch is not found
<object> - otherwise, the result field will be a dictionary of validator identities, as base-58 encoded strings, and their corresponding leader slot indices as values (indices are relative to the first slot in the requested epoch)