$ show lightsail-network/java-stellar-sdk
The Java Stellar SDK is a comprehensive client library for interacting with the Stellar blockchain network, providing both Horizon REST API bindings and Soroban smart contract support. It handles transaction construction, signing, and submission, as well as account management, asset operations, liquidity pools, and decentralized exchange path finding. The library is built on a robust XDR codec layer generated from protocol definitions, with handcrafted decoders that enforce depth limits and size constraints for safe binary parsing. It also includes a SPI-based platform abstraction for Base32/Base64 encoding to support Android deployments, and a sophisticated contract client that manages Soroban transaction lifecycle (simulation, restoration, signing, and submission). The codebase is actively maintained, with a large test suite spanning Java and Kotlin, CI/CD pipelines, and support for the latest Stellar protocol features (CAP-71, CAP-85, SEP-10/45/51/53). While the XDR generation pipeline requires periodic regeneration, the core SDK abstractions are well-isolated and exhibit strong engineering practices such as builder patterns, immutable value objects, and custom Gson deserializers for Horizon response parsing.
The LLM identified 4 files worth highlighting for reuse:
Hand-crafted binary input stream decoder for XDR protocol messages, featuring recursive depth limiting (default max depth 1000) to prevent stack overflow, explicit size validation to protect against resource exhaustion, and support for variable-length strings (UTF-8 and ASCII), arrays, and enums. It is independent of the generated XDR types and can be reused in any project requiring safe XDR or similar TLV binary format deserialization.
Paired output stream for writing XDR binary data, providing typed methods for integers, booleans, variable-length strings, and arrays. This component is essential for any Stellar SDK implementation and can be extracted for custom binary protocol serialization with minimal adaptation.
Standalone WebAssembly binary parser that extracts custom sections (specifically those used by Soroban contracts for metadata like spec entries and meta version). Implements LEB128 variable-length integer decoding and UTF-8 validation. Designed for reuse in any WASM analysis project, not coupled to Stellar-specific logic beyond the expected section names.
Static utility class providing factory and conversion methods for Soroban SCVal types (int32, uint64, address, bytes, strings, maps, vectors, etc.). Includes a map key comparator that enforces Soroban's sorting order (by type discriminator then value). This pattern is reusable for any application dealing with Stellar smart contract parameters without needing the full SDK.