2020-07-10 22:11:07 -07:00
---
title: JSON RPC API
---
2018-08-23 10:48:50 -07:00
Solana nodes accept HTTP requests using the [JSON-RPC 2.0 ](https://www.jsonrpc.org/specification ) specification.
2020-10-14 23:47:43 -07:00
To interact with a Solana node inside a JavaScript application, use the
[solana-web3.js ](https://github.com/solana-labs/solana-web3.js ) library, which
gives a convenient interface for the RPC methods.
2018-08-23 10:48:50 -07:00
2019-09-22 20:38:34 -07:00
## RPC HTTP Endpoint
**Default port:** 8899 eg. [http://localhost:8899 ](http://localhost:8899 ), [http://192.168.1.88:8899 ](http://192.168.1.88:8899 )
## RPC PubSub WebSocket Endpoint
**Default port:** 8900 eg. ws://localhost:8900, [http://192.168.1.88:8900 ](http://192.168.1.88:8900 )
## Methods
2020-07-10 22:11:07 -07:00
- [getAccountInfo ](jsonrpc-api.md#getaccountinfo )
- [getBalance ](jsonrpc-api.md#getbalance )
- [getBlockCommitment ](jsonrpc-api.md#getblockcommitment )
- [getBlockTime ](jsonrpc-api.md#getblocktime )
- [getClusterNodes ](jsonrpc-api.md#getclusternodes )
- [getConfirmedBlock ](jsonrpc-api.md#getconfirmedblock )
- [getConfirmedBlocks ](jsonrpc-api.md#getconfirmedblocks )
2020-09-30 13:47:12 -07:00
- [getConfirmedBlocksWithLimit ](jsonrpc-api.md#getconfirmedblockswithlimit )
2020-07-10 22:11:07 -07:00
- [getConfirmedSignaturesForAddress ](jsonrpc-api.md#getconfirmedsignaturesforaddress )
2020-07-27 11:42:49 -07:00
- [getConfirmedSignaturesForAddress2 ](jsonrpc-api.md#getconfirmedsignaturesforaddress2 )
2020-07-10 22:11:07 -07:00
- [getConfirmedTransaction ](jsonrpc-api.md#getconfirmedtransaction )
- [getEpochInfo ](jsonrpc-api.md#getepochinfo )
- [getEpochSchedule ](jsonrpc-api.md#getepochschedule )
- [getFeeCalculatorForBlockhash ](jsonrpc-api.md#getfeecalculatorforblockhash )
- [getFeeRateGovernor ](jsonrpc-api.md#getfeerategovernor )
- [getFees ](jsonrpc-api.md#getfees )
- [getFirstAvailableBlock ](jsonrpc-api.md#getfirstavailableblock )
- [getGenesisHash ](jsonrpc-api.md#getgenesishash )
2021-01-14 21:45:11 -08:00
- [getHealth ](jsonrpc-api.md#gethealth )
2020-07-10 22:11:07 -07:00
- [getIdentity ](jsonrpc-api.md#getidentity )
- [getInflationGovernor ](jsonrpc-api.md#getinflationgovernor )
- [getInflationRate ](jsonrpc-api.md#getinflationrate )
- [getLargestAccounts ](jsonrpc-api.md#getlargestaccounts )
- [getLeaderSchedule ](jsonrpc-api.md#getleaderschedule )
2021-02-23 13:06:33 -08:00
- [getMaxRetransmitSlot ](jsonrpc-api.md#getmaxretransmitslot )
- [getMaxShredInsertSlot ](jsonrpc-api.md#getmaxshredinsertslot )
2020-07-10 22:11:07 -07:00
- [getMinimumBalanceForRentExemption ](jsonrpc-api.md#getminimumbalanceforrentexemption )
2020-09-03 10:35:06 -07:00
- [getMultipleAccounts ](jsonrpc-api.md#getmultipleaccounts )
2020-07-10 22:11:07 -07:00
- [getProgramAccounts ](jsonrpc-api.md#getprogramaccounts )
- [getRecentBlockhash ](jsonrpc-api.md#getrecentblockhash )
2020-10-01 22:30:49 -07:00
- [getRecentPerformanceSamples ](jsonrpc-api.md#getrecentperformancesamples )
2020-07-10 22:11:07 -07:00
- [getSignatureStatuses ](jsonrpc-api.md#getsignaturestatuses )
- [getSlot ](jsonrpc-api.md#getslot )
- [getSlotLeader ](jsonrpc-api.md#getslotleader )
- [getStakeActivation ](jsonrpc-api.md#getstakeactivation )
- [getSupply ](jsonrpc-api.md#getsupply )
2021-03-10 22:02:16 -08:00
- [getTokenAccountBalance ](jsonrpc-api.md#gettokenaccountbalance )
- [getTokenAccountsByDelegate ](jsonrpc-api.md#gettokenaccountsbydelegate )
- [getTokenAccountsByOwner ](jsonrpc-api.md#gettokenaccountsbyowner )
- [getTokenLargestAccounts ](jsonrpc-api.md#gettokenlargestaccounts )
- [getTokenSupply ](jsonrpc-api.md#gettokensupply )
2020-07-10 22:11:07 -07:00
- [getTransactionCount ](jsonrpc-api.md#gettransactioncount )
- [getVersion ](jsonrpc-api.md#getversion )
- [getVoteAccounts ](jsonrpc-api.md#getvoteaccounts )
- [minimumLedgerSlot ](jsonrpc-api.md#minimumledgerslot )
- [requestAirdrop ](jsonrpc-api.md#requestairdrop )
- [sendTransaction ](jsonrpc-api.md#sendtransaction )
- [simulateTransaction ](jsonrpc-api.md#simulatetransaction )
- [Subscription Websocket ](jsonrpc-api.md#subscription-websocket )
- [accountSubscribe ](jsonrpc-api.md#accountsubscribe )
- [accountUnsubscribe ](jsonrpc-api.md#accountunsubscribe )
2020-11-20 13:52:58 -08:00
- [logsSubscribe ](jsonrpc-api.md#logssubscribe )
- [logsUnsubscribe ](jsonrpc-api.md#logsunsubscribe )
2020-07-10 22:11:07 -07:00
- [programSubscribe ](jsonrpc-api.md#programsubscribe )
- [programUnsubscribe ](jsonrpc-api.md#programunsubscribe )
- [signatureSubscribe ](jsonrpc-api.md#signaturesubscribe )
- [signatureUnsubscribe ](jsonrpc-api.md#signatureunsubscribe )
- [slotSubscribe ](jsonrpc-api.md#slotsubscribe )
- [slotUnsubscribe ](jsonrpc-api.md#slotunsubscribe )
2019-09-22 20:38:34 -07:00
## Request Formatting
2018-08-23 10:48:50 -07:00
2020-10-14 23:47:43 -07:00
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:
2018-08-23 10:48:50 -07:00
2020-07-10 22:11:07 -07:00
- `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
2018-08-23 10:48:50 -07:00
Example using curl:
2019-09-22 20:38:34 -07:00
2018-08-23 10:48:50 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getBalance",
"params": [
"83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"
]
}
'
2018-08-23 10:48:50 -07:00
```
The response output will be a JSON object with the following fields:
2020-07-10 22:11:07 -07:00
- `jsonrpc: <string>` , matching the request specification
- `id: <number>` , matching the request identifier
- `result: <array|number|object|string>` , requested data or success confirmation
2018-08-23 10:48:50 -07:00
Requests can be sent in batches by sending an array of JSON-RPC request objects as the data for a single POST.
2019-09-22 20:38:34 -07:00
## Definitions
2018-08-23 15:40:18 -07:00
2020-07-10 22:11:07 -07:00
- Hash: A SHA-256 hash of a chunk of data.
- Pubkey: The public key of a Ed25519 key-pair.
2021-01-23 01:51:25 -08:00
- Transaction: A list of Solana 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.
2018-08-23 15:40:18 -07:00
2019-11-06 13:15:00 -08:00
## Configuring State Commitment
2020-11-05 11:34:55 -08:00
For preflight checks and transaction processing, Solana 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:
2021-01-26 11:23:07 -08:00
- `"finalized"` - the node will query the most recent block confirmed by supermajority
2020-11-05 11:34:55 -08:00
of the cluster as having reached maximum lockout, meaning the cluster has
recognized this block as finalized
2021-01-26 11:23:07 -08:00
- `"confirmed"` - the node will query the most recent block that has been voted on by supermajority of the cluster.
2020-09-11 11:19:06 -07:00
- 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.
2021-01-26 11:23:07 -08:00
- `"processed"` - the node will query its most recent block. Note that the block
2020-11-05 11:34:55 -08:00
may not be complete.
For processing many dependent transactions in series, it's recommended to use
2021-01-26 11:23:07 -08:00
`"confirmed"` commitment, which balances speed with rollback safety.
For total safety, it's recommended to use`"finalized"` commitment.
2020-11-05 11:34:55 -08:00
#### Example
2019-11-06 13:15:00 -08:00
The commitment parameter should be included as the last element in the `params` array:
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getBalance",
"params": [
"83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
{
2021-02-02 08:33:45 -08:00
"commitment": "finalized"
2020-10-14 23:47:43 -07:00
}
]
}
'
2019-11-06 13:15:00 -08:00
```
#### Default:
2020-07-10 22:11:07 -07:00
2021-02-02 08:33:45 -08:00
If commitment configuration is not provided, the node will default to `"finalized"` commitment
2019-11-06 13:15:00 -08:00
Only methods that query bank state accept the commitment parameter. They are indicated in the API Reference below.
2019-11-12 11:49:41 -08:00
#### RpcResponse Structure
2020-07-10 22:11:07 -07:00
Many methods that take a commitment parameter return an RpcResponse JSON object comprised of two parts:
2019-11-12 11:49:41 -08:00
2020-07-10 22:11:07 -07:00
- `context` : An RpcResponseContext JSON structure including a `slot` field at which the operation was evaluated.
- `value` : The value returned by the operation itself.
2019-11-12 11:49:41 -08:00
2020-04-14 13:22:58 -07:00
## Health Check
2020-07-10 22:11:07 -07:00
2020-10-18 19:55:18 -07:00
Although not a JSON RPC API, a `GET /health` at the RPC HTTP Endpoint provides a
2020-04-14 13:22:58 -07:00
health-check mechanism for use by load balancers or other network
2020-07-10 22:11:07 -07:00
infrastructure. This request will always return a HTTP 200 OK response with a body of
2021-03-04 21:18:08 -08:00
"ok", "behind" or "unknown" based on the following conditions:
2020-07-10 22:11:07 -07:00
2020-04-14 13:22:58 -07:00
1. If one or more `--trusted-validator` arguments are provided to `solana-validator` , "ok" is returned
2021-03-04 21:18:08 -08:00
when the node has within `HEALTH_CHECK_SLOT_DISTANCE` slots of the highest
trusted validator, otherwise "behind". "unknown" is returned when no slot
information from trusted validators is not yet available.
2020-04-14 13:22:58 -07:00
2. "ok" is always returned if no trusted validators are provided.
2019-09-22 20:38:34 -07:00
## JSON RPC API Reference
2018-08-23 10:48:50 -07:00
2019-09-21 22:11:59 -07:00
### getAccountInfo
2019-09-22 20:38:34 -07:00
2019-06-29 09:59:07 -07:00
Returns all information associated with the account of provided Pubkey
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<string>` - Pubkey of account to query, as base-58 encoded string
2020-11-09 14:54:56 -08:00
- `<object>` - (optional) Configuration object containing the following optional
fields:
2020-07-10 22:11:07 -07:00
- (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2020-11-24 12:52:01 -08:00
- `encoding: <string>` - encoding for Account data, either "base58" (*slow*), "base64", "base64+zstd", or "jsonParsed".
2021-02-22 22:31:20 -08:00
"base58" is limited to Account data of less than 129 bytes.
2020-11-24 12:52:01 -08:00
"base64" will return base64 encoded data for Account data of any size.
"base64+zstd" compresses the Account data using [Zstandard ](https://facebook.github.io/zstd/ ) 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.
2019-06-29 09:59:07 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-04-21 10:07:57 -07:00
The result will be an RpcResponse JSON object with `value` equal to:
2019-06-29 09:59:07 -07:00
2020-07-10 22:11:07 -07:00
- `<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
2020-08-15 22:16:06 -07:00
- `data: <[string, encoding]|object>` , data associated with the account, either as encoded binary data or JSON format `{<program>: <state>}` , depending on encoding parameter
2020-07-10 22:11:07 -07:00
- `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
2019-09-22 20:38:34 -07:00
#### Example:
2019-06-29 09:59:07 -07:00
2020-10-14 23:47:43 -07:00
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getAccountInfo",
"params": [
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
{
"encoding": "base58"
}
]
}
'
```
Response:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 1
},
"value": {
"data": [
"11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHRTPuR3oZ1EioKtYGiYxpxMG5vpbZLsbcBYBEmZZcMKaSoGx9JZeAuWf",
"base58"
],
"executable": false,
"lamports": 1000000000,
"owner": "11111111111111111111111111111111",
"rentEpoch": 2
}
},
"id": 1
}
```
2019-06-29 09:59:07 -07:00
2020-10-14 23:47:43 -07:00
#### Example:
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getAccountInfo",
"params": [
"4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA",
{
2020-11-09 14:56:50 -08:00
"encoding": "jsonParsed"
2020-10-14 23:47:43 -07:00
}
]
}
'
```
Response:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 1
},
"value": {
"data": {
"nonce": {
"initialized": {
"authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX",
"blockhash": "3xLP3jK6dVJwpeGeTDYTwdDK3TKchUf1gYYGHa4sF3XJ",
"feeCalculator": {
"lamportsPerSignature": 5000
}
}
}
},
"executable": false,
"lamports": 1000000000,
"owner": "11111111111111111111111111111111",
"rentEpoch": 2
}
},
"id": 1
}
2019-06-29 09:59:07 -07:00
```
2019-09-21 22:11:59 -07:00
### getBalance
2019-09-22 20:38:34 -07:00
2019-09-21 22:11:59 -07:00
Returns the balance of the account of provided Pubkey
2019-09-21 21:31:10 -07:00
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<string>` - Pubkey of account to query, as base-58 encoded string
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2018-08-23 10:48:50 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `RpcResponse<u64>` - RpcResponse JSON object with `value` field set to the balance
2018-08-23 10:48:50 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2018-08-23 10:48:50 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0", "id":1, "method":"getBalance", "params":["83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"]}
'
```
2018-08-23 10:48:50 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2019-11-12 11:49:41 -08:00
{"jsonrpc":"2.0","result":{"context":{"slot":1},"value":0},"id":1}
2018-08-23 10:48:50 -07:00
```
2019-11-04 15:44:27 -08:00
### getBlockCommitment
2019-10-14 15:24:10 -07:00
2019-11-04 15:44:27 -08:00
Returns commitment for particular block
2019-10-14 15:24:10 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<u64>` - block, identified by Slot
2019-10-14 15:24:10 -07:00
#### Results:
2020-01-14 23:25:45 -08:00
The result field will be a JSON object containing:
2019-10-14 15:24:10 -07:00
2020-07-10 22:11:07 -07:00
- `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
2019-10-14 15:24:10 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2019-10-14 15:24:10 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getBlockCommitment","params":[5]}
'
```
2019-10-14 15:24:10 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc":"2.0",
"result":{
"commitment":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,32],
"totalStake": 42
},
"id":1
}
2019-10-14 15:24:10 -07:00
```
2019-11-25 23:40:36 -08:00
### getBlockTime
2020-08-20 14:05:30 -07:00
Returns the estimated production time of a confirmed block.
2020-01-05 23:00:20 -08:00
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.
2019-11-25 23:40:36 -08:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<u64>` - block, identified by Slot
2019-11-25 23:40:36 -08:00
#### Results:
2020-08-20 14:05:30 -07:00
* `<i64>` - estimated production time, as Unix timestamp (seconds since the Unix epoch)
* `<null>` - timestamp is not available for this block
2019-11-25 23:40:36 -08:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2019-11-25 23:40:36 -08:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getBlockTime","params":[5]}
'
```
2019-11-25 23:40:36 -08:00
2020-10-14 23:47:43 -07:00
Result:
```json
2019-11-25 23:40:36 -08:00
{"jsonrpc":"2.0","result":1574721591,"id":1}
```
2019-09-21 22:11:59 -07:00
### getClusterNodes
2019-09-22 20:38:34 -07:00
2019-04-23 14:46:41 -07:00
Returns information about all the nodes participating in the cluster
2019-09-22 20:38:34 -07:00
#### Parameters:
2019-04-23 14:46:41 -07:00
None
2019-09-22 20:38:34 -07:00
#### Results:
2019-04-23 14:46:41 -07:00
The result field will be an array of JSON objects, each with the following sub fields:
2019-09-22 20:38:34 -07:00
2020-07-10 22:11:07 -07:00
- `pubkey: <string>` - Node public key, as base-58 encoded string
- `gossip: <string>` - Gossip network address for the node
- `tpu: <string>` - 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
2019-04-23 14:46:41 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2019-04-23 14:46:41 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0", "id":1, "method":"getClusterNodes"}
'
```
2019-04-23 14:46:41 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": [
{
"gossip": "10.239.6.48:8001",
"pubkey": "9QzsJf7LPLj8GkXbYT3LFDKqsj2hHG7TA3xinJHu8epQ",
"rpc": "10.239.6.48:8899",
"tpu": "10.239.6.48:8856",
"version": "1.0.0 c375ce1f"
}
],
"id": 1
}
2019-04-23 14:46:41 -07:00
```
2019-11-19 13:00:15 -08:00
### getConfirmedBlock
Returns identity and transaction information about a confirmed block in the ledger
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<u64>` - slot, as u64 integer
2021-03-12 14:19:45 -08:00
- `<object>` - (optional) 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".
2020-11-09 15:30:12 -08:00
"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).
2019-11-19 13:00:15 -08:00
#### Results:
The result field will be an object with the following fields:
2020-07-10 22:11:07 -07:00
- `<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>` - an array of JSON objects containing:
2020-08-15 22:16:06 -07:00
- `transaction: <object|[string,encoding]>` - [Transaction ](#transaction-structure ) object, either in JSON format or encoded binary data, depending on encoding parameter
2020-07-10 22:11:07 -07:00
- `meta: <object>` - transaction status metadata object, containing `null` or:
2020-11-03 12:53:17 -08:00
- `err: <object | null>` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions ](https://github.com/solana-labs/solana/blob/master/sdk/src/transaction.rs#L24 )
2020-07-10 22:11:07 -07:00
- `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
2020-09-24 07:36:22 -07:00
- `innerInstructions: <array|undefined>` - List of [inner instructions ](#inner-instructions-structure ) or omitted if inner instruction recording was not yet enabled during this transaction
2021-01-27 16:15:37 -08:00
- `preTokenBalances: <array|undefined>` - List of [token balances ](#token-balances-structure ) 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 ](#token-balances-structure ) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction
2020-10-30 14:22:58 -07:00
- `logMessages: <array>` - array of string log messages or omitted if log message recording was not yet enabled during this transaction
2020-07-10 22:11:07 -07:00
- DEPRECATED: `status: <object>` - Transaction status
- `"Ok": <null>` - Transaction was successful
- `"Err": <ERR>` - Transaction failed with TransactionError
- `rewards: <array>` - 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
2020-10-01 22:11:14 -07:00
- `postBalance: <u64>` - account balance in lamports after the reward was applied
2020-10-09 12:55:35 -07:00
- `rewardType: <string|undefined>` - type of reward: "fee", "rent", "voting", "staking"
2020-07-10 22:11:07 -07:00
- `blockTime: <i64 | null>` - estimated production time, as Unix timestamp (seconds since the Unix epoch). null if not available
2019-11-19 13:00:15 -08:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2019-11-19 13:00:15 -08:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
2021-03-12 14:19:45 -08:00
{"jsonrpc": "2.0","id":1,"method":"getConfirmedBlock","params":[430, {"encoding": "json"}]}
2020-10-14 23:47:43 -07:00
'
```
2019-11-19 13:00:15 -08:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"blockTime": null,
"blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
"parentSlot": 429,
"previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
"rewards": [],
"transactions": [
{
"meta": {
"err": null,
"fee": 5000,
"innerInstructions": [],
2020-10-30 14:22:58 -07:00
"logMessages": [],
2020-10-14 23:47:43 -07:00
"postBalances": [
499998932500,
26858640,
1,
1,
1
],
2021-01-27 16:15:37 -08:00
"postTokenBalances": [],
2020-10-14 23:47:43 -07:00
"preBalances": [
499998937500,
26858640,
1,
1,
1
],
2021-01-27 16:15:37 -08:00
"preTokenBalances": [],
2020-10-14 23:47:43 -07:00
"status": {
"Ok": null
}
},
"transaction": {
"message": {
"accountKeys": [
"3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe",
"AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc",
"SysvarS1otHashes111111111111111111111111111",
"SysvarC1ock11111111111111111111111111111111",
"Vote111111111111111111111111111111111111111"
],
"header": {
"numReadonlySignedAccounts": 0,
"numReadonlyUnsignedAccounts": 3,
"numRequiredSignatures": 1
},
"instructions": [
{
"accounts": [
1,
2,
3,
0
],
"data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1",
"programIdIndex": 4
}
],
"recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B"
},
"signatures": [
"2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv"
]
}
}
]
},
"id": 1
}
```
2020-01-13 14:05:27 -08:00
2020-10-14 23:47:43 -07:00
#### Example:
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc": "2.0","id":1,"method":"getConfirmedBlock","params":[430, "base64"]}
'
```
2020-01-13 14:05:27 -08:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"blockTime": null,
"blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
"parentSlot": 429,
"previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
"rewards": [],
"transactions": [
{
"meta": {
"err": null,
"fee": 5000,
"innerInstructions": [],
2020-10-30 14:22:58 -07:00
"logMessages": [],
2020-10-14 23:47:43 -07:00
"postBalances": [
499998932500,
26858640,
1,
1,
1
],
2021-01-27 16:15:37 -08:00
"postTokenBalances": [],
2020-10-14 23:47:43 -07:00
"preBalances": [
499998937500,
26858640,
1,
1,
1
],
2021-01-27 16:15:37 -08:00
"preTokenBalances": [],
2020-10-14 23:47:43 -07:00
"status": {
"Ok": null
}
},
"transaction": [
"AVj7dxHlQ9IrvdYVIjuiRFs1jLaDMHixgrv+qtHBwz51L4/ImLZhszwiyEJDIp7xeBSpm/TX5B7mYzxa+fPOMw0BAAMFJMJVqLw+hJYheizSoYlLm53KzgT82cDVmazarqQKG2GQsLgiqktA+a+FDR4/7xnDX7rsusMwryYVUdixfz1B1Qan1RcZLwqvxvJl4/t3zHragsUp0L47E24tAFUgAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAAAHYUgdNXR0u3xNdiTr072z2DVec9EQQ/wNo1OAAAAAAAtxOUhPBp2WSjUNJEgfvy70BbxI00fZyEPvFHNfxrtEAQQEAQIDADUCAAAAAQAAAAAAAACtAQAAAAAAAAdUE18R96XTJCe+YfRfUp6WP+YKCy/72ucOL8AoBFSpAA==",
"base64"
]
}
]
},
"id": 1
}
2019-11-19 13:00:15 -08:00
```
2020-03-27 09:08:18 -07:00
#### Transaction Structure
2020-11-11 17:46:24 -08:00
Transactions are quite different from those on other blockchains. Be sure to review [Anatomy of a Transaction ](developing/programming-model/transactions.md ) to learn about transactions on Solana.
2020-03-27 09:08:18 -07:00
The JSON structure of a transaction is defined as follows:
2021-01-23 01:51:25 -08:00
- `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.account_keys` . The first one is used as the [transaction id ](../../terminology.md#transaction-id ).
2020-07-10 22:11:07 -07:00
- `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.account_keys` .
- `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.
2020-03-27 09:08:18 -07:00
2020-09-24 07:36:22 -07:00
#### Inner Instructions Structure
The Solana 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.
2021-01-27 16:15:37 -08:00
#### 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.
- `uiTokenAmount: <object>` -
- `amount: <string>` - Raw amount of tokens as a string, ignoring decimals.
- `decimals: <number>` - Number of decimals configured for token's mint.
2021-03-02 21:51:41 -08:00
- `uiAmount: <number | null>` - Token amount as a float, accounting for decimals. **DEPRECATED**
- `uiAmountString: <string>` - Token amount as a string, accounting for decimals.
2021-01-27 16:15:37 -08:00
2019-12-18 15:51:47 -08:00
### getConfirmedBlocks
2020-09-30 13:47:12 -07:00
Returns a list of confirmed blocks between two slots
2019-12-18 15:51:47 -08:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<u64>` - start_slot, as u64 integer
- `<u64>` - (optional) end_slot, as u64 integer
2019-12-18 15:51:47 -08:00
#### Results:
The result field will be an array of u64 integers listing confirmed blocks
2020-07-06 08:37:04 -07:00
between `start_slot` and either `end_slot` , if provided, or latest confirmed block,
inclusive. Max range allowed is 500,000 slots.
2019-12-18 15:51:47 -08:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2019-12-18 15:51:47 -08:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc": "2.0","id":1,"method":"getConfirmedBlocks","params":[5, 10]}
'
```
2019-12-18 15:51:47 -08:00
2020-10-14 23:47:43 -07:00
Result:
```json
2019-12-18 15:51:47 -08:00
{"jsonrpc":"2.0","result":[5,6,7,8,9,10],"id":1}
```
2020-09-30 13:47:12 -07:00
### getConfirmedBlocksWithLimit
Returns a list of confirmed blocks starting at the given slot
#### Parameters:
- `<u64>` - start_slot, as u64 integer
- `<u64>` - limit, as u64 integer
#### Results:
The result field will be an array of u64 integers listing confirmed blocks
starting at `start_slot` for up to `limit` blocks, inclusive.
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2020-09-30 13:47:12 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
2021-01-04 18:41:24 -08:00
{"jsonrpc": "2.0","id":1,"method":"getConfirmedBlocksWithLimit","params":[5, 3]}
2020-10-14 23:47:43 -07:00
'
```
2020-09-30 13:47:12 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2020-09-30 13:47:12 -07:00
{"jsonrpc":"2.0","result":[5,6,7],"id":1}
```
2020-04-09 20:21:31 -07:00
### getConfirmedSignaturesForAddress
2020-07-27 11:42:49 -07:00
**DEPRECATED: Please use getConfirmedSignaturesForAddress2 instead**
2020-07-06 08:37:04 -07:00
Returns a list of all the confirmed signatures for transactions involving an
address, within a specified Slot range. Max range allowed is 10,000 Slots
2020-04-09 20:21:31 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<string>` - account address as base-58 encoded string
- `<u64>` - start slot, inclusive
- `<u64>` - end slot, inclusive
2020-04-09 20:21:31 -07:00
#### Results:
The result field will be an array of:
2020-07-10 22:11:07 -07:00
- `<string>` - transaction signature as base-58 encoded string
2020-04-09 20:21:31 -07:00
The signatures will be ordered based on the Slot in which they were confirmed in, from lowest to highest Slot
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getConfirmedSignaturesForAddress",
"params": [
"6H94zdiaYfRfPfKjYLjyr2VFBg6JHXygy84r3qhc3NsC",
0,
100
]
}
'
2020-04-09 20:21:31 -07:00
```
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": [
"35YGay1Lwjwgxe9zaH6APSHbt9gYQUCtBWTNL3aVwVGn9xTFw2fgds7qK5AL29mP63A9j3rh8KpN1TgSR62XCaby",
"4bJdGN8Tt2kLWZ3Fa1dpwPSEkXWWTSszPSf1rRVsCwNjxbbUdwTeiWtmi8soA26YmwnKD4aAxNp8ci1Gjpdv4gsr",
"4LQ14a7BYY27578Uj8LPCaVhSdJGLn9DJqnUJHpy95FMqdKf9acAhUhecPQNjNUy6VoNFUbvwYkPociFSf87cWbG"
],
"id": 1
}
```
2020-07-27 11:42:49 -07:00
### getConfirmedSignaturesForAddress2
Returns confirmed signatures for transactions involving an
address backwards in time from the provided signature or most recent confirmed block
#### Parameters:
* `<string>` - account address as base-58 encoded string
* `<object>` - (optional) Configuration object containing the following fields:
2020-09-23 12:33:00 -07:00
* `limit: <number>` - (optional) maximum transaction signatures to return (between 1 and 1,000, default: 1,000).
2020-08-05 11:30:21 -07:00
* `before: <string>` - (optional) start searching backwards from this transaction signature.
If not provided the search starts from the top of the highest max confirmed block.
2020-09-23 12:33:00 -07:00
* `until: <string>` - (optional) search until this transaction signature, if found before limit reached.
2020-07-27 11:42:49 -07:00
#### Results:
The result field will be an array of transaction signature information, ordered
from newest to oldest transaction:
* `<object>`
* `signature: <string>` - transaction signature as base-58 encoded string
* `slot: <u64>` - The slot that contains the block with the transaction
2020-11-03 12:53:17 -08:00
* `err: <object | null>` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions ](https://github.com/solana-labs/solana/blob/master/sdk/src/transaction.rs#L24 )
2020-07-27 11:42:49 -07:00
* `memo: <string |null>` - Memo associated with the transaction, null if no memo is present
2021-01-27 16:15:37 -08:00
* `blockTime: <i64 | null>` - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when transaction was processed. null if not available.
2020-07-27 11:42:49 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getConfirmedSignaturesForAddress2",
"params": [
"Vote111111111111111111111111111111111111111",
{
"limit": 1
}
]
}
'
```
2020-07-27 11:42:49 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": [
{
"err": null,
"memo": null,
"signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv",
2021-01-27 16:15:37 -08:00
"slot": 114,
"blockTime": null
2020-10-14 23:47:43 -07:00
}
],
"id": 1
}
2020-07-27 11:42:49 -07:00
```
2020-04-08 23:57:30 -07:00
### getConfirmedTransaction
Returns transaction details for a confirmed transaction
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<string>` - transaction signature as base-58 encoded string
2021-03-12 14:19:45 -08:00
- `<object>` - (optional) 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".
2021-01-28 20:58:27 -08:00
"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).
2020-04-08 23:57:30 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<null>` - if transaction is not found or not confirmed
- `<object>` - if transaction is confirmed, an object with the following fields:
- `slot: <u64>` - the slot this transaction was processed in
2020-08-15 22:16:06 -07:00
- `transaction: <object|[string,encoding]>` - [Transaction ](#transaction-structure ) object, either in JSON format or encoded binary data, depending on encoding parameter
2021-01-27 16:15:37 -08:00
- `blockTime: <i64 | null>` - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when the transaction was processed. null if not available
2020-07-10 22:11:07 -07:00
- `meta: <object | null>` - transaction status metadata object:
2020-11-03 12:53:17 -08:00
- `err: <object | null>` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions ](https://github.com/solana-labs/solana/blob/master/sdk/src/transaction.rs#L24 )
2020-07-10 22:11:07 -07:00
- `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
2020-09-24 07:36:22 -07:00
- `innerInstructions: <array|undefined>` - List of [inner instructions ](#inner-instructions-structure ) or omitted if inner instruction recording was not yet enabled during this transaction
2021-01-27 16:15:37 -08:00
- `preTokenBalances: <array|undefined>` - List of [token balances ](#token-balances-structure ) 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 ](#token-balances-structure ) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction
2020-10-30 14:22:58 -07:00
- `logMessages: <array>` - array of string log messages or omitted if log message recording was not yet enabled during this transaction
2020-07-10 22:11:07 -07:00
- DEPRECATED: `status: <object>` - Transaction status
- `"Ok": <null>` - Transaction was successful
- `"Err": <ERR>` - Transaction failed with TransactionError
2020-04-08 23:57:30 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getConfirmedTransaction",
"params": [
"2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv",
"json"
]
}
'
```
2020-04-08 23:57:30 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"meta": {
"err": null,
"fee": 5000,
"innerInstructions": [],
"postBalances": [
499998932500,
26858640,
1,
1,
1
],
2021-01-27 16:15:37 -08:00
"postTokenBalances": [],
2020-10-14 23:47:43 -07:00
"preBalances": [
499998937500,
26858640,
1,
1,
1
],
2021-01-27 16:15:37 -08:00
"preTokenBalances": [],
2020-10-14 23:47:43 -07:00
"status": {
"Ok": null
}
},
"slot": 430,
"transaction": {
"message": {
"accountKeys": [
"3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe",
"AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc",
"SysvarS1otHashes111111111111111111111111111",
"SysvarC1ock11111111111111111111111111111111",
"Vote111111111111111111111111111111111111111"
],
"header": {
"numReadonlySignedAccounts": 0,
"numReadonlyUnsignedAccounts": 3,
"numRequiredSignatures": 1
},
"instructions": [
{
"accounts": [
1,
2,
3,
0
],
"data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1",
"programIdIndex": 4
}
],
"recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B"
},
"signatures": [
"2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv"
]
}
},
2021-01-27 16:15:37 -08:00
"blockTime": null,
2020-10-14 23:47:43 -07:00
"id": 1
}
```
2020-04-08 23:57:30 -07:00
2020-10-14 23:47:43 -07:00
#### Example:
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getConfirmedTransaction",
"params": [
"2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv",
"base64"
]
}
'
```
2020-04-08 23:57:30 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"meta": {
"err": null,
"fee": 5000,
"innerInstructions": [],
"postBalances": [
499998932500,
26858640,
1,
1,
1
],
2021-01-27 16:15:37 -08:00
"postTokenBalances": [],
2020-10-14 23:47:43 -07:00
"preBalances": [
499998937500,
26858640,
1,
1,
1
],
2021-01-27 16:15:37 -08:00
"preTokenBalances": [],
2020-10-14 23:47:43 -07:00
"status": {
"Ok": null
}
},
"slot": 430,
"transaction": [
"AVj7dxHlQ9IrvdYVIjuiRFs1jLaDMHixgrv+qtHBwz51L4/ImLZhszwiyEJDIp7xeBSpm/TX5B7mYzxa+fPOMw0BAAMFJMJVqLw+hJYheizSoYlLm53KzgT82cDVmazarqQKG2GQsLgiqktA+a+FDR4/7xnDX7rsusMwryYVUdixfz1B1Qan1RcZLwqvxvJl4/t3zHragsUp0L47E24tAFUgAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAAAHYUgdNXR0u3xNdiTr072z2DVec9EQQ/wNo1OAAAAAAAtxOUhPBp2WSjUNJEgfvy70BbxI00fZyEPvFHNfxrtEAQQEAQIDADUCAAAAAQAAAAAAAACtAQAAAAAAAAdUE18R96XTJCe+YfRfUp6WP+YKCy/72ucOL8AoBFSpAA==",
"base64"
]
},
"id": 1
}
2020-04-08 23:57:30 -07:00
```
2019-09-21 22:11:59 -07:00
### getEpochInfo
2019-09-22 20:38:34 -07:00
2019-07-19 07:31:18 -07:00
Returns information about the current epoch
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2019-07-19 07:31:18 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2019-07-19 07:31:18 -07:00
The result field will be an object with the following fields:
2019-09-22 20:38:34 -07:00
2020-07-10 22:11:07 -07:00
- `absoluteSlot: <u64>` , the current slot
2020-07-21 14:43:48 -07:00
- `blockHeight: <u64>` , the current block height
2020-07-10 22:11:07 -07:00
- `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
2019-07-19 07:31:18 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2019-07-19 07:31:18 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getEpochInfo"}
'
```
2019-07-19 07:31:18 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"absoluteSlot": 166598,
"blockHeight": 166500,
"epoch": 27,
"slotIndex": 2790,
"slotsInEpoch": 8192
},
"id": 1
}
2019-07-19 07:31:18 -07:00
```
2019-10-24 10:30:11 -07:00
### getEpochSchedule
2019-11-08 20:56:57 -08:00
Returns epoch schedule information from this cluster's genesis config
2019-10-24 10:30:11 -07:00
#### Parameters:
None
#### Results:
The result field will be an object with the following fields:
2020-07-10 22:11:07 -07:00
- `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)
2019-10-24 10:30:11 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2019-10-24 10:30:11 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getEpochSchedule"}
'
```
2019-10-24 10:30:11 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"firstNormalEpoch": 8,
"firstNormalSlot": 8160,
"leaderScheduleSlotOffset": 8192,
"slotsPerEpoch": 8192,
"warmup": true
},
"id": 1
}
2019-10-24 10:30:11 -07:00
```
2020-03-06 16:01:31 -08:00
### getFeeCalculatorForBlockhash
Returns the fee calculator associated with the query blockhash, or `null` if the blockhash has expired
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<string>` - query blockhash as a Base58 encoded string
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2020-03-06 16:01:31 -08:00
#### Results:
2020-04-21 10:07:57 -07:00
The result will be an RpcResponse JSON object with `value` equal to:
2020-03-06 16:01:31 -08:00
2020-07-10 22:11:07 -07:00
- `<null>` - if the query blockhash has expired
- `<object>` - otherwise, a JSON object containing:
- `feeCalculator: <object>` , `FeeCalculator` object describing the cluster fee rate at the queried blockhash
2020-03-06 16:01:31 -08:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2020-03-06 16:01:31 -08:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getFeeCalculatorForBlockhash",
"params": [
"GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ"
]
}
'
```
2020-03-06 16:01:31 -08:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 221
},
"value": {
"feeCalculator": {
"lamportsPerSignature": 5000
}
}
},
"id": 1
}
2020-03-06 16:01:31 -08:00
```
2020-02-28 12:27:01 -08:00
### getFeeRateGovernor
Returns the fee rate governor information from the root bank
#### Parameters:
None
#### Results:
The `result` field will be an `object` with the following fields:
2020-07-10 22:11:07 -07:00
- `burnPercent: <u8>` , Percentage of fees collected to be destroyed
- `maxLamportsPerSignature: <u64>` , Largest value `lamportsPerSignature` can attain for the next slot
- `minLamportsPerSignature: <u64>` , Smallest value `lamportsPerSignature` can attain for the next slot
- `targetLamportsPerSignature: <u64>` , Desired fee rate for the cluster
- `targetSignaturesPerSlot: <u64>` , Desired signature rate for the cluster
2020-02-28 12:27:01 -08:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2020-02-28 12:27:01 -08:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getFeeRateGovernor"}
'
```
2020-02-28 12:27:01 -08:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 54
},
"value": {
"feeRateGovernor": {
"burnPercent": 50,
"maxLamportsPerSignature": 100000,
"minLamportsPerSignature": 5000,
"targetLamportsPerSignature": 10000,
"targetSignaturesPerSlot": 20000
}
}
},
"id": 1
}
2020-02-28 12:27:01 -08:00
```
2020-05-26 12:06:21 -07:00
### getFees
Returns a recent block hash from the ledger, a fee schedule that can be used to
compute the cost of submitting a transaction using it, and the last slot in
which the blockhash will be valid.
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2020-05-26 12:06:21 -07:00
#### Results:
The result will be an RpcResponse JSON object with `value` set to a JSON object with the following fields:
2020-07-10 22:11:07 -07:00
- `blockhash: <string>` - a Hash as base-58 encoded string
- `feeCalculator: <object>` - FeeCalculator object, the fee schedule for this block hash
2021-03-10 22:03:46 -08:00
- `lastValidSlot: <u64>` - DEPRECATED - this value is inaccurate and should not be relied upon
2020-05-26 12:06:21 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2020-05-26 12:06:21 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getFees"}
'
```
2020-05-26 12:06:21 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 1
},
"value": {
"blockhash": "CSymwgTNX1j3E4qhKfJAUE41nBWEwXufoYryPbkde5RR",
"feeCalculator": {
"lamportsPerSignature": 5000
},
"lastValidSlot": 297
}
},
"id": 1
}
2020-05-26 12:06:21 -07:00
```
2020-04-22 13:33:06 -07:00
### getFirstAvailableBlock
Returns the slot of the lowest confirmed block that has not been purged from the ledger
#### Parameters:
None
#### Results:
2020-07-10 22:11:07 -07:00
- `<u64>` - Slot
2020-04-22 13:33:06 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2020-04-22 13:33:06 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getFirstAvailableBlock"}
'
```
2020-04-22 13:33:06 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2020-04-22 13:33:06 -07:00
{"jsonrpc":"2.0","result":250000,"id":1}
```
2019-11-08 20:56:57 -08:00
### getGenesisHash
2019-09-22 20:38:34 -07:00
2019-11-08 20:56:57 -08:00
Returns the genesis hash
2019-08-21 18:16:40 -07:00
2019-09-22 20:38:34 -07:00
#### Parameters:
2019-08-21 18:16:40 -07:00
None
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<string>` - a Hash as base-58 encoded string
2019-08-21 18:16:40 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2019-08-21 18:16:40 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getGenesisHash"}
'
```
2019-08-21 18:16:40 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2019-08-21 18:16:40 -07:00
{"jsonrpc":"2.0","result":"GH7ome3EiwEr7tu9JuTh2dpYWBJK3z69Xm1ZE3MEE6JC","id":1}
```
2021-01-14 21:45:11 -08:00
### getHealth
Returns the current health of the node.
If one or more `--trusted-validator` arguments are provided to
`solana-validator` , "ok" is returned when the node has within
`HEALTH_CHECK_SLOT_DISTANCE` slots of the highest trusted validator, otherwise
an error is returned. "ok" is always returned if no trusted validators are
provided.
#### Parameters:
None
#### Results:
If the node is healthy: "ok"
2021-01-17 20:23:14 -08:00
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
2021-01-14 21:45:11 -08:00
#### Example:
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getHealth"}
'
```
Healthy Result:
```json
{"jsonrpc":"2.0","result": "ok","id":1}
```
2021-01-17 20:23:14 -08:00
Unhealthy Result (generic):
```json
{
"jsonrpc": "2.0",
"error": {
"code": -32005,
"message": "Node is unhealthy",
"data": {}
},
"id": 1
}
```
Unhealthy Result (if additional information is available)
2021-01-14 21:45:11 -08:00
```json
{
"jsonrpc": "2.0",
"error": {
"code": -32005,
2021-01-17 20:23:14 -08:00
"message": "Node is behind by 42 slots",
2021-01-14 21:45:11 -08:00
"data": {
"numSlotsBehind": 42
}
},
"id": 1
}
```
2020-03-04 14:44:21 -08:00
### getIdentity
Returns the identity pubkey for the current node
#### Parameters:
None
#### Results:
The result field will be a JSON object with the following fields:
2020-07-10 22:11:07 -07:00
- `identity` , the identity pubkey of the current node \(as a base-58 encoded string\)
2020-03-04 14:44:21 -08:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2020-03-04 14:44:21 -08:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getIdentity"}
'
```
Result:
```json
2020-03-04 14:44:21 -08:00
{"jsonrpc":"2.0","result":{"identity": "2r1F4iWqVcb8M1DbAjQuFpebkQHY9hcVU4WuW2DJBppN"},"id":1}
```
2020-05-29 11:50:25 -07:00
### getInflationGovernor
2020-01-21 19:17:33 -08:00
2020-05-29 11:50:25 -07:00
Returns the current inflation governor
2020-01-21 19:17:33 -08:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2020-01-21 19:17:33 -08:00
#### Results:
2020-05-29 11:50:25 -07:00
The result field will be a JSON object with the following fields:
2020-01-21 19:17:33 -08:00
2020-07-10 22:11:07 -07:00
- `initial: <f64>` , the initial inflation percentage from time 0
- `terminal: <f64>` , terminal inflation percentage
- `taper: <f64>` , rate per year at which inflation is lowered
- `foundation: <f64>` , percentage of total inflation allocated to the foundation
- `foundationTerm: <f64>` , duration of foundation pool inflation in years
2020-01-21 19:17:33 -08:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2020-01-21 19:17:33 -08:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getInflationGovernor"}
'
```
2020-05-29 11:50:25 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"foundation": 0.05,
"foundationTerm": 7,
"initial": 0.15,
"taper": 0.15,
"terminal": 0.015
},
"id": 1
}
2020-05-29 11:50:25 -07:00
```
### getInflationRate
2020-07-01 15:43:25 -07:00
Returns the specific inflation values for the current epoch
2020-05-29 11:50:25 -07:00
#### Parameters:
2020-07-01 15:43:25 -07:00
None
2020-05-29 11:50:25 -07:00
#### Results:
The result field will be a JSON object with the following fields:
2020-07-10 22:11:07 -07:00
- `total: <f64>` , total inflation
- `validator: <f64>` , inflation allocated to validators
- `foundation: <f64>` , inflation allocated to the foundation
- `epoch: <f64>` , epoch for which these values are valid
2020-05-29 11:50:25 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2020-05-29 11:50:25 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getInflationRate"}
'
```
2020-01-21 19:17:33 -08:00
2020-10-14 23:47:43 -07:00
Result:
```json
2020-05-29 11:50:25 -07:00
{"jsonrpc":"2.0","result":{"epoch":100,"foundation":0.001,"total":0.149,"validator":0.148},"id":1}
2020-01-21 19:17:33 -08:00
```
2020-05-04 16:46:10 -07:00
### getLargestAccounts
2021-02-12 08:20:32 -08:00
Returns the 20 largest accounts, by lamport balance (results may be cached up to two hours)
2020-05-04 16:46:10 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<object>` - (optional) Configuration object containing the following optional fields:
- (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
- (optional) `filter: <string>` - filter results by account type; currently supported: `circulating|nonCirculating`
2020-05-04 16:46:10 -07:00
#### Results:
The result will be an RpcResponse JSON object with `value` equal to an array of:
2020-07-10 22:11:07 -07:00
- `<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
2020-05-04 16:46:10 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2020-05-04 16:46:10 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getLargestAccounts"}
'
```
2020-05-04 16:46:10 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 54
},
"value": [
{
"lamports": 999974,
"address": "99P8ZgtJYe1buSK8JXkvpLh8xPsCFuLYhz9hQFNw93WJ"
},
{
"lamports": 42,
"address": "uPwWLo16MVehpyWqsLkK3Ka8nLowWvAHbBChqv2FZeL"
},
{
"lamports": 42,
"address": "aYJCgU7REfu3XF8b3QhkqgqQvLizx8zxuLBHA25PzDS"
},
{
"lamports": 42,
"address": "CTvHVtQ4gd4gUcw3bdVgZJJqApXE9nCbbbP4VTS5wE1D"
},
{
"lamports": 20,
"address": "4fq3xJ6kfrh9RkJQsmVd5gNMvJbuSHfErywvEjNQDPxu"
},
{
"lamports": 4,
"address": "AXJADheGVp9cruP8WYu46oNkRbeASngN5fPCMVGQqNHa"
},
{
"lamports": 2,
"address": "8NT8yS6LiwNprgW4yM1jPPow7CwRUotddBVkrkWgYp24"
},
{
"lamports": 1,
"address": "SysvarEpochSchedu1e111111111111111111111111"
},
{
"lamports": 1,
"address": "11111111111111111111111111111111"
},
{
"lamports": 1,
"address": "Stake11111111111111111111111111111111111111"
},
{
"lamports": 1,
"address": "SysvarC1ock11111111111111111111111111111111"
},
{
"lamports": 1,
"address": "StakeConfig11111111111111111111111111111111"
},
{
"lamports": 1,
"address": "SysvarRent111111111111111111111111111111111"
},
{
"lamports": 1,
"address": "Config1111111111111111111111111111111111111"
},
{
"lamports": 1,
"address": "SysvarStakeHistory1111111111111111111111111"
},
{
"lamports": 1,
"address": "SysvarRecentB1ockHashes11111111111111111111"
},
{
"lamports": 1,
"address": "SysvarFees111111111111111111111111111111111"
},
{
"lamports": 1,
"address": "Vote111111111111111111111111111111111111111"
}
]
},
"id": 1
}
2020-05-04 16:46:10 -07:00
```
2019-09-21 22:11:59 -07:00
### getLeaderSchedule
2019-09-22 20:38:34 -07:00
2019-12-17 15:26:31 -08:00
Returns the leader schedule for an epoch
2019-07-19 07:31:18 -07:00
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<u64>` - (optional) Fetch the leader schedule for the epoch that corresponds to the provided slot. If unspecified, the leader schedule for the current epoch is fetched
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2019-07-19 07:31:18 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<null>` - if requested epoch is not found
- `<object>` - otherwise, the result field will be a dictionary of leader public keys
2020-04-21 10:07:57 -07:00
\(as base-58 encoded strings\) and their corresponding leader slot indices as values
2020-11-24 12:27:40 -08:00
(indices are relative to the first slot in the requested epoch)
2019-09-22 20:38:34 -07:00
#### Example:
2019-07-19 07:31:18 -07:00
2020-10-14 23:47:43 -07:00
Request:
2019-07-19 07:31:18 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getLeaderSchedule"}
'
```
2019-07-19 07:31:18 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc":"2.0",
"result":{
"4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63]
},
"id":1
}
2019-07-19 07:31:18 -07:00
```
2021-02-23 13:06:33 -08:00
### getMaxRetransmitSlot
Get the max slot seen from retransmit stage.
#### Results:
- `<u64>` - Slot
#### Example:
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getMaxRetransmitSlot"}
'
```
Result:
```json
{"jsonrpc":"2.0","result":1234,"id":1}
```
### getMaxShredInsertSlot
Get the max slot seen from after shred insert.
#### Results:
- `<u64>` - Slot
#### Example:
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getMaxShredInsertSlot"}
'
```
Result:
```json
{"jsonrpc":"2.0","result":1234,"id":1}
```
2019-10-24 10:30:11 -07:00
### getMinimumBalanceForRentExemption
Returns minimum balance required to make account rent exempt.
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<usize>` - account data length
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2019-10-24 10:30:11 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<u64>` - minimum lamports required in account
2019-10-24 10:30:11 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2019-10-24 10:30:11 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0", "id":1, "method":"getMinimumBalanceForRentExemption", "params":[50]}
'
```
2019-10-24 10:30:11 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2019-10-24 10:30:11 -07:00
{"jsonrpc":"2.0","result":500,"id":1}
```
2020-09-03 10:35:06 -07:00
### getMultipleAccounts
Returns the account information for a list of Pubkeys
#### Parameters:
- `<array>` - An array of Pubkeys to query, as base-58 encoded strings
- `<object>` - (optional) Configuration object containing the following optional fields:
- (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2020-11-24 12:52:01 -08:00
- `encoding: <string>` - encoding for Account data, either "base58" (*slow*), "base64", "base64+zstd", or "jsonParsed".
2021-02-22 22:54:35 -08:00
"base58" is limited to Account data of less than 129 bytes.
2020-11-24 12:52:01 -08:00
"base64" will return base64 encoded data for Account data of any size.
"base64+zstd" compresses the Account data using [Zstandard ](https://facebook.github.io/zstd/ ) 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.
2020-09-03 10:35:06 -07:00
#### Results:
The result will be an RpcResponse JSON object with `value` equal to:
An array of:
- `<null>` - if the account at that Pubkey 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
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getMultipleAccounts",
"params": [
[
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
"4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
],
{
"dataSlice": {
"offset": 0,
"length": 0
}
}
]
}
'
```
2020-09-03 10:35:06 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 1
},
"value": [
{
"data": [
"AAAAAAEAAAACtzNsyJrW0g==",
"base64"
],
"executable": false,
"lamports": 1000000000,
"owner": "11111111111111111111111111111111",
"rentEpoch": 2
},
{
"data": [
"",
"base64"
],
"executable": false,
"lamports": 5000000000,
"owner": "11111111111111111111111111111111",
"rentEpoch": 2
}
]
},
"id": 1
}
```
2020-09-03 10:35:06 -07:00
2020-10-14 23:47:43 -07:00
#### Example:
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getMultipleAccounts",
"params": [
[
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
"4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
],
{
"encoding": "base58"
}
]
}
'
```
2020-09-03 10:35:06 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 1
},
"value": [
{
"data": [
"11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHRTPuR3oZ1EioKtYGiYxpxMG5vpbZLsbcBYBEmZZcMKaSoGx9JZeAuWf",
"base58"
],
"executable": false,
"lamports": 1000000000,
"owner": "11111111111111111111111111111111",
"rentEpoch": 2
},
{
"data": [
"",
"base58"
],
"executable": false,
"lamports": 5000000000,
"owner": "11111111111111111111111111111111",
"rentEpoch": 2
}
]
},
"id": 1
}
2020-09-03 10:35:06 -07:00
```
2019-09-21 22:11:59 -07:00
### getProgramAccounts
2019-09-22 20:38:34 -07:00
2019-06-29 09:59:07 -07:00
Returns all accounts owned by the provided program Pubkey
2018-09-20 13:20:37 -07:00
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<string>` - Pubkey of program, as base-58 encoded string
- `<object>` - (optional) Configuration object containing the following optional fields:
- (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2020-11-24 12:52:01 -08:00
- `encoding: <string>` - encoding for Account data, either "base58" (*slow*), "base64", "base64+zstd", or "jsonParsed".
2021-02-22 22:54:35 -08:00
"base58" is limited to Account data of less than 129 bytes.
2020-11-24 12:52:01 -08:00
"base64" will return base64 encoded data for Account data of any size.
"base64+zstd" compresses the Account data using [Zstandard ](https://facebook.github.io/zstd/ ) 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.
2020-07-10 22:11:07 -07:00
- (optional) `filters: <array>` - filter results using various [filter objects ](jsonrpc-api.md#filters ); account must meet all filter criteria to be included in results
2020-07-03 00:46:29 -07:00
##### Filters:
2020-07-10 22:11:07 -07:00
- `memcmp: <object>` - compares a provided series of bytes with program account data at a particular offset. Fields:
- `offset: <usize>` - offset into program account data to start comparison
2021-02-22 22:31:20 -08:00
- `bytes: <string>` - data to match, as base-58 encoded string and limited to less than 129 bytes
2020-07-03 00:46:29 -07:00
2020-07-10 22:11:07 -07:00
- `dataSize: <u64>` - compares the program account data length with the provided data size
2018-09-20 13:20:37 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-01-21 19:17:33 -08:00
The result field will be an array of JSON objects, which will contain:
2018-09-20 13:20:37 -07:00
2020-07-10 22:11:07 -07:00
- `pubkey: <string>` - the account Pubkey as base-58 encoded string
- `account: <object>` - a JSON object, with the following sub fields:
- `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
2020-08-15 22:16:06 -07:00
`data: <[string,encoding]|object>` , data associated with the account, either as encoded binary data or JSON format `{<program>: <state>}` , depending on encoding parameter
2020-07-10 22:11:07 -07:00
- `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
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2018-09-20 13:20:37 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0", "id":1, "method":"getProgramAccounts", "params":["4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T"]}
'
```
2018-09-20 13:20:37 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": [
{
"account": {
"data": "2R9jLfiAQ9bgdcw6h8s44439",
"executable": false,
"lamports": 15298080,
"owner": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
"rentEpoch": 28
},
"pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"
}
],
"id": 1
}
```
2020-07-03 00:46:29 -07:00
2020-10-14 23:47:43 -07:00
#### Example:
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getProgramAccounts",
"params": [
"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
{
"filters": [
{
"dataSize": 17
},
{
"memcmp": {
"offset": 4,
"bytes": "3Mc6vR"
}
}
]
}
]
}
'
```
2020-07-03 00:46:29 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": [
{
"account": {
"data": "2R9jLfiAQ9bgdcw6h8s44439",
"executable": false,
"lamports": 15298080,
"owner": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
"rentEpoch": 28
},
"pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"
}
],
"id": 1
}
2018-09-20 13:20:37 -07:00
```
2019-09-21 22:11:59 -07:00
### getRecentBlockhash
2019-09-21 21:31:10 -07:00
2019-09-22 20:38:34 -07:00
Returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2018-08-23 10:48:50 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-01-15 14:33:53 -08:00
An RpcResponse containing a JSON object consisting of a string blockhash and FeeCalculator JSON object.
2019-09-22 20:38:34 -07:00
2020-07-10 22:11:07 -07:00
- `RpcResponse<object>` - RpcResponse JSON object with `value` field set to a JSON object including:
- `blockhash: <string>` - a Hash as base-58 encoded string
- `feeCalculator: <object>` - FeeCalculator object, the fee schedule for this block hash
2018-08-23 10:48:50 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2018-08-23 10:48:50 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d 'i
{"jsonrpc":"2.0","id":1, "method":"getRecentBlockhash"}
'
```
2018-08-23 10:48:50 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 1
},
"value": {
"blockhash": "CSymwgTNX1j3E4qhKfJAUE41nBWEwXufoYryPbkde5RR",
"feeCalculator": {
"lamportsPerSignature": 5000
}
}
},
"id": 1
}
2020-01-21 19:17:33 -08:00
```
2020-10-01 22:30:49 -07:00
### getRecentPerformanceSamples
Returns a list of recent performance samples, in reverse slot order. Performance samples are taken every 60 seconds and
include the number of transactions and slots that occur in a given time window.
#### Parameters:
- `limit: <usize>` - (optional) number of samples to return (maximum 720)
#### Results:
An array of:
- `RpcPerfSample<object>`
- `slot: <u64>` - Slot in which sample was taken at
- `numTransactions: <u64>` - Number of transactions in sample
- `numSlots: <u64>` - Number of slots in sample
- `samplePeriodSecs: <u16>` - Number of seconds in a sample window
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2020-10-01 22:30:49 -07:00
```bash
// Request
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0", "id":1, "method":"getRecentPerformanceSamples", "params": [4]}
'
```
2020-10-01 22:30:49 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": [
{
"numSlots": 126,
"numTransactions": 126,
"samplePeriodSecs": 60,
"slot": 348125
},
{
"numSlots": 126,
"numTransactions": 126,
"samplePeriodSecs": 60,
"slot": 347999
},
{
"numSlots": 125,
"numTransactions": 125,
"samplePeriodSecs": 60,
"slot": 347873
},
{
"numSlots": 125,
"numTransactions": 125,
"samplePeriodSecs": 60,
"slot": 347748
}
],
"id": 1
}
2020-10-01 22:30:49 -07:00
```
2021-01-14 21:45:11 -08:00
### getSnapshotSlot
Returns the highest slot that the node has a snapshot for
#### Parameters:
None
#### Results:
- `<u64>` - Snapshot slot
#### Example:
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getSnapshotSlot"}
'
```
Result:
```json
{"jsonrpc":"2.0","result":100,"id":1}
```
Result when the node has no snapshot:
```json
{"jsonrpc":"2.0","error":{"code":-32008,"message":"No snapshot"},"id":1}
```
2020-04-01 11:30:58 -07:00
### getSignatureStatuses
2020-04-06 03:04:54 -07:00
Returns the statuses of a list of signatures. Unless the
`searchTransactionHistory` configuration parameter is included, this method only
searches the recent status cache of signatures, which retains statuses for all
active slots plus `MAX_RECENT_BLOCKHASHES` rooted slots.
2020-04-01 11:30:58 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<array>` - An array of transaction signatures to confirm, as base-58 encoded strings
- `<object>` - (optional) Configuration object containing the following field:
- `searchTransactionHistory: <bool>` - if true, a Solana node will search its ledger cache for any signatures not found in the recent status cache
2018-09-26 17:12:40 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-03-26 18:21:01 -07:00
An RpcResponse containing a JSON object consisting of an array of TransactionStatus objects.
2020-07-10 22:11:07 -07:00
- `RpcResponse<object>` - RpcResponse JSON object with `value` field:
2020-03-26 18:21:01 -07:00
2020-03-23 10:25:39 -07:00
An array of:
2020-07-10 22:11:07 -07:00
- `<null>` - Unknown transaction
- `<object>`
- `slot: <u64>` - The slot the transaction was processed
- `confirmations: <usize | null>` - Number of blocks since signature confirmation, null if rooted, as well as finalized by a supermajority of the cluster
2020-11-03 12:53:17 -08:00
- `err: <object | null>` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions ](https://github.com/solana-labs/solana/blob/master/sdk/src/transaction.rs#L24 )
2021-01-15 08:05:05 -08:00
- `confirmationStatus: <string | null>` - The transaction's cluster confirmation status; either `processed` , `confirmed` , or `finalized` . See [Commitment ](jsonrpc-api.md#configuring-state-commitment ) for more on optimistic confirmation.
2020-07-10 22:11:07 -07:00
- DEPRECATED: `status: <object>` - Transaction status
- `"Ok": <null>` - Transaction was successful
- `"Err": <ERR>` - Transaction failed with TransactionError
2019-09-22 20:38:34 -07:00
#### Example:
2018-09-26 17:12:40 -07:00
2020-10-14 23:47:43 -07:00
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getSignatureStatuses",
"params": [
[
"5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
"5j7s6NiJS3JAkvgkoc18WVAsiSaci2pxB2A6ueCJP4tprA2TFg9wSyTLeYouxPBJEMzJinENTkpA52YStRW5Dia7"
]
]
}
'
```
2020-04-06 03:04:54 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 82
},
"value": [
{
"slot": 72,
"confirmations": 10,
"err": null,
"status": {
"Ok": null
2021-01-15 08:05:05 -08:00
},
"confirmationStatus": "confirmed",
2020-10-14 23:47:43 -07:00
},
null
]
},
"id": 1
}
```
2018-09-26 17:12:40 -07:00
2020-10-14 23:47:43 -07:00
#### Example:
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getSignatureStatuses",
"params": [
[
"5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW"
],
{
"searchTransactionHistory": true
}
]
}
'
```
2020-03-26 18:21:01 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 82
},
"value": [
{
"slot": 48,
"confirmations": null,
"err": null,
"status": {
"Ok": null
2021-01-15 08:05:05 -08:00
},
"confirmationStatus": "finalized",
2020-10-14 23:47:43 -07:00
},
null
]
},
"id": 1
}
2018-09-26 17:12:40 -07:00
```
2019-09-21 22:11:59 -07:00
### getSlot
2019-09-22 20:38:34 -07:00
2019-07-25 17:19:49 -07:00
Returns the current slot the node is processing
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2019-07-25 17:19:49 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<u64>` - Current slot
2019-07-25 17:19:49 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2019-07-25 17:19:49 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getSlot"}
'
```
2019-07-25 17:19:49 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2020-01-21 12:05:04 -08:00
{"jsonrpc":"2.0","result":1234,"id":1}
2019-07-25 17:19:49 -07:00
```
2019-04-23 14:46:41 -07:00
### getSlotLeader
2019-09-22 20:38:34 -07:00
2019-04-23 14:46:41 -07:00
Returns the current slot leader
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2019-04-23 14:46:41 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<string>` - Node identity Pubkey as base-58 encoded string
2019-04-23 14:46:41 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2019-04-23 14:46:41 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getSlotLeader"}
'
```
2019-04-23 14:46:41 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2019-04-23 14:46:41 -07:00
{"jsonrpc":"2.0","result":"ENvAW7JScgYq6o4zKZwewtkzzJgDzuJAFxYasvmEQdpS","id":1}
```
2020-07-06 12:28:40 -07:00
### getStakeActivation
Returns epoch activation information for a stake account
#### Parameters:
* `<string>` - Pubkey of stake account to query, as base-58 encoded string
* `<object>` - (optional) Configuration object containing the following optional fields:
* (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
* (optional) `epoch: <u64>` - epoch for which to calculate activation details. If parameter not provided, defaults to current epoch.
#### Results:
The result will be a JSON object with the following fields:
* `state: <string` - the stake account's activation state, one of: `active` , `inactive` , `activating` , `deactivating`
* `active: <u64>` - stake active during the epoch
* `inactive: <u64>` - stake inactive during the epoch
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2020-07-06 12:28:40 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getStakeActivation", "params": ["CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT"]}
'
```
2020-07-06 12:28:40 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2020-07-06 12:28:40 -07:00
{"jsonrpc":"2.0","result":{"active":197717120,"inactive":0,"state":"active"},"id":1}
2020-10-14 23:47:43 -07:00
```
2020-07-06 12:28:40 -07:00
2020-10-14 23:47:43 -07:00
#### Example:
Request:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getStakeActivation",
"params": [
"CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT",
{
"epoch": 4
}
]
}
'
```
2020-07-06 12:28:40 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"active": 124429280,
"inactive": 73287840,
"state": "activating"
},
"id": 1
}
2020-07-06 12:28:40 -07:00
```
2020-05-09 11:05:29 -07:00
### getSupply
2019-09-22 20:38:34 -07:00
2020-05-09 11:05:29 -07:00
Returns information about the current supply.
2018-08-23 10:48:50 -07:00
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2018-08-23 10:48:50 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-05-09 11:05:29 -07:00
The result will be an RpcResponse JSON object with `value` equal to a JSON object containing:
2020-07-10 22:11:07 -07:00
- `total: <u64>` - Total supply in lamports
- `circulating: <u64>` - Circulating supply in lamports
- `nonCirculating: <u64>` - Non-circulating supply in lamports
- `nonCirculatingAccounts: <array>` - an array of account addresses of non-circulating accounts, as strings
2018-08-23 10:48:50 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2018-08-23 10:48:50 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0", "id":1, "method":"getSupply"}
'
```
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 1114
},
"value": {
"circulating": 16000,
"nonCirculating": 1000000,
"nonCirculatingAccounts": [
"FEy8pTbP5fEoqMV1GdTz83byuA8EKByqYat1PKDgVAq5",
"9huDUZfxoJ7wGMTffUE7vh1xePqef7gyrLJu9NApncqA",
"3mi1GmwEE3zo2jmfDuzvjSX9ovRXsDUKHvsntpkhuLJ9",
"BYxEJTDerkaRWBem3XgnVcdhppktBXa2HbkHPKj2Ui4Z"
],
"total": 1016000
}
},
"id": 1
}
2018-08-23 10:48:50 -07:00
```
2020-07-28 22:00:48 -07:00
### getTokenAccountBalance
2021-03-10 22:02:16 -08:00
Returns the token balance of an SPL Token account.
2020-07-28 22:00:48 -07:00
#### Parameters:
- `<string>` - Pubkey of Token account to query, as base-58 encoded string
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
#### Results:
2020-08-04 23:48:09 -07:00
The result will be an RpcResponse JSON object with `value` equal to a JSON object containing:
- `amount: <string>` - the raw balance without decimals, a string representation of u64
- `decimals: <u8>` - number of base 10 digits to the right of the decimal place
2021-03-02 21:51:41 -08:00
- `uiAmount: <number | null>` - the balance, using mint-prescribed decimals **DEPRECATED**
- `uiAmountString: <string>` - the balance as a string, using mint-prescribed decimals
2020-07-28 22:00:48 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
2020-07-28 22:00:48 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0", "id":1, "method":"getTokenAccountBalance", "params": ["7fUAJdStEuGbc3sM84cKRL6yYaaSstyLSU4ve5oovLS7"]}
'
```
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 1114
},
"value": {
"amount": "9864",
2021-03-02 21:51:41 -08:00
"decimals": 2,
"uiAmount": 98.64,
"uiAmountString": "98.64",
2020-10-14 23:47:43 -07:00
},
"id": 1
}
}
2020-07-28 22:00:48 -07:00
```
### getTokenAccountsByDelegate
2021-03-10 22:02:16 -08:00
Returns all SPL Token accounts by approved Delegate.
2020-07-28 22:00:48 -07:00
#### Parameters:
- `<string>` - Pubkey of account delegate to query, as base-58 encoded string
- `<object>` - Either:
* `mint: <string>` - Pubkey of the specific token Mint to limit accounts to, as base-58 encoded string; or
* `programId: <string>` - Pubkey of the Token program ID that owns the accounts, as base-58 encoded string
2020-08-04 10:11:30 -07:00
- `<object>` - (optional) Configuration object containing the following optional fields:
- (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2020-11-24 12:52:01 -08:00
- `encoding: <string>` - encoding for Account data, either "base58" (*slow*), "base64", "base64+zstd" or "jsonParsed".
2020-11-09 15:30:12 -08:00
"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 valid mint cannot be found for a particular account, that account will be filtered out from results.
2020-11-24 12:52:01 -08:00
- (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.
2020-07-28 22:00:48 -07:00
#### Results:
The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects, which will contain:
- `pubkey: <string>` - the account Pubkey as base-58 encoded string
- `account: <object>` - a JSON object, with the following sub fields:
- `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
2020-08-15 22:16:06 -07:00
- `data: <object>` , Token state data associated with the account, either as encoded binary data or in JSON format `{<program>: <state>}`
2020-07-28 22:00:48 -07:00
- `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
#### Example:
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getTokenAccountsByDelegate",
"params": [
"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
{
2020-11-26 17:12:47 -08:00
"programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
2020-10-14 23:47:43 -07:00
},
{
"encoding": "jsonParsed"
}
]
}
'
```
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 1114
},
"value": [
{
"data": {
"program": "spl-token",
"parsed": {
"accountType": "account",
"info": {
"tokenAmount": {
"amount": "1",
2021-03-02 21:51:41 -08:00
"decimals": 1,
"uiAmount": 0.1,
"uiAmountString": "0.1",
2020-10-14 23:47:43 -07:00
},
"delegate": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
"delegatedAmount": 1,
"isInitialized": true,
"isNative": false,
"mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E",
"owner": "CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD"
}
}
},
"executable": false,
"lamports": 1726080,
2020-11-26 17:12:47 -08:00
"owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
2020-10-14 23:47:43 -07:00
"rentEpoch": 4
}
]
},
"id": 1
}
2020-07-28 22:00:48 -07:00
```
### getTokenAccountsByOwner
2021-03-10 22:02:16 -08:00
Returns all SPL Token accounts by token owner.
2020-07-28 22:00:48 -07:00
#### Parameters:
- `<string>` - Pubkey of account owner to query, as base-58 encoded string
- `<object>` - Either:
* `mint: <string>` - Pubkey of the specific token Mint to limit accounts to, as base-58 encoded string; or
* `programId: <string>` - Pubkey of the Token program ID that owns the accounts, as base-58 encoded string
2020-08-04 10:11:30 -07:00
- `<object>` - (optional) Configuration object containing the following optional fields:
- (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2020-11-24 12:52:01 -08:00
- `encoding: <string>` - encoding for Account data, either "base58" (*slow*), "base64", "base64+zstd" or "jsonParsed".
2020-11-09 15:30:12 -08:00
"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 valid mint cannot be found for a particular account, that account will be filtered out from results.
2020-11-24 12:52:01 -08:00
- (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.
2020-07-28 22:00:48 -07:00
#### Results:
The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects, which will contain:
- `pubkey: <string>` - the account Pubkey as base-58 encoded string
- `account: <object>` - a JSON object, with the following sub fields:
- `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
2020-08-15 22:16:06 -07:00
- `data: <object>` , Token state data associated with the account, either as encoded binary data or in JSON format `{<program>: <state>}`
2020-07-28 22:00:48 -07:00
- `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
#### Example:
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getTokenAccountsByOwner",
"params": [
"4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F",
{
"mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E"
},
{
"encoding": "jsonParsed"
}
]
}
'
```
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 1114
},
"value": [
{
"data": {
"program": "spl-token",
"parsed": {
"accountType": "account",
"info": {
"tokenAmount": {
"amount": "1",
2021-03-02 21:51:41 -08:00
"decimals": 1,
"uiAmount": 0.1,
"uiAmountString": "0.1",
2020-10-14 23:47:43 -07:00
},
"delegate": null,
"delegatedAmount": 1,
"isInitialized": true,
"isNative": false,
"mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E",
"owner": "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F"
}
}
},
"executable": false,
"lamports": 1726080,
2020-11-26 17:12:47 -08:00
"owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
2020-10-14 23:47:43 -07:00
"rentEpoch": 4
}
]
},
"id": 1
}
2020-07-28 22:00:48 -07:00
```
2020-08-11 14:05:16 -07:00
### getTokenLargestAccounts
2021-03-10 22:02:16 -08:00
Returns the 20 largest accounts of a particular SPL Token type.
2020-08-11 14:05:16 -07:00
#### Parameters:
- `<string>` - Pubkey of token Mint to query, as base-58 encoded string
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
#### Results:
The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects containing:
- `address: <string>` - the address of the token account
- `amount: <string>` - the raw token account balance without decimals, a string representation of u64
- `decimals: <u8>` - number of base 10 digits to the right of the decimal place
2021-03-02 21:51:41 -08:00
- `uiAmount: <number | null>` - the token account balance, using mint-prescribed decimals **DEPRECATED**
- `uiAmountString: <string>` - the token account balance as a string, using mint-prescribed decimals
2020-08-11 14:05:16 -07:00
#### Example:
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0", "id":1, "method":"getTokenLargestAccounts", "params": ["3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E"]}
'
```
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 1114
},
"value": [
{
"address": "FYjHNoFtSQ5uijKrZFyYAxvEr87hsKXkXcxkcmkBAf4r",
"amount": "771",
"decimals": 2,
2021-03-02 21:51:41 -08:00
"uiAmount": 7.71,
"uiAmountString": "7.71"
2020-10-14 23:47:43 -07:00
},
{
"address": "BnsywxTcaYeNUtzrPxQUvzAWxfzZe3ZLUJ4wMMuLESnu",
"amount": "229",
"decimals": 2,
2021-03-02 21:51:41 -08:00
"uiAmount": 2.29,
"uiAmountString": "2.29"
2020-10-14 23:47:43 -07:00
}
]
},
"id": 1
}
2020-08-11 14:05:16 -07:00
```
2020-07-28 22:00:48 -07:00
### getTokenSupply
2021-03-10 22:02:16 -08:00
Returns the total supply of an SPL Token type.
2020-07-28 22:00:48 -07:00
#### Parameters:
- `<string>` - Pubkey of token Mint to query, as base-58 encoded string
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
#### Results:
2020-08-04 23:48:09 -07:00
The result will be an RpcResponse JSON object with `value` equal to a JSON object containing:
- `amount: <string>` - the raw total token supply without decimals, a string representation of u64
- `decimals: <u8>` - number of base 10 digits to the right of the decimal place
2021-03-02 21:51:41 -08:00
- `uiAmount: <number | null>` - the total token supply, using mint-prescribed decimals **DEPRECATED**
- `uiAmountString: <string>` - the total token supply as a string, using mint-prescribed decimals
2020-07-28 22:00:48 -07:00
#### Example:
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0", "id":1, "method":"getTokenSupply", "params": ["3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E"]}
'
```
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 1114
},
"value": {
"amount": "100000",
2021-03-02 21:51:41 -08:00
"decimals": 2,
"uiAmount": 1000,
"uiAmountString": "1000",
2020-10-14 23:47:43 -07:00
}
},
"id": 1
}
2020-07-28 22:00:48 -07:00
```
2020-05-09 11:05:29 -07:00
### getTransactionCount
2019-09-22 20:38:34 -07:00
2020-05-09 11:05:29 -07:00
Returns the current Transaction count from the ledger
2019-06-21 21:00:26 -07:00
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2019-06-21 21:00:26 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<u64>` - count
2019-06-21 21:00:26 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2019-06-21 21:00:26 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}
'
2019-06-21 21:00:26 -07:00
2020-10-14 23:47:43 -07:00
```
Result:
```json
2020-05-09 11:05:29 -07:00
{"jsonrpc":"2.0","result":268,"id":1}
2019-06-21 21:00:26 -07:00
```
2019-09-21 22:11:59 -07:00
### getVersion
2019-09-22 20:38:34 -07:00
2019-08-07 19:06:27 -07:00
Returns the current solana versions running on the node
2019-05-20 22:21:13 -07:00
2019-09-22 20:38:34 -07:00
#### Parameters:
2019-05-20 22:21:13 -07:00
None
2019-09-22 20:38:34 -07:00
#### Results:
2020-01-21 19:17:33 -08:00
The result field will be a JSON object with the following fields:
2019-09-22 20:38:34 -07:00
2020-07-10 22:11:07 -07:00
- `solana-core` , software version of solana-core
2020-11-15 18:01:47 -08:00
- `feature-set` , unique identifier of the current software's feature set
2019-05-20 22:21:13 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-15 08:33:30 -07:00
Request:
```bash
2020-11-15 18:01:47 -08:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getVersion"}
'
2020-10-15 08:33:30 -07:00
```
Result:
```json
2020-12-15 08:58:07 -08:00
{"jsonrpc":"2.0","result":{"solana-core": "1.6.0"},"id":1}
2020-10-15 08:33:30 -07:00
```
### getVoteAccounts
Returns the account info and associated stake for all the voting accounts in the current bank.
#### Parameters:
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
#### Results:
The result field will be a JSON object of `current` and `delinquent` accounts, each containing an array of JSON objects with the following sub fields:
- `votePubkey: <string>` - Vote account public key, as base-58 encoded string
- `nodePubkey: <string>` - Node public key, as base-58 encoded string
- `activatedStake: <u64>` - the stake, in lamports, delegated to this vote account and active in this epoch
- `epochVoteAccount: <bool>` - bool, whether the vote account is staked for this epoch
- `commission: <number>` , percentage (0-100) of rewards payout owed to the vote account
- `lastVote: <u64>` - Most recent slot voted on by this vote account
- `epochCredits: <array>` - History of how many credits earned by the end of each epoch, as an array of arrays containing: `[epoch, credits, previousCredits]`
#### Example:
Request:
2019-05-20 22:21:13 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"getVoteAccounts"}
'
2019-05-20 22:21:13 -07:00
```
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"current": [
{
"commission": 0,
"epochVoteAccount": true,
"epochCredits": [
[ 1, 64, 0 ],
[ 2, 192, 64 ]
],
"nodePubkey": "B97CCUW3AEZFGy6uUg6zUdnNYvnVq5VG8PUtb2HayTDD",
"lastVote": 147,
"activatedStake": 42,
"votePubkey": "3ZT31jkAGhUaw8jsy4bTknwBMP8i4Eueh52By4zXcsVw"
}
],
"delinquent": [
{
"commission": 127,
"epochVoteAccount": false,
"epochCredits": [],
"nodePubkey": "6ZPxeQaDo4bkZLRsdNrCzchNQr5LN9QMc9sipXv9Kw8f",
"lastVote": 0,
"activatedStake": 0,
"votePubkey": "CmgCk4aMS7KW1SHX3s9K5tBJ6Yng2LBaC8MFov4wx9sm"
}
]
},
"id": 1
}
2019-08-16 16:02:19 -07:00
```
2020-01-21 12:05:04 -08:00
### minimumLedgerSlot
2020-07-10 22:11:07 -07:00
Returns the lowest slot that the node has information about in its ledger. This
2020-01-21 12:05:04 -08:00
value may increase over time if the node is configured to purge older ledger data
#### Parameters:
None
#### Results:
2020-07-10 22:11:07 -07:00
- `u64` - Minimum ledger slot
2020-01-21 12:05:04 -08:00
#### Example:
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"minimumLedgerSlot"}
'
```
2020-01-21 12:05:04 -08:00
2020-10-14 23:47:43 -07:00
Result:
```json
2020-01-21 12:05:04 -08:00
{"jsonrpc":"2.0","result":1234,"id":1}
```
2019-09-21 22:11:59 -07:00
### requestAirdrop
2019-09-22 20:38:34 -07:00
2019-03-05 16:28:14 -08:00
Requests an airdrop of lamports to a Pubkey
2018-08-27 16:34:32 -07:00
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<string>` - Pubkey of account to receive lamports, as base-58 encoded string
- `<integer>` - lamports, as a u64
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment ) (used for retrieving blockhash and verifying airdrop success)
2018-08-27 16:34:32 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<string>` - Transaction Signature of airdrop, as base-58 encoded string
2018-08-27 16:34:32 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2018-08-27 16:34:32 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":1, "method":"requestAirdrop", "params":["83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", 50]}
'
```
2018-08-27 16:34:32 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2018-08-27 16:34:32 -07:00
{"jsonrpc":"2.0","result":"5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW","id":1}
```
2019-09-21 22:11:59 -07:00
### sendTransaction
2019-09-22 20:38:34 -07:00
2020-05-29 23:16:35 -07:00
Submits a signed transaction to the cluster for processing.
2021-01-23 01:51:25 -08:00
This method does not alter the transaction in any way; it relays the
transaction created by clients to the node as-is.
If the node's rpc service receives the transaction, this method immediately
succeeds, without waiting for any confirmations. A successful response from
this method does not guarantee the transaction is processed or confirmed by the
cluster.
While the rpc service will reasonably retry to submit it, the transaction
could be rejected if transaction's `recent_blockhash` expires before it lands.
Use [`getSignatureStatuses` ](jsonrpc-api.md#getsignaturestatuses ) to ensure
a transaction is processed and confirmed.
2020-05-29 23:16:35 -07:00
Before submitting, the following preflight checks are performed:
2020-07-10 22:11:07 -07:00
2020-05-29 23:16:35 -07:00
1. The transaction signatures are verified
2020-11-05 11:34:55 -08:00
2. The transaction is simulated against the bank slot specified by the preflight
commitment. On failure an error will be returned. Preflight checks may be
disabled if desired. It is recommended to specify the same commitment and
preflight commitment to avoid confusing behavior.
2018-08-23 10:48:50 -07:00
2021-01-23 01:51:25 -08:00
The returned signature is the first signature in the transaction, which
is used to identify the transaction ([transaction id](../../terminology.md#transanction-id)).
This identifier can be easily extracted from the transaction data before
submission.
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-10-05 21:47:47 -07:00
- `<string>` - fully-signed Transaction, as encoded string
2020-07-10 22:11:07 -07:00
- `<object>` - (optional) Configuration object containing the following field:
- `skipPreflight: <bool>` - if true, skip the preflight transaction checks (default: false)
2021-02-02 08:33:45 -08:00
- `preflightCommitment: <string>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment ) level to use for preflight (default: `"finalized"` ).
2020-10-05 21:47:47 -07:00
- `encoding: <string>` - (optional) Encoding used for the transaction data. Either `"base58"` (*slow*, **DEPRECATED** ), or `"base64"` . (default: `"base58"` ).
2018-08-23 10:48:50 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2021-01-23 01:51:25 -08:00
- `<string>` - First Transaction Signature embedded in the transaction, as base-58 encoded string ([transaction id](../../terminology.md#transanction-id))
2018-08-23 10:48:50 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2018-08-23 10:48:50 -07:00
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "sendTransaction",
"params": [
"4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT"
]
}
'
```
2018-08-23 10:48:50 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2020-05-19 12:08:19 -07:00
{"jsonrpc":"2.0","result":"2id3YC2jK9G5Wo2phDx4gJVAew8DcY5NAojnVuao8rkxwPYPe8cSwE5GzhEgJA2y8fVjDEo6iR6ykBvDxrTQrtpb","id":1}
```
### simulateTransaction
Simulate sending a transaction
#### Parameters:
2020-10-05 21:47:47 -07:00
- `<string>` - Transaction, as an encoded string. The transaction must have a valid blockhash, but is not required to be signed.
2020-07-10 22:11:07 -07:00
- `<object>` - (optional) Configuration object containing the following field:
- `sigVerify: <bool>` - if true the transaction signatures will be verified (default: false)
2021-02-02 08:33:45 -08:00
- `commitment: <string>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment ) level to simulate the transaction at (default: `"finalized"` ).
2020-10-05 21:47:47 -07:00
- `encoding: <string>` - (optional) Encoding used for the transaction data. Either `"base58"` (*slow*, **DEPRECATED** ), or `"base64"` . (default: `"base58"` ).
2020-05-19 12:08:19 -07:00
#### Results:
An RpcResponse containing a TransactionStatus object
2020-06-06 10:18:28 -07:00
The result will be an RpcResponse JSON object with `value` set to a JSON object with the following fields:
2020-11-03 12:53:17 -08:00
- `err: <object | string | null>` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions ](https://github.com/solana-labs/solana/blob/master/sdk/src/transaction.rs#L24 )
2020-07-10 22:11:07 -07:00
- `logs: <array | null>` - Array of log messages the transaction instructions output during execution, null if simulation failed before the transaction was able to execute (for example due to an invalid blockhash or signature verification failure)
2020-05-19 12:08:19 -07:00
#### Example:
```bash
2020-10-14 23:47:43 -07:00
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "simulateTransaction",
"params": [
"4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT"
]
}
'
```
2020-05-19 12:08:19 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 218
},
"value": {
"err": null,
"logs": [
"BPF program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri success"
]
}
},
"id": 1
}
2018-08-23 10:48:50 -07:00
```
2020-11-14 09:29:51 -08:00
## Subscription Websocket
2019-09-22 20:38:34 -07:00
2020-05-18 11:49:01 -07:00
After connecting to the RPC PubSub websocket at `ws://<ADDRESS>/` :
2019-09-22 20:38:34 -07:00
2020-07-10 22:11:07 -07:00
- Submit subscription requests to the websocket using the methods below
- Multiple subscriptions may be active at once
2021-01-26 11:23:07 -08:00
- Many subscriptions take the optional [`commitment` parameter ](jsonrpc-api.md#configuring-state-commitment ), defining how finalized a change should be to trigger a notification. For subscriptions, if commitment is unspecified, the default value is `"confirmed"` .
2019-09-21 21:31:10 -07:00
2019-09-21 22:11:59 -07:00
### accountSubscribe
2019-09-21 21:31:10 -07:00
2019-09-22 20:38:34 -07:00
Subscribe to an account to receive notifications when the lamports or data for a given account public key changes
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<string>` - account Pubkey, as base-58 encoded string
2020-07-23 12:38:28 -07:00
- `<object>` - (optional) Configuration object containing the following optional fields:
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2020-11-24 12:52:01 -08:00
- `encoding: <string>` - encoding for Account data, either "base58" (*slow*), "base64", "base64+zstd" or "jsonParsed".
2020-11-09 15:30:12 -08:00
"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 binary encoding, detectable when the `data` field is type `<string>` .
2018-10-10 13:51:43 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<number>` - Subscription id \(needed to unsubscribe\)
2019-09-22 20:38:34 -07:00
#### Example:
2018-10-10 13:51:43 -07:00
2020-10-14 23:47:43 -07:00
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "accountSubscribe",
"params": [
"CM78CPUeXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNH12",
{
"encoding": "base64",
2021-02-02 08:33:45 -08:00
"commitment": "finalized"
2020-10-14 23:47:43 -07:00
}
]
}
{
"jsonrpc": "2.0",
"id": 1,
"method": "accountSubscribe",
"params": [
"CM78CPUeXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNH12",
{
"encoding": "jsonParsed"
}
]
}
```
2020-07-23 12:38:28 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2020-07-23 12:38:28 -07:00
{"jsonrpc": "2.0","result": 23784,"id": 1}
2018-10-10 13:51:43 -07:00
```
2019-09-22 20:38:34 -07:00
#### Notification Format:
2020-10-14 23:47:43 -07:00
Base58 encoding:
```json
2020-05-21 09:33:24 -07:00
{
"jsonrpc": "2.0",
"method": "accountNotification",
"params": {
"result": {
"context": {
"slot": 5199307
},
"value": {
2020-08-15 22:16:06 -07:00
"data": ["11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHPXHRDEHrBesJhZyqnnq9qJeUuF7WHxiuLuL5twc38w2TXNLxnDbjmuR", "base58"],
2020-05-21 09:33:24 -07:00
"executable": false,
"lamports": 33594,
2020-07-23 12:38:28 -07:00
"owner": "11111111111111111111111111111111",
"rentEpoch": 635
}
},
"subscription": 23784
}
}
2020-10-14 23:47:43 -07:00
```
2020-07-23 12:38:28 -07:00
2020-10-14 23:47:43 -07:00
Parsed-JSON encoding:
```json
2020-07-23 12:38:28 -07:00
{
"jsonrpc": "2.0",
"method": "accountNotification",
"params": {
"result": {
"context": {
"slot": 5199307
},
"value": {
"data": {
2020-10-14 23:47:43 -07:00
"program": "nonce",
2020-08-07 10:37:39 -07:00
"parsed": {
"type": "initialized",
"info": {
2020-07-23 12:38:28 -07:00
"authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX",
"blockhash": "LUaQTmM7WbMRiATdMMHaRGakPtCkc2GHtH57STKXs6k",
"feeCalculator": {
"lamportsPerSignature": 5000
}
}
}
},
"executable": false,
"lamports": 33594,
"owner": "11111111111111111111111111111111",
2020-05-21 09:33:24 -07:00
"rentEpoch": 635
}
},
"subscription": 23784
}
}
2018-10-10 13:51:43 -07:00
```
2019-09-21 22:11:59 -07:00
### accountUnsubscribe
2019-09-22 20:38:34 -07:00
2019-03-07 14:58:11 -08:00
Unsubscribe from account change notifications
2018-10-10 13:51:43 -07:00
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<number>` - id of account Subscription to cancel
2018-10-10 13:51:43 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<bool>` - unsubscribe success message
2018-10-10 13:51:43 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```json
2018-10-10 13:51:43 -07:00
{"jsonrpc":"2.0", "id":1, "method":"accountUnsubscribe", "params":[0]}
2020-10-14 23:47:43 -07:00
```
Result:
```json
2018-10-10 13:51:43 -07:00
{"jsonrpc": "2.0","result": true,"id": 1}
```
2020-11-20 13:52:58 -08:00
### logsSubscribe
Subscribe to transaction logging. **UNSTABLE**
#### Parameters:
- `filter: <string>|<object>` - filter criteria for the logs to receive results by account type; currently supported:
- "all" - subscribe to all transactions except for simple vote transactions
- "allWithVotes" - subscribe to all transactions including simple vote transactions
- `{ "mentions": [ <string> ] }` - subscribe to all transactions that mention the provided Pubkey (as base-58 encoded string)
- `<object>` - (optional) Configuration object containing the following optional fields:
- (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
#### Results:
- `<integer>` - Subscription id \(needed to unsubscribe\)
#### Example:
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "logsSubscribe",
"params": [
{
"mentions": [ "11111111111111111111111111111111" ]
2020-12-07 11:00:52 -08:00
},
2020-11-20 13:52:58 -08:00
{
2021-02-02 08:33:45 -08:00
"commitment": "finalized"
2020-11-20 13:52:58 -08:00
}
]
}
{
"jsonrpc": "2.0",
"id": 1,
"method": "logsSubscribe",
"params": [ "all" ]
}
```
Result:
```json
{"jsonrpc": "2.0","result": 24040,"id": 1}
```
#### Notification Format:
Base58 encoding:
```json
{
"jsonrpc": "2.0",
"method": "logsNotification",
"params": {
"result": {
"context": {
"slot": 5208469
},
"value": {
"signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv",
"err": null,
"logs": [
"BPF program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri success"
]
}
},
"subscription": 24040
}
}
```
### logsUnsubscribe
Unsubscribe from transaction logging
#### Parameters:
- `<integer>` - id of subscription to cancel
#### Results:
- `<bool>` - unsubscribe success message
#### Example:
Request:
```json
{"jsonrpc":"2.0", "id":1, "method":"logsUnsubscribe", "params":[0]}
```
Result:
```json
{"jsonrpc": "2.0","result": true,"id": 1}
```
2019-09-21 22:11:59 -07:00
### programSubscribe
2019-09-21 21:31:10 -07:00
2019-09-22 20:38:34 -07:00
Subscribe to a program to receive notifications when the lamports or data for a given account owned by the program changes
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<string>` - program_id Pubkey, as base-58 encoded string
2020-07-23 12:38:28 -07:00
- `<object>` - (optional) Configuration object containing the following optional fields:
- (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2020-11-24 12:52:01 -08:00
- `encoding: <string>` - encoding for Account data, either "base58" (*slow*), "base64", "base64+zstd" or "jsonParsed".
2020-11-09 15:30:12 -08:00
"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>` .
2020-07-23 12:38:28 -07:00
- (optional) `filters: <array>` - filter results using various [filter objects ](jsonrpc-api.md#filters ); account must meet all filter criteria to be included in results
2019-03-07 09:14:47 -08:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<integer>` - Subscription id \(needed to unsubscribe\)
2019-09-22 20:38:34 -07:00
#### Example:
2019-03-07 09:14:47 -08:00
2020-10-14 23:47:43 -07:00
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "programSubscribe",
"params": [
"11111111111111111111111111111111",
{
"encoding": "base64",
2021-02-02 08:33:45 -08:00
"commitment": "finalized"
2020-10-14 23:47:43 -07:00
}
]
}
{
"jsonrpc": "2.0",
"id": 1,
"method": "programSubscribe",
"params": [
"11111111111111111111111111111111",
{
"encoding": "jsonParsed"
}
]
}
{
"jsonrpc": "2.0",
"id": 1,
"method": "programSubscribe",
"params": [
"11111111111111111111111111111111",
{
"encoding": "base64",
"filters": [
{
"dataSize": 80
}
]
}
]
}
```
2019-05-06 07:31:50 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2020-07-23 12:38:28 -07:00
{"jsonrpc": "2.0","result": 24040,"id": 1}
2019-03-07 09:14:47 -08:00
```
2019-09-22 20:38:34 -07:00
#### Notification Format:
2020-10-14 23:47:43 -07:00
Base58 encoding:
```json
2020-07-23 12:38:28 -07:00
{
"jsonrpc": "2.0",
"method": "programNotification",
"params": {
"result": {
"context": {
"slot": 5208469
},
"value": {
2020-10-14 23:47:43 -07:00
"pubkey": "H4vnBqifaSACnKa7acsxstsY1iV1bvJNxsCY7enrd1hq",
2020-07-23 12:38:28 -07:00
"account": {
2020-08-15 22:16:06 -07:00
"data": ["11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHPXHRDEHrBesJhZyqnnq9qJeUuF7WHxiuLuL5twc38w2TXNLxnDbjmuR", "base58"],
2020-07-23 12:38:28 -07:00
"executable": false,
"lamports": 33594,
"owner": "11111111111111111111111111111111",
"rentEpoch": 636
},
}
},
"subscription": 24040
}
}
2020-10-14 23:47:43 -07:00
```
2020-07-23 12:38:28 -07:00
2020-10-14 23:47:43 -07:00
Parsed-JSON encoding:
```json
2020-05-21 09:33:24 -07:00
{
"jsonrpc": "2.0",
"method": "programNotification",
"params": {
"result": {
"context": {
"slot": 5208469
},
"value": {
2020-10-14 23:47:43 -07:00
"pubkey": "H4vnBqifaSACnKa7acsxstsY1iV1bvJNxsCY7enrd1hq",
2020-05-21 09:33:24 -07:00
"account": {
2020-07-23 12:38:28 -07:00
"data": {
2020-10-14 23:47:43 -07:00
"program": "nonce",
2020-08-07 10:37:39 -07:00
"parsed": {
"type": "initialized",
"info": {
2020-07-23 12:38:28 -07:00
"authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX",
"blockhash": "LUaQTmM7WbMRiATdMMHaRGakPtCkc2GHtH57STKXs6k",
"feeCalculator": {
"lamportsPerSignature": 5000
}
}
}
},
2020-05-21 09:33:24 -07:00
"executable": false,
"lamports": 33594,
2020-07-23 12:38:28 -07:00
"owner": "11111111111111111111111111111111",
2020-05-21 09:33:24 -07:00
"rentEpoch": 636
},
}
},
"subscription": 24040
}
}
```
2019-03-07 09:14:47 -08:00
### programUnsubscribe
2019-09-22 20:38:34 -07:00
2019-03-07 09:14:47 -08:00
Unsubscribe from program-owned account change notifications
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<integer>` - id of account Subscription to cancel
2019-03-07 09:14:47 -08:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<bool>` - unsubscribe success message
2019-03-07 09:14:47 -08:00
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```json
2019-03-07 09:14:47 -08:00
{"jsonrpc":"2.0", "id":1, "method":"programUnsubscribe", "params":[0]}
2020-10-14 23:47:43 -07:00
```
Result:
```json
2019-03-07 09:14:47 -08:00
{"jsonrpc": "2.0","result": true,"id": 1}
```
2019-09-21 22:11:59 -07:00
### signatureSubscribe
2019-09-21 21:31:10 -07:00
2019-09-22 20:38:34 -07:00
Subscribe to a transaction signature to receive notification when the transaction is confirmed On `signatureNotification` , the subscription is automatically cancelled
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<string>` - Transaction Signature, as base-58 encoded string
- `<object>` - (optional) [Commitment ](jsonrpc-api.md#configuring-state-commitment )
2018-10-10 13:51:43 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `integer` - subscription id \(needed to unsubscribe\)
2019-09-22 20:38:34 -07:00
#### Example:
2018-10-10 13:51:43 -07:00
2020-10-14 23:47:43 -07:00
Request:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "signatureSubscribe",
"params": [
"2EBVM6cB8vAAD93Ktr6Vd8p67XPbQzCJX47MpReuiCXJAtcjaxpvWpcg9Ege1Nr5Tk3a2GFrByT7WPBjdsTycY9b"
]
}
2018-10-10 13:51:43 -07:00
2020-10-14 23:47:43 -07:00
{
"jsonrpc": "2.0",
"id": 1,
"method": "signatureSubscribe",
"params": [
"2EBVM6cB8vAAD93Ktr6Vd8p67XPbQzCJX47MpReuiCXJAtcjaxpvWpcg9Ege1Nr5Tk3a2GFrByT7WPBjdsTycY9b",
{
2021-02-02 08:33:45 -08:00
"commitment": "finalized"
2020-10-14 23:47:43 -07:00
}
]
}
```
2019-05-06 07:31:50 -07:00
2020-10-14 23:47:43 -07:00
Result:
```json
2018-10-10 13:51:43 -07:00
{"jsonrpc": "2.0","result": 0,"id": 1}
```
2019-09-22 20:38:34 -07:00
#### Notification Format:
2018-10-10 13:51:43 -07:00
```bash
2020-05-21 09:33:24 -07:00
{
"jsonrpc": "2.0",
"method": "signatureNotification",
"params": {
"result": {
"context": {
"slot": 5207624
},
"value": {
"err": null
}
},
"subscription": 24006
}
}
2018-10-10 13:51:43 -07:00
```
2019-09-21 22:11:59 -07:00
### signatureUnsubscribe
2019-09-22 20:38:34 -07:00
2019-03-04 18:07:16 -08:00
Unsubscribe from signature confirmation notification
2018-10-10 13:51:43 -07:00
2019-09-22 20:38:34 -07:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<integer>` - subscription id to cancel
2018-10-10 13:51:43 -07:00
2019-09-22 20:38:34 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<bool>` - unsubscribe success message
2018-10-10 13:51:43 -07:00
2019-09-22 20:38:34 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```json
2018-10-10 13:51:43 -07:00
{"jsonrpc":"2.0", "id":1, "method":"signatureUnsubscribe", "params":[0]}
2020-10-14 23:47:43 -07:00
```
Result:
```json
2018-10-10 13:51:43 -07:00
{"jsonrpc": "2.0","result": true,"id": 1}
```
2020-01-21 19:17:33 -08:00
### slotSubscribe
Subscribe to receive notification anytime a slot is processed by the validator
#### Parameters:
None
#### Results:
2020-07-10 22:11:07 -07:00
- `integer` - subscription id \(needed to unsubscribe\)
2020-01-21 19:17:33 -08:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```json
2020-01-21 19:17:33 -08:00
{"jsonrpc":"2.0", "id":1, "method":"slotSubscribe"}
2020-10-14 23:47:43 -07:00
```
Result:
```json
2020-01-21 19:17:33 -08:00
{"jsonrpc": "2.0","result": 0,"id": 1}
```
#### Notification Format:
```bash
2020-05-21 09:33:24 -07:00
{
"jsonrpc": "2.0",
"method": "slotNotification",
"params": {
"result": {
"parent": 75,
"root": 44,
"slot": 76
},
"subscription": 0
}
}
2020-01-21 19:17:33 -08:00
```
### slotUnsubscribe
2020-03-27 09:33:40 -07:00
Unsubscribe from slot notifications
2020-01-21 19:17:33 -08:00
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<integer>` - subscription id to cancel
2020-01-21 19:17:33 -08:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<bool>` - unsubscribe success message
2020-01-21 19:17:33 -08:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```json
2020-01-21 19:17:33 -08:00
{"jsonrpc":"2.0", "id":1, "method":"slotUnsubscribe", "params":[0]}
2020-10-14 23:47:43 -07:00
```
Result:
```json
2020-01-21 19:17:33 -08:00
{"jsonrpc": "2.0","result": true,"id": 1}
```
2020-03-27 09:33:40 -07:00
### rootSubscribe
Subscribe to receive notification anytime a new root is set by the validator.
#### Parameters:
None
#### Results:
2020-07-10 22:11:07 -07:00
- `integer` - subscription id \(needed to unsubscribe\)
2020-03-27 09:33:40 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```json
2020-03-27 09:33:40 -07:00
{"jsonrpc":"2.0", "id":1, "method":"rootSubscribe"}
2020-10-14 23:47:43 -07:00
```
Result:
```json
2020-03-27 09:33:40 -07:00
{"jsonrpc": "2.0","result": 0,"id": 1}
```
#### Notification Format:
The result is the latest root slot number.
```bash
2020-05-21 09:33:24 -07:00
{
"jsonrpc": "2.0",
"method": "rootNotification",
"params": {
"result": 42,
"subscription": 0
}
}
2020-03-27 09:33:40 -07:00
```
### rootUnsubscribe
Unsubscribe from root notifications
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<integer>` - subscription id to cancel
2020-03-27 09:33:40 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<bool>` - unsubscribe success message
2020-03-27 09:33:40 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```json
2020-03-27 09:33:40 -07:00
{"jsonrpc":"2.0", "id":1, "method":"rootUnsubscribe", "params":[0]}
2020-10-14 23:47:43 -07:00
```
Result:
```json
2020-03-27 09:33:40 -07:00
{"jsonrpc": "2.0","result": true,"id": 1}
```
2020-05-17 14:01:08 -07:00
2020-11-14 09:29:51 -08:00
### voteSubscribe - Unstable, disabled by default
**This subscription is unstable and only available if the validator was started
with the `--rpc-pubsub-enable-vote-subscription` flag. The format of this
subscription may change in the future**
2020-05-17 14:01:08 -07:00
Subscribe to receive notification anytime a new vote is observed in gossip.
These votes are pre-consensus therefore there is no guarantee these votes will
enter the ledger.
#### Parameters:
None
#### Results:
2020-07-10 22:11:07 -07:00
- `integer` - subscription id \(needed to unsubscribe\)
2020-05-17 14:01:08 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```json
2020-05-17 14:01:08 -07:00
{"jsonrpc":"2.0", "id":1, "method":"voteSubscribe"}
2020-10-14 23:47:43 -07:00
```
Result:
```json
2020-05-17 14:01:08 -07:00
{"jsonrpc": "2.0","result": 0,"id": 1}
```
#### Notification Format:
The result is the latest vote, containing its hash, a list of voted slots, and an optional timestamp.
2020-10-14 23:47:43 -07:00
```json
2020-05-21 09:33:24 -07:00
{
"jsonrpc": "2.0",
"method": "voteNotification",
"params": {
"result": {
"hash": "8Rshv2oMkPu5E4opXTRyuyBeZBqQ4S477VG26wUTFxUM",
"slots": [1, 2],
"timestamp": null
},
"subscription": 0
}
}
2020-05-17 14:01:08 -07:00
```
### voteUnsubscribe
Unsubscribe from vote notifications
#### Parameters:
2020-07-10 22:11:07 -07:00
- `<integer>` - subscription id to cancel
2020-05-17 14:01:08 -07:00
#### Results:
2020-07-10 22:11:07 -07:00
- `<bool>` - unsubscribe success message
2020-05-17 14:01:08 -07:00
#### Example:
2020-10-14 23:47:43 -07:00
Request:
```json
2020-05-17 14:01:08 -07:00
{"jsonrpc":"2.0", "id":1, "method":"voteUnsubscribe", "params":[0]}
2020-10-14 23:47:43 -07:00
```
2020-05-17 14:01:08 -07:00
2020-10-14 23:47:43 -07:00
Response:
```json
2020-05-17 14:01:08 -07:00
{"jsonrpc": "2.0","result": true,"id": 1}
```