A Go SDK for building applications on the XRP Ledger. Query the ledger, manage wallets, and sign and submit transactions with typed Go models.
Documentation · API reference · Examples · Contributing
Requires Go 1.26.11 or later. The core SDK is pure Go and does not require a C/C++ toolchain.
From your application's Go module, install the SDK:
go get github.com/Peersyst/xrpl-go@latestFor a new application, run go mod init example.com/my-xrpl-app first.
Save this as main.go to query a Testnet server. No wallet or funds are needed.
package main
import (
"fmt"
"log"
"github.com/Peersyst/xrpl-go/xrpl/queries/server"
"github.com/Peersyst/xrpl-go/xrpl/rpc"
)
func main() {
cfg, err := rpc.NewClientConfig("https://s.altnet.rippletest.net:51234/")
if err != nil {
log.Fatal(err)
}
client := rpc.NewClient(cfg)
info, err := client.GetServerInfo(&server.InfoRequest{})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Connected to Testnet. Server version: %s\n", info.Info.ServerVersion())
}Resolve its dependencies and run it:
go mod tidy
go run .With network access, it prints the server's software version. To send your first payment, follow the Testnet payment example.
- Query ledger data with JSON-RPC, or subscribe to updates with WebSocket.
- Create and submit transactions using typed transaction models, autofill, and submission helpers that wait for validation.
- Manage wallets and sign locally, including multisigning and derivation from seeds or mnemonics. See the wallet guide.
- Work with XRPL encodings through the address codec, binary codec, and keypair utilities.
The usual transaction flow is:
- Build a typed transaction and call
Flatten(). - Call
client.Autofill()to set network fields such as the fee and sequence. - Sign locally with
wallet.Sign(). - Submit with
client.SubmitTxBlobAndWait().
For the combined flow, use client.SubmitTxAndWait() with SubmitOptions.Wallet and explicit Autofill: true to autofill, sign, submit, and wait in one call. Autofill is disabled by default. For offline signing, keep autofill and signing separate: autofill needs network access, signing does not.
See the payment example for the complete flow and the examples directory for more use cases.
Most applications only need the core SDK. For confidential MPT encryption, balance decryption, commitments, proofs, and transaction builders, use the separate github.com/Peersyst/xrpl-go/confidential module.
Core already includes the transaction models and ledger fields. It can encode, sign, and submit confidential transactions when your application supplies the ciphertexts and proofs. The optional module generates these fields and decrypts balances.
The helpers require a native C/C++ toolchain and cgo for cryptographic operations on Linux or macOS with amd64 or arm64. Both modules require Go 1.26.11 or later. They are versioned independently, and core does not depend on the optional module.
See the confidential README for release availability, installation, migration, and platform requirements, or start with the confidential examples.
- Guides for setup, clients, wallets, and transactions.
- Go API reference for package types and methods.
- Core changelog and confidential changelog for release changes.
- XRPL documentation for ledger concepts and protocol rules.
Found a bug or a documentation gap? Open an issue.
The signing functionality in this repository has not been independently audited. Test on Testnet or Devnet first, and review signing behavior before using it to control production funds.
Never print, log, commit, or send real seeds, private keys, or mnemonics to telemetry. Anyone with those values can control the account.
See CONTRIBUTING.md for development setup, tests, and pull request guidance. To work on both modules, follow the confidential development setup. Root go test ./... only tests core.
MIT.