protocol-rs
Rust bindings for the Thruput protocol: its data structures, contract syscall interface and node RPC interfaces, generated from the protocol's XDR definitions.
| Crate | Contents |
|---|---|
thruput-xdr |
Protocol types (transactions, contracts, events, storage, auth) and the contract syscall bindings |
thruput-xdr-macros |
Proc macros that generate the syscall bindings in thruput-xdr |
thruput-syscall |
Raw syscall dispatch ABI for the Thruput guest |
thruput-spec |
Contract spec types |
thruput-trace |
Transaction traces, and the FFI enums shared with the executor (invocation, host-function and system error codes) |
thruput-scp |
SCP RPC bindings |
thruput-node-types |
Types shared by the node RPC crates: transaction batches, block proposals, consensus values and common RPC results |
thruput-coordinator |
Coordinator RPC bindings |
thruput-node-rpc |
Node-internal RPC bindings: scheduler, database, executor, event, mempool/auth and gateway services |
thruput-indexer |
Indexer RPC bindings |
thruput-db-gateway |
Database read-gateway RPC bindings |
thruput-view |
Read-only view invocation RPC bindings |
Every crate shares one version and is published on crates.io. The bindings
encode with thruput-xdrs (imported as xdrs), and the RPC crates build
on thruput-rpc-api; serve or call them with thruput-rpc-driver.
The minimum supported Rust version is 1.96. thruput-xdr is no_std; its
features:
alloc,std: allocating types andstderror impls (stdimpliesalloc)xdrs: XDR encoding and decoding; decoding variable-length types also needsallocserde: serde support, with fixed-size byte arrays as hex stringsschema: JSON schemas throughschemars(impliesstd)syscalls: contract syscall bindings, forriscv32im-unknown-none-elfguestssyscalls_mock: the same bindings on a host target, against a native mock (impliessyscallsandstd)
Generated code
The files scripts/generate.sh writes (most of each crate's src/) are
emitted by the x23c XDR compiler from the definitions in protocol/, a
submodule of thruputchain/thruput-protocol, and are not edited by hand.
Each crate's lib.rs, its impls files and a few other modules, and the
thruput-syscall, thruput-xdr-macros and thruput-api-pins crates, are
hand-written.
CI check
bash scripts/ci-check.sh
This is what CI's build job runs. It needs no submodule or x23c.
Regenerating the sources
Install the Python dependency in the active environment, then regenerate:
git submodule update --init protocol
python3 -m pip install 'PyYAML==6.0.3'
bash scripts/generate.sh
Without XDRC set, generate.sh downloads the latest x23c release from
thruputchain/hogd; set XDRC to use a local build instead. CI checks that the committed
sources are up to date with bash scripts/generate.sh --check.
License
Copyright 2026 Stellar Development Foundation. Licensed under the Apache
License, Version 2.0. Each published crate includes the workspace
LICENSE. The thruput-scp crate also includes a NOTICE file
with its upstream attribution.