satd-events-client
Async Rust client SDK for the satd Streaming Consumption API (satd.events.v1).
It wraps the generated tonic client with a
typed event model, per-call auth metadata, cursor capture/persistence,
reconnect-with-backoff, Lagged auto-resume, replay-truncation detection, and a
privacy-preserving prefix-watch local re-filter — so a consumer writes against
StreamClient instead of hand-rolling channels, metadata, and protobuf
unwrapping.
- Typed events & watches —
Eventis a flat enum over the protooneof;WatchHandlehas a typed helper for every watch kind (scripts withmin_valuefloors, outpoints, txid lifecycle, depth alarms, descriptors, prefixes). - Durable firehose —
resilient_subscribereconnects with backoff and persists the resume cursor through aCursorStore, so a process restart resumes from the stored height;Laggedrecovers automatically and a server-side replay clamp surfaces as a syntheticEvent::ReplayGap. - Native TLS / mTLS —
tls()/tls_ca_pem()/tls_client_identity()/tls_domain()encrypt the transport (ring rustls provider) so a bearer token is never sent in cleartext. - No server-dependency leak — wire types live in the thin
satd-events-protocrate, so this SDK pulls none of thenode/RocksDB server stack.
Install
Pre-publish: this crate is not yet on crates.io. Depend on it via git until the published release lands:
[]
= { = "https://github.com/epochbtc/satd", = "master" }
Once published, cargo add satd-events-client.
To read the API docs before publication, generate them locally:
Quickstart
use ;
async
Over a plaintext http:// endpoint a bearer token travels in cleartext — enable
TLS (below), restrict bearer auth to loopback, or front the node with a
TLS-terminating proxy.
# use StreamClient;
# async
Feature flags
| Feature | Default | Effect |
|---|---|---|
bitcoin |
on | Typed bitcoin helpers + the PrefixWatcher prefix-watch re-filter (pulls bitcoin/secp256k1). |
tls |
on | Native TLS / mTLS via tonic's rustls integration (ring provider; no aws-lc-rs / C toolchain). |
For a minimal, plaintext-only build: default-features = false.
Examples
Runnable examples live in examples/ — firehose_tail,
resilient_tail, watch_outpoints, descriptor_wallet, lifecycle_alarms,
prefix_privacy, tls_tail, mtls_tail:
Stability & versioning
The SDK tracks the additive satd.events.v1 wire schema, not the node's
release cadence, and follows semver independently of the
satd node version — a node and SDK do not need matching versions. MSRV is
1.93 (an MSRV bump is a minor-version change).
More
- Operator Manual — Rust SDK chapter: https://epochbtc.github.io/satd/rust-sdk.html
- Wire / streaming spec:
docs/api/streaming.md
License
MIT — see LICENSE.