Returns all information associated with the account of provided public key.

Parameters

account
string
required

The public key of the account to query (base-58 encoded string)

config
object

Configuration object containing the following optional fields:

Response

result
object | null

If the requested account doesn’t exist, returns null. Otherwise, returns an object containing:

Code Examples

Basic Request

curl https://rpc.orbitflare.com -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": {
      "slot": 430
    },
    "value": {
      "data": ["", "base58"],
      "executable": false,
      "lamports": 5000000000,
      "owner": "11111111111111111111111111111111",
      "rentEpoch": 18446744073709551615,
      "space": 0
    }
  },
  "id": 1
}

Request with Data Slice

curl https://rpc.orbitflare.com -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getAccountInfo",
  "params": [
    "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
    {
      "encoding": "base64",
      "dataSlice": {
        "offset": 0,
        "length": 64
      }
    }
  ]
}'

Using web3.js

import { Connection, PublicKey } from '@solana/web3.js';

const connection = new Connection('https://rpc.orbitflare.com');
const publicKey = new PublicKey('vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg');

const accountInfo = await connection.getAccountInfo(
  publicKey,
  'confirmed'
);

Notes

  1. The jsonParsed encoding is only available for certain account types:

    • Stake account
    • Token account
    • Token mint
    • Token metadata
  2. When using dataSlice, the data field will be limited to the requested slice only.

  3. The account data may be encoded differently based on the program that owns the account.

Common Errors

CodeMessageSolution
-32602Invalid param: WrongSizeVerify the public key is valid
-32602Invalid param: not base58 encoded stringEnsure the public key is base58 encoded
-32007Account not foundThe requested account does not exist