getAccountInfo RPC Method
Returns all information associated with the account of provided Pubkey
Parameters#
stringrequired
Pubkey of account to query, as base-58 encoded string
objectoptional
Configuration object containing the following fields:
The commitment describes how finalized a block is at that point in time.
Encoding format for Account data
Values:
base58base64base64+zstdjsonParsedbase58is slow and limited to less than 129 bytes of Account data.base64will return base64 encoded data for Account data of any size.base64+zstdcompresses the Account data using Zstandard and base64-encodes the result.jsonParsedencoding attempts to use program-specific state parsers to return more human-readable and explicit account state data.- If
jsonParsedis requested but a parser cannot be found, the field falls back tobase64encoding, detectable when thedatafield is typestring.
dataSliceobjectoptional
Request a slice of the account's data.
length: <usize>- number of bytes to returnoffset: <usize>- byte offset from which to start reading
Data slicing is only available for base58, base64, or base64+zstd
encodings.
minContextSlotnumberoptional
The minimum slot that the request can be evaluated at.
Result#
The result will be an RpcResponse JSON object with value equal to:
<null>- if the requested account doesn't exist<object>- otherwise, a JSON object containing:lamports: <u64>- number of lamports assigned to this account, as a u64owner: <string>- base-58 encoded Pubkey of the program this account has been assigned todata: <[string, encoding]|object>- data associated with the account, either as encoded binary data or JSON format{<program>: <state>}- depending on encoding parameterexecutable: <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 u64space: <u64>- the data size of the account
Code sample#
curl https://api.devnet.solana.com -s -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getAccountInfo",
"params": [
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
{
"encoding": "base58"
}
]
}
'
Response#
{
"jsonrpc": "2.0",
"result": {
"context": { "apiVersion": "2.0.15", "slot": 341197053 },
"value": {
"data": ["", "base58"],
"executable": false,
"lamports": 88849814690250,
"owner": "11111111111111111111111111111111",
"rentEpoch": 18446744073709551615,
"space": 0
}
},
"id": 1
}
Try It