Rust Core

zypp-labs-core is the foundational Rust implementation of the Zypp SDK — intent engine, local state, sync, settlement, crypto, and transport. All platform SDKs are bindings over this core.

When to Use Rust Core

  • Server-side intent processing
  • CLI tools and automation
  • Native desktop applications
  • Game engines that use Rust (Bevy, etc.)
  • Custom binding layers for new platforms

Adding to Your Project

[dependencies]
zypp-labs-core = { path = "../rust-core" }

zypp-labs-core supports serde + bincode for serialization, ed25519-dalek for signatures, uuid for intent identity, and aes-gcm for encrypted storage.

Module Overview

ModuleFilePurpose
Typestypes.rsCore type definitions: Intent, QueueEntry, QueueStatus, IntentPayload, TrustTier, security envelopes
Intentintent.rsIntentEngine — create, sign, submit, poll, cancel intents
Local Statelocal_state.rsLocalStateDb — RocksDB-backed persistent queue, KindRegistry, content-hash dedup, trust tier validation
Syncsync.rsSyncClient — connectivity-aware coordination, nonce registry, signature verification
Settlementsettlement.rsSettlementClient — route to exit target, primary/degraded strategy, record outcome
Transfertransfer.rsTransferEngine — packet creation, decoding, BLE/NFC/QR adapters
Cryptocrypto.rsEd25519 signing and verification
Tampertamper.rsHMAC-SHA256 tamper-evident envelope
Templatestemplates/Starter templates: ArcadeTemplate, TicketTemplate

Core API

IntentEngine

use zypp_labs_core::ZyppEngine;
use zypp_labs_core::intent::TrustTier;

let engine = ZyppEngine::new();

// Create an intent
let intent = engine.create_intent("move_player", r#"{"x":10,"y":20}"#, TrustTier::Unsigned);

// Sign and submit
engine.sign_and_submit(&intent);

// Poll status
let status = engine.poll_status(&intent.id);

LocalStateDb

use zypp_labs_core::local_state::LocalStateDb;

// Initialize with RocksDB path
let mut db = LocalStateDb::new("/path/to/db")?;

// Save an entry
db.save(&entry)?;

// Load an entry
let loaded = db.load(&intent_id)?;

// List all entries
let all = db.list()?;

SyncClient

use zypp_labs_core::sync::SyncClient;

let mut sync = SyncClient::new();
sync.connect("relay.zypp.fun:8443")?;

// Sync pushes pending intents to the relay
// Events are received via callback

SettlementClient

use zypp_labs_core::settlement::{SettlementClient, ExitTarget, ExitStrategy};

let mut settlement = SettlementClient::new();
let result = settlement.finalize(
    &entry,
    ExitTarget::SolanaRpc { rpc_url: "https://api.mainnet-beta.solana.com".into() },
)?;

Full Example

use zypp_labs_core::ZyppEngine;
use zypp_labs_core::types::{Intent, IntentType, IntentPayload, FreeFormPayload, TrustTier};
use zypp_labs_core::local_state::LocalStateDb;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize engine
    let engine = ZyppEngine::new();
    let mut db = LocalStateDb::new("./zypp_queue")?;

    // Create intent
    let intent = engine.create_intent(
        "swap_tokens",
        r#"{"from":"SOL","to":"USDC","amount":100_000_000}"#,
        TrustTier::Signed,
    );

    // Queue locally
    let entry = engine.enqueue(&intent)?;

    // Sync when online
    if let Ok(mut sync) = engine.sync_connect("relay.zypp.fun:8443") {
        sync.push(&entry)?;
    }

    // Settle on Solana
    let result = engine.settle(
        &entry,
        "https://api.devnet.solana.com",
        ExitType::SolanaRpc,
    )?;

    println!("Settled: {:?}", result);
    Ok(())
}

Building from Source

# Build the core library
cargo build --manifest-path rust-core/Cargo.toml

# Run tests (220+ across the stack)
cargo test --manifest-path rust-core/Cargo.toml --all

# Run integration tests
cargo test --manifest-path rust-core/Cargo.toml --test integration

The Rust core compiles to static libraries for each platform. Expo and Unity SDKs consume the compiled artifacts from their respective native plugin directories.

Next Steps