We use necessary cookies for site function. For analytics and marketing, we need your consent. You can change your mind anytime. Privacy Policy

Stellar from native code — XDR, transactions, Soroban, and ISO 20022 in modern C++20
Stellar · C++ · SDK

Build Stellar Apps in C++20: Meet the stellar-cpp-sdk

Olvis GilOlvis Gil  ·  November 16, 2026  ·  8 min read

Stellar’s SDK story has a gap: JavaScript, Go, Rust, Java, Python — but no modern C++ option for the huge world of software already written in it. stellar-cpp-sdk fills it: an Apache-2.0, C++20 SDK built from scratch on SDF’s canonical xdr.json AST, with a Result<T> error model, a synchronous thread-safe API, and live-testnet verification. It already speaks Protocol 30 — the Bell upgrade — including the new W address type for muxed contract accounts.

Why C++ on Stellar?

Trading systems, game engines, embedded devices, payment terminals, and a lot of financial infrastructure run on C++ — and those teams shouldn’t have to shell out to another language’s CLI to touch the network. The SDK is designed for exactly that: private dependencies (libsodium, libcurl, pugixml) never leak into public headers, so it drops into an existing CMake project without dependency drama.

What’s inside

Full XDR layer. 495 definitions generated from stellar-xdr v30.0.0, a strict big-endian codec with depth and length limits, a runtime type registry, and a stellar-xdr-cpp CLI for inspecting XDR on the command line. Core primitives. All ten SEP-23 strkey kinds — including CAP-84 W muxed contracts — libsodium Ed25519 keys, fixed-point Amount/Price/128–256-bit integers, SEP-5 mnemonics, and SEP-53 message signing. Transactions. A TransactionBuilder with mandatory time bounds (unless you explicitly opt out), all 27 operation factories, fee-bump envelopes, CAP-40 signed payloads, and hash-x signatures — verified byte-for-byte against stellar-base across a 32-case compatibility matrix.

Stellar RPC. All 13 methods including queryEvents/getTransactions, parsed by the SDK’s own strict JSON layer (zero external JSON dependency), plus streaming with cancellation, a retrying transport that honors Retry-After, and a send_and_poll helper that handles TRY_AGAIN_LATER and DUPLICATE correctly. Soroban contracts. ScVal construction with canonical sorting, a ContractClient for call/invoke/deploy with fee-bump and auto-restore options, authorization signing across all three credential arms (including CAP-71-01 delegation trees), a WASM custom-section metadata reader, and spec-driven JSON arguments — plus a TokenClient for SEP-41 tokens.

ISO 20022 (optional component). Emit and parse pacs.008/002/004, pain.001/002, and camt.053/054 XML mapped to Stellar payments — batch totals, UETRs, and status-report reconciliation — validated against the official XSDs vendored in the repo. If you work where blockchain meets banking messages, this alone is unusual.

It looks like this

#include <stellar/sdk.hpp>
using namespace stellar;

// keys + network (always explicit — no global default)
STELLAR_TRY_ASSIGN(kp, KeyPair::from_secret(secret_seed));
Network net = Network::testnet();

// transactions
TransactionBuilder tx(kp.account_id());
tx.sequence_number(123).fee(100).time_bounds(0, 3600)
  .add_operation(ops::payment(dest, Asset::native(),
                              *Amount::parse("10")));
STELLAR_TRY_ASSIGN(built, tx.build());
auto env = TransactionEnvelope::of_transaction(*built);
env.sign(*kp, net);

// RPC
CurlTransport http;
RpcClient rpc(http, "https://soroban-testnet.stellar.org");
STELLAR_TRY_ASSIGN(sent, rpc.send_and_poll(env));

// contracts (spec-driven)
ContractClient cc(rpc, net, "C...CONTRACT_ID");
cc.set_spec(*ContractSpec::decode(meta.spec_entries_xdr));
auto r = cc.call_json(kp.account_id(), "transfer",
    Json::parse(R"({"to":"G...","amount":"100"})").value());

Build and install

CMake presets keep it one line: cmake --preset dev && cmake --build --preset dev && ctest --preset dev. You need CMake 3.24+ and a C++20 compiler (GCC 11+, Clang 14+, MSVC 2022+). Dependencies — libsodium, libcurl, pugixml — come via vcpkg automatically, or via your package manager (brew install libsodium curl pugixml). Prefer vcpkg for the SDK itself? The repo ships a port, so vcpkg install stellar-cpp-sdk plus find_package(StellarSdk COMPONENTS core xdr rpc) works out of the box.

Status: v0.1.0, testnet-verified

This is an early release with the foundations done: 84/84 unit tests plus five live-testnet integration tests green on dev and asan-ubsan presets. Horizon REST/SSE streaming and the wallet/anchor SEPs are the next phases. For a codebase this young, the verification posture is refreshingly serious — fixture matrices against stellar-base, fuzz presets, and a generated RPC conformance matrix in compatibility/.

Keep learning

stellar-cpp-sdk on GitHub · Stellar Go CLI · Build Stellar apps with Go · Bell, Protocol 30 · Stellar hub · Stellar Network masterclass

Frequently asked questions

What is the stellar-cpp-sdk?
An open-source, Apache-2.0 C++20 SDK for the Stellar network. It covers XDR encoding/decoding, keypairs and strkeys, transaction building and signing, the Stellar RPC interface, Soroban smart contracts, and optional ISO 20022 payment-message reporting — verified end-to-end on live testnet.
Does it support Protocol 30 (Bell)?
Yes. Its 495 XDR definitions are generated from stellar-xdr v30.0.0, and its strkey layer already handles the CAP-84 W address type for muxed contract addresses introduced in Bell.
How do I build it?
With CMake presets: `cmake --preset dev && cmake --build --preset dev && ctest --preset dev`. It needs CMake 3.24+, a C++20 compiler (GCC 11+, Clang 14+, MSVC 2022+), and libsodium, libcurl, and pugixml — pinned automatically through vcpkg or installable via your system package manager.
Can I install it with vcpkg?
Yes — the repo ships a port under ports/stellar-cpp-sdk and documents a git-registry configuration, so `vcpkg install stellar-cpp-sdk` works alongside `find_package(StellarSdk COMPONENTS core xdr rpc)` in your CMakeLists.
What can I build with it?
Anything that needs Stellar from native code: payment services, trading bots, embedded/IoT devices, game integrations, contract-deploy tooling, or financial ISO 20022 reporting — all places where C++ is already the language of record.
Share this article
Olvis Gil
Olvis Gil

Founder of EduNode and OG Technologies EU — a Vienna consultancy for blockchain payments, tokenization, digital identity, and ISO 20022.