Skip to content

SolaceA Ruby SDK for Solana

Build, sign, and send Solana transactions from idiomatic Ruby — low-level instruction builders, high-level composers, and program clients, with a native Ed25519/Curve25519 extension.

What is Solace?

Solace is a Ruby SDK for the Solana blockchain. It follows Ruby conventions while staying faithful to Solana's binary protocols, and it gives you the whole stack — from hand-assembling a message byte by byte, to one-call program clients that derive accounts, sign, and submit for you.

ruby
require 'solace'

connection = Solace::Connection.new('https://api.mainnet-beta.solana.com')
keypair    = Solace::Keypair.generate

connection.get_balance(keypair.address) # => 0

Four layers, pick your altitude

Solace is organized as four layers. Higher layers are more convenient; lower layers give you more control. Every operation is reachable at more than one level — see Conventions.

LayerWhat it isReach for it when
Program clientsSolace::Programs::* — send-and-sign clients that derive accounts, build, sign, and submit (e.g. SplToken#create_mint).You want one call that does everything.
ComposersSolace::Composers::* — each contributes one instruction to a transaction, managing its own accounts. Assembled by TransactionComposer.You're batching several instructions, or want control over the fee payer and signing.
Instruction buildersSolace::Instructions::* — stateless .build methods that encode a single raw instruction from account indices.You need byte-level control and are assembling the message yourself.
Core primitivesKeypair, PublicKey, Connection, Transaction, Message, Instruction, AccountContext.The foundation everything else is built on.

What's covered

Extending Solace

Solace is designed to be extended. The Squads Smart Accounts gem adds the Squads Smart Account program by following the same instruction-builder → composer → program-client pattern documented here. The Building Transactions section is the blueprint for writing your own program support.

Install

ruby
# Gemfile
gem 'solace'
sh
bundle install

Native binaries for the Curve25519 operations ship with the gem for Linux, macOS, and Windows (x86_64 and ARM64) — there is nothing to compile.

A Ruby SDK for Solana