Skip to content

feat: add stellar-spp CLI plugin#138

Closed
tomerweller wants to merge 11 commits intoNethermindEth:mainfrom
tomerweller:feat/cli-plugin
Closed

feat: add stellar-spp CLI plugin#138
tomerweller wants to merge 11 commits intoNethermindEth:mainfrom
tomerweller:feat/cli-plugin

Conversation

@tomerweller
Copy link
Copy Markdown
Collaborator

Summary

  • Adds a new cli/ crate (stellar-spp) that provides a full-featured CLI plugin for Stellar private payments, with feature parity to the browser UI
  • Auto-discovered by Stellar CLI as stellar spp <command> — supports deposits, transfers, withdrawals, key management, syncing, and proof generation
  • Includes multi-pool support (pool add/ls/rm/use), JSON file storage, and circuit artifact embedding via build.rs

🤖 Generated with Claude Code

tomerweller and others added 11 commits February 15, 2026 19:24
Implements a Stellar CLI plugin (`stellar spp`) that provides full
feature parity with the browser UI from the terminal.

Commands: init, sync, status, keys (derive/show), register, deposit,
withdraw, transfer, notes (list/scan/export/import), admin
(add-member/remove-member/update-admin).

Architecture:
- Delegates all network operations to `stellar` CLI (no reqwest/tokio)
- Embeds compiled circuit artifacts for Groth16 proof generation
- SQLite local state at ~/.config/stellar/spp/{network}.db
- Deterministic key derivation matching Freighter browser wallet

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests cover:
- db.rs: all CRUD operations (pool leaves, nullifiers, encrypted
  outputs, ASP leaves, user notes, registered keys, sync metadata)
- crypto.rs: cross-validation against circuits crate reference
  implementations (Poseidon2 hashing, key derivation, commitment,
  sign, nullifier pipeline), scalar conversions, encrypt/decrypt
  round-trip
- merkle.rs: root/proof determinism, proof verification by manual
  root reconstruction, build_pool_leaves/build_asp_leaves from DB
- transaction.rs: note selection, ext_data_hash, BN256 modulus,
  ASP membership index lookup, serialization helpers
- notes.rs: note scanning with pre-populated encrypted outputs,
  detection of spent notes, skip-already-known behavior
- config.rs: JSON/TOML serialization round-trips

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix RPC scan window: start from max_ledger-10000 instead of min_ledger
  so events within the ~10k scan window are reachable
- Handle "No events" string response from `stellar events` (exit 0)
- Fix ASP non-membership proof: use empty overrides for empty on-chain tree
- Fix Merkle zero leaf: use Poseidon2("XLM") matching on-chain contracts
- Fix proof serialization: correct Groth16 point encoding and public inputs
- Add stellar-xdr base64 feature for XDR decoding in sync
- Add scalar_to_hex_le helper, deduplicate note scanning logic
- Remove dead code (resolve_address), fix clippy warnings
- Add integration test script (35 end-to-end tests against testnet)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace rusqlite (bundled SQLite C library) with a JSON file backend
  using serde + base64. Same public API via RefCell<Store> for interior
  mutability. Atomic writes via tmp+rename.
- Remove dead code: contract_invoke_view, unused ProofResult fields
  (public_inputs, vk), blanket #[allow(dead_code)] on modules.
- Gate test-only functions (poseidon2_compression, scalar_to_be_bytes)
  with #[cfg(test)].
- Extract duplicated transaction helpers: user_notes_to_inputs,
  pad_inputs_to_two, save_note.
- Remove unused StellarEvent fields (event_type, contract_id).

All 67 unit tests and 35 integration test assertions pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Support multiple independent pool deployments per network with named
pool aliases. Storage moves from flat {network}.toml/.json to a
per-pool directory layout ({network}/pools/{pool}.toml/.json) with
automatic migration of existing configs.

New pool subcommands: add, ls, rm, use (following stellar-cli patterns).
The --pool flag and STELLAR_SPP_POOL env select a pool; --network gets
STELLAR_NETWORK env support. Fixes hardcoded "testnet" in notes
import/export.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace all SQLite references with JSON storage, document the new
per-pool directory layout, add Pool Management command reference,
document STELLAR_NETWORK/STELLAR_SPP_POOL env vars and pool resolution
order. Fix platform-specific config paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge `spp init` into `spp pool add <name> --sync` to eliminate the
redundant command. Also fix a scan window boundary bug in
get_oldest_ledger where `max - 10,000` could miss recent events
(the actual RPC window is ~9,965 ledgers); now uses `max - 9,000`.

Add deploy retry logic (3 attempts) to handle transient testnet errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maksimryndin maksimryndin mentioned this pull request Mar 9, 2026
torisamples pushed a commit to torisamples/stellar-private-payments that referenced this pull request Apr 9, 2026
fix (backend): claim nft options supply find
@maksimryndin
Copy link
Copy Markdown
Contributor

Hey @tomerweller ! thanks a lot for the contribution!

we're refactoring to a single app core with a unified storage (#148) - this pr won't be merged but some ideas to be re-used in the tasks #158 and #159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants