Official Rust SDK for integrating with Lumera chain actions and Cascade flows via sn-api-server.
This SDK covers the full action lifecycle used by apps and services:
- register ticket on-chain
- upload file via
sn-api-server - request and download file
- verify integrity by hash
- What this SDK provides
- Requirements
- Installation
- Configuration
- Quick start
- Golden test (what it means)
- Local developer commands (Makefile)
- CI gates
- Contributing / PR checklist
lumera-sdk-rs exposes 3 layers:
-
Chain client (
chain)- action params + fee lookup
- action registration transaction flow
-
sn-api client (
snapi)- start upload
- poll upload/download status
- request download + fetch output file
-
High-level SDK (
cascade)- deterministic payload/ID generation
- register ticket on-chain
- upload/download orchestration through
sn-api-server
Also included:
- config loading from env,
.env,.toml,.jsonviaconfig::SdkSettings - runnable end-to-end example:
examples/golden_devnet.rs
- Rust stable (1.75+ recommended)
- Reachable Lumera endpoints (REST/RPC/gRPC)
- Reachable
sn-api-server - Signing keys for:
- chain tx signing (
cosmrs::crypto::secp256k1::SigningKey) - arbitrary payload signing (
k256::ecdsa::SigningKey)
- chain tx signing (
[dependencies]
lumera-sdk-rs = "0.1"From source:
[dependencies]
lumera-sdk-rs = { path = "../sdk-rs" }Supported configuration styles:
- explicit in code (
CascadeConfig,ChainConfig) - environment variables (
SdkSettings::from_env()) - config file (
SdkSettings::from_file("*.toml|*.json")) .envfile (SdkSettings::from_env_file(".env"))
Common env vars:
LUMERA_CHAIN_IDLUMERA_GRPCLUMERA_RPCLUMERA_RESTLUMERA_GAS_PRICESNAPI_BASE
See:
examples/golden_devnet.rs(full E2E register/upload/download/hash)examples/from_env_settings.rs(load config from env + construct SDK)examples/custom_config.rs(explicit in-code endpoint config)examples/README.md(examples index)
golden_devnet.rs executes full flow:
- register ticket
- upload
- request download
- download file
- compare hash of original vs downloaded bytes
This repo now includes a minimal browser UI similar to sdk-js/examples/browser, but backed by sdk-rs API handlers:
- UI:
examples/ui/index.html - API server:
examples/ui_server.rs
Run it:
cd sdk-rs
export LUMERA_MNEMONIC="..."
export LUMERA_CREATOR="lumera1..."
SNAPI_BASE=http://127.0.0.1:8089 cargo run --example ui_serverThen open:
http://127.0.0.1:3002
Optional env:
SDK_RS_UI_PORT(default3002)SNAPI_BASE(defaulthttp://127.0.0.1:8089)LUMERA_MNEMONIC(required for automatic register/sign flow)LUMERA_CREATOR(sender address; defaults to local dev value if omitted)LUMERA_REST,LUMERA_RPC,LUMERA_GRPC,LUMERA_CHAIN_ID
The UI calls Rust endpoints under /api/*, with no manual action/signature input:
POST /api/workflow/upload(register ticket + sign + start upload)GET /api/upload/{task_id}/summaryPOST /api/workflow/download(uses last uploaded action by default)GET /api/download/{task_id}/summaryGET /api/download/{task_id}/file
In this repo, golden test means a full-system integration run against a real Lumera + sn-api-server stack, with strict pass criteria:
- action is registered on-chain successfully
- upload task succeeds
- download task succeeds
- downloaded file hash exactly matches original file hash
This is not a unit test and not a mock test. It is an end-to-end correctness gate for protocol compatibility.
Run locally:
make goldenmake golden calls scripts/run_golden_local.sh and runs cargo run --example golden_devnet.
Required env for local golden run:
LUMERA_MNEMONICLUMERA_CREATOR
Optional (defaults provided):
LUMERA_REST(defaulthttp://127.0.0.1:1317)LUMERA_RPC(defaulthttp://127.0.0.1:26657)LUMERA_GRPC(defaulthttp://127.0.0.1:9090)SNAPI_BASE(defaulthttp://127.0.0.1:8080)LUMERA_CHAIN_ID(defaultlumera-devnet)GOLDEN_INPUT(default/tmp/lumera-rs-golden-input.bin)
Use these before opening/updating a PR:
make fmt-check # formatting gate
make lint # clippy -D warnings
make test # all tests
make doc # docs with warnings denied
make check # full local PR gate (fmt/lint/test/doc)High-priority commands:
make build # build all workspace targets
make check # full quality gate
make golden # full register/upload/download/hash test
make clean # clean artifactsFor CI-parity PR E2E script against public testnet/public sn-api:
make e2e-pr- Always runs public endpoint smoke checks.
- Runs full register/upload/download/hash flow when
LUMERA_MNEMONICandLUMERA_CREATORare provided.
Current workflows enforce:
Lint + FormatTestDocsSecurity (cargo audit)System E2E (PR, public sn-api):- runs on PR opened/reopened/synchronize
- targets public endpoints (
snapi.testnet.lumera.io, Lumera testnet RPC/REST/gRPC) - executes endpoint smoke checks for all PRs
- executes full register → upload → download → hash match when testnet creds are configured as secrets
- publishes run artifacts/logs
Before PR creation and before each push to an open PR:
make check
make goldenIf your change affects chain/sn-api/cascade behavior, run:
make e2e-prPRs should include:
- clear scope and compatibility notes
- test evidence (at minimum
make check; include golden/e2e evidence where relevant) - no unrelated refactors
- never commit mnemonics/private keys
- inject secrets at runtime (env/secret manager)
- use dedicated keys per environment