The high-performance Rust microservice. 60+ endpoints across protocol evaluation, PSBT operations, agent commands, event storage, and scanner loops.
The Rust node-core microservice handles the performance-critical protocol operations. Runs alongside the TypeScript application and communicates via HTTP on localhost. Over 60 endpoints organized into five major groups.
POST /v1/protocol/truth/evaluate # Evaluate protocol truth for a set of events
POST /v1/protocol/truth/batch # Batch evaluation for multiple event sets
POST /v1/protocol/validate # Validate a single event against protocol rules
POST /v1/protocol/validate/batch # Batch validation
POST /v1/witness/select # Deterministic witness selection (HMAC-SHA256)
POST /v1/witness/verify # Verify witness eligibility
POST /v1/fees/split # Calculate fee split for a transaction
POST /v1/fees/verify # Verify fee split correctness
POST /v1/poa/challenge/generate # Generate PoA challenge for a chain
POST /v1/poa/challenge/verify # Verify PoA challenge responseThe truth engine is the most critical component. Given a set of protocol events, it computes the deterministic marketplace state. Every node must produce identical output from identical input.
POST /v1/psbt/encrypt # Encrypt PSBT with AES-256-GCM
POST /v1/psbt/decrypt # Decrypt PSBT from shards
POST /v1/psbt/shards/split # Split AES key via Shamir (3-of-4)
POST /v1/psbt/shards/reconstruct # Reconstruct AES key from shares
POST /v1/psbt/shards/verify-share # Verify a single shard's integrity
POST /v1/psbt/shards/validate-payload # Validate encrypted PSBT payload
POST /v1/psbt/reveal/challenge/create # Create reveal challenge (Ed25519 signed)
POST /v1/psbt/reveal/challenge/verify # Verify reveal challenge response
POST /v1/psbt/validate/sighash # Validate SIGHASH_SINGLE|ANYONECANPAY
POST /v1/psbt/validate/inputs # Validate ordinal input constraints
POST /v1/psbt/coverage/check # Check shard coverage for a listing
POST /v1/psbt/coverage/rebalance # Trigger shard rebalancingPSBT operations are performance-sensitive because they involve cryptographic operations (AES-GCM, Shamir interpolation, Ed25519 signing) on every reveal and every listing.
POST /v1/agent/command/list # Process list command
POST /v1/agent/command/delist # Process delist command
POST /v1/agent/command/purchase # Process purchase command
POST /v1/agent/command/pool-register # Register node in witness pool
POST /v1/agent/command/pool-status # Query pool registration status
POST /v1/agent/psbt-share # Handle PSBT share distribution
POST /v1/agent/psbt-share/challenge # Handle PSBT share challenge
POST /v1/agent/quote/generate # Generate price quote
POST /v1/agent/quote/verify # Verify quote signature
POST /v1/agent/runtime/status # Agent runtime health check
POST /v1/agent/runtime/metrics # Agent runtime metrics
POST /v1/agent/recovery/initiate # Initiate PSBT recovery from shards
POST /v1/agent/recovery/status # Check recovery statusAgent operations bridge the protocol layer with chain-specific settlement logic. The command endpoints process marketplace actions, while recovery handles edge cases where the normal flow fails.
POST /v1/events/save # Persist a signed protocol event
POST /v1/events/save/batch # Batch persist multiple events
POST /v1/events/replay # Replay events for state reconstruction
POST /v1/events/query # Query events by type, time range, node
POST /v1/events/query/by-listing # Query events for a specific listing
POST /v1/events/query/by-node # Query events from a specific node
POST /v1/events/prune # Prune events past retention tier
POST /v1/listings/state # Compute listing state from events
POST /v1/listings/state/batch # Batch listing state computation
POST /v1/listings/search # Full-text search over listingsEvent storage is the persistence backbone. Every protocol action is an immutable signed event. The event store handles writing, querying, replay (for state reconstruction after restart), and pruning (based on retention tiers defined in the protocol package).
POST /v1/scanner/tick # Advance scanner by one tick
POST /v1/scanner/status # Scanner health and position
POST /v1/scanner/chain/{chain}/head # Current chain head position
POST /v1/scanner/chain/{chain}/sync # Force chain syncThe scanner continuously monitors supported blockchains for settlement transactions. Each tick checks for new blocks, processes confirmed transactions, and emits TX_OBSERVED events.
| Module | Size | Responsibility |
|---|---|---|
| main.rs | 28KB | HTTP server setup, routing, middleware |
| agent_runtime.rs | 28KB | Agent lifecycle, quote generation, health |
| agent_commands.rs | 23KB | List/delist/purchase command processing |
| agent_recovery.rs | 18KB | PSBT recovery from shards |
| event_store.rs | 41KB | Event persistence, querying, replay |
| psbt_share.rs | 25KB | PSBT shard management and distribution |
| logic.rs | 24KB | Core marketplace logic and state computation |
| psbt_logic.rs | 12KB | PSBT-specific validation (sighash, inputs) |
| fee_wallets.rs | 18KB | Fee account management and distribution |
| poa.rs | 15KB | Proof-of-Access challenge generation/verification |
| scanner.rs | 20KB | Chain scanner loops and transaction detection |
| witness.rs | 14KB | Witness selection and eligibility verification |
The Rust implementation maintains 1:1 parity with the TypeScript protocol logic. Both implementations are tested against shared test vectors:
This dual-implementation strategy provides defense against implementation bugs. If TypeScript and Rust independently produce the same result, confidence in correctness is high.
The TypeScript application talks to node-core via HTTP on localhost:
const result = await fetch(
`http://localhost:${NODE_CORE_PORT}/v1/protocol/truth/evaluate`,
{ method: "POST", body: JSON.stringify(validationInput) }
);This separation provides: independent scaling and deployment, language-appropriate tooling for each component, clear API boundaries with typed request/response schemas, and independent testing and auditing.