Skip to content

dlgrech/ksol

Repository files navigation

kSol - Kotlin library for Solana

kSol is a kotlin library for interacting with the Solana blockchain.

Features include:

  • First-class Kotlin API for interacting with the Solana JSON-RPC API.
  • Key management, including generate new public/private keys, seed phrases etc
  • Crafting and parsing Solana transactions
  • Signing and sending transactions
  • Subscribing to transaction/account updates
  • SolPay integration (including transfer & transaction requests)

The goal of the library is to provide everything that is needed to integrate with the Solana blockchain without relying on libraries from any other environment (like executing JS or native code). The library could be used in a native Android app, command line tool or as part of a JVM-backend service.

Structure

The repository is structured into some high-level gradle modules:

  • ksol-core: Provides common models and functionality. Depended on by other ksol modules
  • ksol-keygen: Utilities for generating keypairs and dealing with seed phrases
  • ksol-rpc: A coroutines based wrapper around the Solana JSON-RPC and subscriptions API
    • The SolanaApi interface provides all the high-level functionality of the JSON RPC.
  • ksol-solpay: High-level library for working with SolPay urls.
    • The SolPay interface provides an entry point to all Solpay-related functionality.
  • ksol-cli: A Kotlin command line app for using the functionality of the core library.
    • This could be used as a (pointless) replacement for the standard Solana CLI tools.
    • The built in commands also offer a good look at how to use the library. The SendCommand, for example, shows creating, signing and sending a transaction as well as listening for finalization.

Dependencies

Different functionality is split into different dependencies.

You can find the latest version of each library here

implementation "io.github.dlgrech:ksol-core:<LATEST-VERSION>"
implementation "io.github.dlgrech:ksol-solpay:<LATEST-VERSION>"
implementation "io.github.dlgrech:ksol-rpc:<LATEST-VERSION>"
implementation "io.github.dlgrech:ksol-keygen:<LATEST-VERSION>"