/private-state-manager

Cloud backup and syncronization layer for Miden private accounts

Primary LanguageRustGNU Affero General Public License v3.0AGPL-3.0

Private State Manager

License: AGPL v3 CLA Assistant OpenSSF Scorecard OpenSSF Best Practices

Warning: This is a work in progress.

Specification

See the Specification for an overview of the system design. It describes core concepts (State and Delta), components (API, Metadata, Auth, Acknowledger, Network, Storage), and key processes such as canonicalization. If you’re integrating or extending the system, start there to understand invariants, defaults, and extension points.

Project Structure

  • crates/server - Server for managing private account states and deltas
    • Reproducible builds for binary verification and TEE deployment
  • crates/client - Client SDK for interacting with the PSM server
  • crates/shared - Shared types and utilities
  • crates/miden-rpc-client - Lightweight wrapper around Miden node RPC API - inspired in miden-client implementation.
  • crates/miden-keystore - Keystore implementation for Miden cryptographic keys - inspired in miden-client implementation.

Quick Start

See the Server README for detailed API documentation and usage examples.

Configuration

Environment Variables

  • PSM_STORAGE_PATH - Storage backend path (default: /var/psm/storage)
  • PSM_METADATA_PATH - Metadata store path (default: /var/psm/metadata)
  • PSM_KEYSTORE_PATH - Keystore path for cryptographic keys (default: /var/psm/keystore)
  • PSM_ENV - Environment (default: dev)
  • RUST_LOG - Logging level (default: info)
    • Supports: trace, debug, info, warn, error
    • Module-specific: RUST_LOG=server::jobs::canonicalization=debug

Running

Running with Cargo

cargo run --bin server

Running with Docker Compose

WARNING: Using docker needs to set dependencies to specific versions to ensure reproducibility, otherwise it won't work. In developer environments we prefer pointing miden deps to next branch for keeping up to date with the latest changes.

  1. Copy .env.example to .env
cp .env.example .env
  1. Edit .env with your configuration

  2. Start the server:

docker-compose up --build -d
  1. View logs:
docker-compose logs -f
  1. Stop services:
docker-compose down

The HTTP server will be available at http://localhost:3000

The gRPC server will be available at localhost:50051

Testing

Run the full workspace test suite:

cargo test --workspace

Feature-gated test groups:

# Run only integration tests
cargo test -p private-state-manager-server --features integration

# Run only e2e tests
cargo test -p private-state-manager-server --features e2e