OpenViSTAI · Agents · Blockchain · Crypto
Menu
Developer Tools

Solanaj — dongyuhao66

Solanaj is an open-source Java client library for integrating applications with Solana through its JSON-RPC API. It includes examples for balance queries, keypair handling, SOL and SPL-token transactions, associated token addresses and nonce-account workflows.

Independent OpenViST project profile, based on linked sources.

Solanaj — dongyuhao66 — 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 a Java application needs library-level access to Solana RPC for account queries or transaction workflows.

Who it is for

  • Java developers integrating applications with Solana RPC.
  • Teams building Java wallet or transaction utilities for SOL or SPL tokens.

Documented uses

  • Query a Solana account balance.
  • Generate a keypair and derive its public address.
  • Construct, sign and submit SOL or SPL-token transactions.
  • Calculate associated token addresses and work with nonce accounts.
Before you choose

Requirements & limits

The repository is public and identifies the project as MIT-licensed open source.

  • Java 8 or later is listed as a requirement.
  • The README names bitcoinj, OkHttp and Moshi as dependencies.
  • The examples use TESTNET for balance and SOL-transfer calls and DEVNET for nonce-account creation.
  • The project provides Java library code rather than a hosted end-user wallet.

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

Query a Solana account balance with solanaj

Read an account balance through a TESTNET RPC client.

Before you start

  • Java 8+
  • The solanaj library and its listed dependencies: bitcoinj, OkHttp, and Moshi
  • A Solana public key to query

Steps

  1. Create an RpcClient configured with Cluster.TESTNET.

  2. Create a PublicKey for the account address.

  3. Call client.getApi().getBalance(publicKey) and store the returned value as a long.

Expected outcome

The example obtains the account balance as a `long` from the TESTNET RPC API.

Guide limitations

  • The example does not document error handling or RPC endpoint configuration.
Source-based practical guide

Construct and submit a lamport transfer on TESTNET

Build a transfer instruction, sign it with an account, and submit the transaction using the TESTNET RPC client.

Before you start

  • Java 8+
  • The solanaj library and its listed dependencies: bitcoinj, OkHttp, and Moshi
  • The sender's secret key and source and destination public keys

Steps

  1. Create an RpcClient configured with Cluster.TESTNET, then construct PublicKey objects for the sender and recipient.

  2. Create an Account from the sender's secret key and a Transaction.

  3. Add a SystemProgram.transfer(fromPublicKey, toPublicKey, lamports) instruction to the transaction.

  4. Submit it with client.getApi().sendTransaction(transaction, signer) and retain the returned signature.

Expected outcome

The example submits a signed lamport transfer and returns a transaction signature.

Guide limitations

  • The example does not document error handling or how to obtain and secure the sender's secret key.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
15 October 2026
Original website title
dongyuhao66/solanaj · Official homepage title · retained in its source language