services
Get a key

library / How to use Solana

Accounts and balances

Accounts and balances in the Carbium Library: 8 working Solana examples, among them PDA existence check and Account info response fields.

  • PDA existence check HS0080

    Tell whether a program derived address is absent, funded but still owned by the System program, or initialized, with one getMultipleAccounts read.

  • Account info response fields HS0079

    Read every getAccountInfo field on Carbium RPC for a wallet, a mint, a program and a missing address, with the slot, in one read-only TypeScript file.

  • Zero-copy account decoder HS0077

    Decode an Anchor zero_copy account by hand: check the discriminator, read fixed offsets and prove them against the mints, on Carbium RPC.

  • BigInt lamport amounts HS0046

    Keep lamports and raw token amounts exact in JavaScript: read them as bigint, print them next to Number, and parse raw JSON-RPC bodies without losing digits.

  • Same-slot multi-account snapshot HS0045

    Read several Solana accounts as of one slot with getMultipleAccounts, check context.slot against separate reads, and see where the guarantee stops.

  • Rent-exempt minimum calculator HS0020

    Get the rent-exempt minimum in lamports for any account size with getMinimumBalanceForRentExemption, in one read-only TypeScript file.

  • Account data encodings HS0019

    Fetch an account with getAccountInfo in base64, base58, zstd and jsonParsed on Carbium RPC, then decode the bytes in one read-only TypeScript file.

  • SOL balances for many accounts HS0016

    Read the SOL balance of a whole list of accounts with getMultipleAccounts, 100 addresses per call, in one read-only TypeScript file on Carbium RPC.