agorix
AirdropMarketsCollectionsLeaderboardActivity
Agorix · Decentralized Marketplace
Independent · Resilient · Community-Run

A cross-chain marketplace, run by the community.

Discover, list, and trade across Bitcoin, Ethereum, and Solana on an open, community-run network.

Marketplace
CollectionsMarketsLeaderboardActivity
Network
GovernanceExplorerAirdropDocs
Account
ProfileSettings
Legal
Terms of ServicePrivacy PolicyYour Privacy Choices
agorix.io — Lasting Access
CID: 0xA60R1X · v0.1
AirdropMarketsCollections
D
Protocol Docs
Public APISmart ContractsSecurity ModelOpen SourceRust Node CoreGetting Started (Developer)Benchmarks
Docs/Developer/Rust Node Core
Developer

Rust Node Core

The high-performance Rust microservice. 60+ endpoints across protocol evaluation, PSBT operations, agent commands, event storage, and scanner loops.

#Rust Node Core

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.

#Why Rust

  • Deterministic performance. No GC pauses during validation. Consistent latency under load.
  • Memory safety. No buffer overflows in cryptographic operations. No use-after-free.
  • Throughput. Handles high event volumes without degradation. Tokio async runtime.
  • Correctness. Strong type system and ownership model prevent subtle bugs at compile time.

#Endpoint Groups

#Protocol Evaluation (Core Truth Engine)

text
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 response

The 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.

#PSBT Operations

text
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 rebalancing

PSBT operations are performance-sensitive because they involve cryptographic operations (AES-GCM, Shamir interpolation, Ed25519 signing) on every reveal and every listing.

#Agent Operations

text
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 status

Agent 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.

#Event Storage

text
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 listings

Event 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).

#Scanner

text
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 sync

The scanner continuously monitors supported blockchains for settlement transactions. Each tick checks for new blocks, processes confirmed transactions, and emits TX_OBSERVED events.

#Module Overview

ModuleSizeResponsibility
main.rs28KBHTTP server setup, routing, middleware
agent_runtime.rs28KBAgent lifecycle, quote generation, health
agent_commands.rs23KBList/delist/purchase command processing
agent_recovery.rs18KBPSBT recovery from shards
event_store.rs41KBEvent persistence, querying, replay
psbt_share.rs25KBPSBT shard management and distribution
logic.rs24KBCore marketplace logic and state computation
psbt_logic.rs12KBPSBT-specific validation (sighash, inputs)
fee_wallets.rs18KBFee account management and distribution
poa.rs15KBProof-of-Access challenge generation/verification
scanner.rs20KBChain scanner loops and transaction detection
witness.rs14KBWitness selection and eligibility verification

#Parity Testing

The Rust implementation maintains 1:1 parity with the TypeScript protocol logic. Both implementations are tested against shared test vectors:

  • Same inputs must produce identical outputs.
  • Shared JSON test vector files cover edge cases.
  • CI runs parity checks on every commit.
  • Any divergence between TypeScript and Rust is treated as a critical bug.

This dual-implementation strategy provides defense against implementation bugs. If TypeScript and Rust independently produce the same result, confidence in correctness is high.

#Communication

The TypeScript application talks to node-core via HTTP on localhost:

typescript
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.

PreviousOpen SourceNext Getting Started (Developer)

On this page

  • Rust Node Core
  • Why Rust
  • Endpoint Groups
  • Protocol Evaluation (Core Truth Engine)
  • PSBT Operations
  • Agent Operations
  • Event Storage
  • Scanner
  • Module Overview
  • Parity Testing
  • Communication