OpenViSTAI · Agents · Blockchain · Crypto
Menu
Developer Tools

Solana Rust Examples

Solana Rust Examples is a collection of Rust command-line scripts for interacting with Solana, covering wallet generation, SPL token creation and minting, token-balance checks, NFT ownership and listing queries, account creation timestamps, slot subscription, Anchor IDL retrieval, SOL transfers and SOL wrapping.

Independent OpenViST project profile, based on linked sources.

Solana Rust Examples — OpenViST project profile in Developer Tools.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when you want a terminal-based Rust example for a specific Solana operation and can supply the endpoint, public keys, and—where required—a signer keypair.

Who it is for

  • Developers learning how Rust programs interact with Solana.
  • Developers who want command-line examples for specific wallet, token, NFT or account-inspection tasks.

Documented uses

  • Generate a wallet and print its public key and private-key representations.
  • Create an SPL token mint, mint tokens, or check an associated token balance.
  • Find an NFT owner or list NFT mint addresses held by a wallet.
  • Inspect an account creation timestamp, listen for slot updates, or fetch an on-chain Anchor IDL.
  • Transfer SOL with a memo and priority fee, or wrap SOL into the signer’s WSOL associated token account.
Before you choose

Requirements & limits

  • The documented entry point is cargo run -- .
  • Chain queries and operations require the command-specific Solana RPC URL; the pubsub command uses a WebSocket URL.
  • Transaction commands require a signer keypair, and minting additionally requires that signer to be the mint authority.
  • The new-wallet command prints private-key material in Base58 and JSON formats.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Check an associated SPL token balance

Print the balance for a wallet and SPL token mint using the documented command.

Before you start

  • A Solana RPC endpoint
  • The wallet public key
  • The SPL token mint account public key
  • The Rust project available to run with Cargo

Steps

  1. Choose an RPC endpoint and collect the wallet and mint public keys.

  2. Run the command below.

    Documented command
    cargo run -- associated-token-balance --rpc-url --wallet-pubkey --mint-account-pubkey 

Expected outcome

The command prints the associated token account balance.

Guide limitations

  • The command requires the RPC URL and both public keys.
  • The documentation describes the command but does not provide a broader wallet or token-management workflow.
Source-based practical guide

Listen for Solana slot updates

Listen to slotSubscribe events and print a specified number of updates.

Before you start

  • A Solana WebSocket endpoint
  • The Rust project available to run with Cargo

Steps

  1. Choose a Solana WebSocket endpoint.

  2. Run the command below with the desired number of updates.

    Documented command
    cargo run -- pubsub --ws-url --count 

Expected outcome

The command listens for slotSubscribe events and prints updates up to the requested count.

Guide limitations

  • The command requires a WebSocket endpoint; the documented default count is five.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
17 October 2026
Original website title
ronanyeah/solana-rust-examples · Official homepage title · retained in its source language