Installation
This guide will walk you through adding Sava to your Java project using Gradle.Prerequisites
Before installing Sava, ensure you have:- Java 21 or later - Sava requires modern Java features
- Gradle - For dependency management (Maven support coming soon)
- GitHub Account - Required for accessing Sava packages
Sava is distributed via GitHub Package Repository and requires authentication to download dependencies.
Setup Instructions
Generate a GitHub Token
You’ll need a GitHub personal access token with the
read:packages scope.- Go to GitHub Settings > Tokens
- Click “Generate new token (classic)”
- Give it a descriptive name like “Sava Package Access”
- Select the
read:packagesscope - Click “Generate token”
- Copy the token immediately (you won’t be able to see it again)
Configure Gradle Credentials
Add your GitHub credentials to Replace
~/.gradle/gradle.properties:YOUR_GITHUB_USERNAME with your GitHub username and YOUR_GITHUB_TOKEN with the token you just generated.Add Dependencies
Choose the Sava modules you need and add them to your
build.gradle.kts:build.gradle.kts
Available Modules
sava-core
The core module provides fundamental Solana functionality:- Cryptography: Ed25519 key generation, signing, and verification
- Encoding: Base58, Base64, and Borsh serialization
- Accounts: PublicKey and Signer implementations
- Transactions: Transaction building and serialization
- Programs: Common Solana program interfaces
- Tokens: SPL token types and utilities
sava-rpc
The RPC module provides clients for interacting with Solana nodes:- HTTP Client: Complete Solana JSON-RPC API implementation
- WebSocket Client: Real-time account and transaction subscriptions
- Type-safe Responses: Strongly-typed response parsing
- Async APIs: CompletableFuture-based async operations
- Network Helpers: Pre-configured endpoints for mainnet, testnet, and devnet
The
sava-rpc module depends on sava-core, so you don’t need to explicitly include both if you’re using RPC functionality.Module Selection Guide
Choose modules based on your use case:| Use Case | Required Modules |
|---|---|
| Building transactions offline | sava-core |
| Querying blockchain data | sava-core, sava-rpc |
| Building a trading bot | sava-core, sava-rpc |
| Working with tokens | sava-core |
| Real-time account monitoring | sava-core, sava-rpc |
Troubleshooting
Authentication Errors
If you see authentication errors when syncing:- Verify your GitHub token has the
read:packagesscope - Check that your username and token are correctly set in
gradle.properties - Ensure there are no extra spaces in the credentials
Package Not Found
If Gradle can’t find Sava packages:- Verify the repository URL is correct in
settings.gradle.kts - Check that you’re using a valid version number
- Ensure your GitHub token hasn’t expired
Build Errors
If you encounter build errors:- Verify you’re using Java 21 or later:
java -version - Clean and rebuild:
./gradlew clean build - Check for conflicting dependencies