StateSet iCommerce: Infrastructure for Autonomous Commerce
A Technical Paper on Embedded, Verifiable Commerce Systems for AI AgentsAbstract
StateSet iCommerce is a comprehensive infrastructure stack enabling autonomous AI agents to conduct commerce operations with cryptographic verifiability. The system comprises five integrated components: (1) an embedded commerce engine providing 700+ API methods across 32 commerce domains, compiled to 10 language runtimes; (2) a distributed event sequencer implementing Verifiable Event Sync (VES) with Merkle commitments and end-to-end encryption; (3) Set Chain, an Ethereum Layer-2 optimistic rollup for on-chain settlement and proof verification; (4) the x402 HTTP-native payment protocol for stablecoin micropayments between AI agents; and (5) a multi-channel messaging gateway connecting commerce agents to 9 communication platforms. This paper presents the architecture, implementation details, and design rationale for building commerce infrastructure where AI agents are first-class participants in economic transactions. Keywords: embedded databases, event sourcing, AI agents, commerce, blockchain, Merkle trees, optimistic rollups, MCP, x402, vector search, messaging gateway1. Introduction
1.1 The Problem
Traditional commerce platforms were designed for human operators accessing centralized services via network APIs. This architecture introduces several limitations for autonomous AI agents:- Latency: Network round-trips add 50-500ms per operation
- Availability: Agents cannot operate without network connectivity
- Auditability: No cryptographic proof that operations occurred correctly
- Cost: Per-API-call pricing creates unpredictable marginal costs
- Trust: Agents must trust centralized providers for data integrity
- Payments: No native mechanism for agent-to-agent economic settlement
- Communication: No unified channel for agent-customer interaction across platforms
1.2 Our Contribution
We present StateSet iCommerce, a five-layer infrastructure stack addressing these challenges:| Layer | Component | Function |
|---|---|---|
| Compute | stateset-embedded | In-process commerce engine |
| Coordination | stateset-sequencer | Distributed event ordering |
| Settlement | Set Chain (L2) | On-chain verification |
| Payments | x402 Protocol | HTTP-native stablecoin payments |
| Communication | Messaging Gateway | 9-channel agent interaction |
- Offline-first operation: Complete commerce functionality without network
- Cryptographic verifiability: Merkle proofs for any transaction
- Multi-agent coordination: Deterministic ordering across distributed agents with end-to-end encryption
- Settlement finality: Ethereum-backed proof anchoring
- Native payments: Stablecoin micropayments via HTTP 402
- Omnichannel presence: AI agents operating across WhatsApp, Telegram, Discord, Slack, and more
- Semantic search: Hybrid vector + BM25 search across all commerce entities
- Voice interaction: Speech-to-text and text-to-speech for conversational commerce
1.3 Paper Organization
Section 2 describes the embedded commerce engine architecture. Section 3 details the Verifiable Event Sync protocol. Section 4 presents Set Chain and on-chain settlement. Section 5 introduces the x402 payment protocol. Section 6 discusses the Model Context Protocol integration for AI agents. Section 7 covers the multi-channel messaging gateway. Section 8 presents operational infrastructure including heartbeat monitoring, permission sandboxing, and persistent memory. Section 9 evaluates performance and security properties. Section 10 surveys related work, and Section 11 concludes.2. Embedded Commerce Engine
2.1 Design Philosophy
The embedded commerce engine follows the SQLite model: a library that runs in the application’s process, storing state in a local file with zero external dependencies. This architecture provides:- Deterministic execution: Same inputs always produce identical outputs
- Portable state: Single file contains complete operational data
- Zero marginal cost: No per-operation pricing
- Instant availability: No network connection required
2.2 System Architecture
2.3 Domain Model
The core domain consists of 32 modules covering complete commerce and back-office operations: Commerce Operations:| Module | Entities | Key Operations |
|---|---|---|
| Customers | Customer, Address | CRUD, profile management |
| Products | Product, Variant, Attribute | Catalog, pricing, inventory links |
| Inventory | Item, Balance, Reservation | Multi-location tracking, reservations |
| Orders | Order, OrderItem, Status | Full lifecycle, fulfillment |
| Carts | Cart, CartItem | Shopping, checkout flow |
| Payments | Payment, Refund, Method | Multi-method processing |
| Returns | Return, ReturnItem, RMA | Return authorization workflow |
| Shipments | Shipment, Event, Tracking | Carrier integration |
| Promotions | Promotion, Coupon, Rule | Discounts, BOGO, tiered |
| Subscriptions | Plan, Subscription, Cycle | Recurring billing |
| Module | Entities | Key Operations |
|---|---|---|
| Warehouse | Warehouse, Zone, Location | Location hierarchy, bin management |
| Receiving | Receipt, ReceiptItem, PutAway | Inbound goods, put-away tracking |
| Fulfillment | Wave, PickTask, PackTask, ShipTask | Pick/pack/ship workflow |
| Lot Tracking | Lot, LotCertificate, LotTransaction | Traceability, COA/COC management |
| Serial Numbers | SerialNumber, SerialHistory | Unit-level tracking, warranty lookup |
| Backorders | Backorder, Allocation, Fulfillment | Priority queuing, allocation |
| Manufacturing | BOM, WorkOrder, Task | Bill of materials |
| Purchase Orders | PO, Supplier | Procurement |
| Quality | Inspection, NCR, QualityHold, DefectCode | Multi-stage QC, non-conformance |
| Module | Entities | Key Operations |
|---|---|---|
| General Ledger | GlAccount, JournalEntry, GlPeriod | Double-entry, auto-posting, trial balance |
| Accounts Receivable | CreditMemo, WriteOff, CollectionActivity | AR aging, statements, collections |
| Accounts Payable | Bill, BillPayment, PaymentRun | AP aging, payment scheduling |
| Invoices | Invoice, Item, AR | Accounts receivable |
| Cost Accounting | CostLayer, CostAdjustment, CostVariance | FIFO/LIFO/weighted average, valuation |
| Credit | CreditAccount, CreditApplication, CreditHold | Credit review, risk rating |
| Tax | Jurisdiction, Rate, Exemption | US/EU/CA multi-jurisdiction |
| Currency | ExchangeRate, Money | 35+ currencies |
| Module | Entities | Key Operations |
|---|---|---|
| x402 | PaymentIntent, PaymentReceipt, PaymentBatch | HTTP-native stablecoin payments |
| Vector Search | VectorSearchResult, EmbeddingMetadata | Hybrid semantic + BM25 search |
| Analytics | Summary, Forecast | Business intelligence |
| Warranties | Warranty, Claim | Coverage tracking |
| Forecasting | ForecastModel, DemandSignal | Demand planning |
| Sync | Outbox, SyncState | Event synchronization |
2.4 Database Layer
The database layer provides a unified interface over multiple backends: SQLite (Embedded)- Zero-configuration deployment
- Single-file state portability
- ACID transactions via WAL mode
- ~200μs typical query latency
- FTS5 full-text search for BM25 ranking
- BLOB-based vector embedding storage
- Horizontal scalability
- Advanced query optimization
- Point-in-time recovery
- Connection pooling
- True async operations via
AsyncCommerceAPI
- Normalized core entities: Customers, products, orders
- Denormalized analytics: Pre-aggregated summary tables
- Event tables: Append-only for audit trail
- Version columns: Optimistic concurrency control
- Vector tables: Embedding storage with metadata for semantic search
- FTS5 tables: Full-text search indexes for BM25 ranking
| Feature | Description |
|---|---|
| Saga Orchestration | Multi-step distributed transactions with rollback |
| Backup & Restore | Full backups (VACUUM INTO), SHA256 verification, retention policies |
| Idempotency Keys | Deduplication at the database level |
| Performance Indexes | Dedicated migration for query optimization |
| Parse Helpers | Type-safe row parsing with proper error propagation |
| Repository Macros | Code generation to eliminate duplicate implementations |
| 32 Repository Traits | One trait per domain with full CRUD + domain operations |
2.5 Vector Search
The embedded engine supports hybrid semantic + keyword search, feature-gated behind thevector flag:
- Embedding Service: OpenAI
text-embedding-3-small(1536 dimensions) for generating vectors - Vector Store: Pure Rust cosine similarity computation over SQLite BLOB columns
- BM25 Store: SQLite FTS5 full-text search for keyword relevance
- RRF Fusion: Reciprocal Rank Fusion combines semantic and keyword scores
- Entity Coverage: Products, customers, orders, and inventory items
2.6 Multi-Runtime Compilation
The Rust core compiles to 10 target runtimes:| Runtime | Technology | Use Case |
|---|---|---|
| Native Rust | Direct linking | High-performance backends |
| Node.js | NAPI-RS | JavaScript/TypeScript applications |
| Python | PyO3 + Maturin | Data science, ML pipelines |
| Browser | wasm-pack | Client-side applications |
| Edge | WASM | Cloudflare Workers, Vercel Edge |
| Ruby | Magnus | Rails applications |
| PHP | ext-php-rs | Laravel/WordPress integrations |
| Java | JNI | Enterprise JVM applications |
| Kotlin | JNI | Android, server-side Kotlin |
| Swift | C FFI | iOS/macOS applications |
| .NET/C# | P/Invoke | ASP.NET, Unity applications |
| Go | cgo | Go microservices |
2.7 Async Commerce API
For PostgreSQL deployments, a fully async API is provided:AsyncCommerce struct mirrors the synchronous Commerce API, providing AsyncOrders, AsyncCustomers, AsyncInventory, and all 32 domain accessors with true non-blocking I/O.
3. Verifiable Event Sync (VES)
3.1 Motivation
When multiple AI agents operate on commerce data—one managing inventory, another processing orders, a third handling returns—they must coordinate without central authority. VES provides:- Canonical ordering: Global sequence numbers eliminate ambiguity
- Eventual consistency: Offline agents sync when reconnected
- Conflict detection: Optimistic concurrency with explicit handling
- Cryptographic proofs: Merkle trees enable verification
- End-to-end encryption: Agent-to-agent encrypted communication groups
- Key management: Ed25519/X25519 key generation, rotation, and registration
3.2 Architecture
3.3 Event Envelope
Every operation emits an event envelope:3.4 Sequencing Algorithm
The sequencer assigns canonical sequence numbers:3.5 Merkle Commitment
Events are batched into Merkle trees for cryptographic commitment:3.6 Optimistic Concurrency Control
VES uses optimistic concurrency without blocking:3.7 Conflict Resolution Strategies
When conflicts are detected, VES supports multiple resolution strategies:| Strategy | Behavior | Use Case |
|---|---|---|
| Remote-wins | Accept sequencer version | Default for inventory |
| Local-wins | Prefer local agent state | Agent-authoritative data |
| Merge | Field-level merge | Non-conflicting updates |
| Manual | Queue for human review | High-value transactions |
3.8 Key Management and Encryption
VES includes a complete cryptographic key management system: Key Generation and Registration:- Multi-agent groups with shared encryption contexts
- X25519 key exchange for group secret derivation
- Per-message encryption for sensitive commerce data (payment details, PII)
- Group membership management (add/remove agents)
| Policy | Trigger | Description |
|---|---|---|
| Time-based | Configurable interval | Rotate keys every N hours/days |
| Usage-based | Operation count | Rotate after N signing operations |
| Manual | Admin action | Force rotation on demand |
3.9 Local Outbox Pattern
Each agent maintains a local SQLite outbox:- Mutation occurs locally → event appended to outbox
- Agent pushes pending events to sequencer
- Sequencer returns IngestReceipt with sequence numbers
- Agent updates outbox with remote_sequence, synced_at
- Agent pulls events from other agents
- Events applied locally, entity versions updated
4. Set Chain: On-Chain Settlement
4.1 Overview
Set Chain is an Ethereum Layer-2 optimistic rollup built on the OP Stack, providing cryptographic finality for commerce events. Chain Parameters:| Parameter | Value |
|---|---|
| Chain ID | 84532001 |
| Block Time | 2 seconds |
| Gas Limit | 30M per block |
| Settlement Layer | Ethereum (Sepolia/Mainnet) |
| Native Token | ETH |
4.2 Architecture
4.3 SetRegistry Contract
The SetRegistry stores batch commitments and enables proof verification:4.4 Anchor Service
The Rust anchor service bridges sequencer to chain:4.5 Settlement Finality
The system provides progressive finality guarantees:| Stage | Latency | Guarantee |
|---|---|---|
| Local SQLite | ~1ms | Single-agent consistency |
| Sequencer | ~100ms | Global ordering |
| L2 Block | ~2s | Chain inclusion |
| L1 Batch | ~10min | Optimistic finality |
| Challenge Period | ~7 days | Cryptographic finality |
- User requests proof for event E
- Sequencer returns Merkle proof from batch B
- User calls SetRegistry.verifyInclusion(B, E.leafHash, proof)
- Contract recomputes root, compares to stored eventsRoot
- Returns true if event is included in anchored batch
5. x402 Payment Protocol
5.1 Overview
The x402 protocol enables HTTP-native stablecoin micropayments between AI agents. Using the HTTP 402 (Payment Required) status code, agents can negotiate and settle payments inline with commerce API calls.5.2 Protocol Flow
5.3 Supported Networks
| Network | Chain ID | Assets | Status |
|---|---|---|---|
| Set Chain | 84532001 | ssUSD, USDC | Production |
| Arc | — | ssUSD | Production |
| Base | 8453 | USDC | Production |
| Ethereum | 1 | USDC, USDT | Production |
| Arbitrum | 42161 | USDC | Production |
| Optimism | 10 | USDC | Production |
| Solana | — | USDC | Production |
5.4 Core Types
5.5 Agent Wallet Integration
Agent wallets are derived from VES signing keys, enabling unified identity across event signing and payment settlement:stateset-pay CLI.
6. Model Context Protocol Integration
6.1 MCP Architecture
The CLI exposes commerce operations via the Model Context Protocol (MCP), enabling AI agents to invoke tools directly:6.2 Tool Categories
MCP Tools by Domain:| Domain | Examples |
|---|---|
| Customers | list_customers, get_customer, create_customer |
| Orders | create_order, ship_order, cancel_order |
| Products | list_products, create_product |
| Inventory | get_stock, adjust_inventory, reserve_inventory |
| Returns | create_return, approve_return |
| Carts/Checkout | create_cart, add_cart_item, complete_checkout |
| Payments | create_payment, process_refund |
| Analytics | get_sales_summary, get_demand_forecast |
| Currency | convert_currency, set_exchange_rate |
| Tax | calculate_tax, calculate_cart_tax |
| Promotions | create_promotion, validate_coupon |
| Subscriptions | create_subscription, pause_subscription |
| Warehouse | create_warehouse, assign_location |
| Fulfillment | create_wave, assign_pick_task |
| Quality | create_inspection, record_ncr |
| Lots/Serials | create_lot, assign_serial |
| General Ledger | post_journal_entry, get_trial_balance |
| Accounts Payable | create_bill, schedule_payment |
| Accounts Receivable | apply_payment, generate_statement |
| Cost Accounting | record_cost_layer, get_valuation |
| Sync | sync_status, sync_push, sync_pull |
6.3 Skills System
The CLI includes a skills system that injects domain-specific knowledge into agent prompts:6.4 Multi-Provider AI Support
The CLI supports multiple AI providers with a unified interface:| Provider | Models | MCP Tools | Mode |
|---|---|---|---|
| Claude | claude-sonnet-4-20250514 | Full | Agent SDK + MCP |
| OpenAI | gpt-4o, gpt-4, o1 | None | Chat-only |
| Gemini | gemini-2.0-flash, gemini-2.0-pro | None | Chat-only |
| Ollama | llama3, mistral, etc. | None | Chat-only (local) |
6.5 Voice Mode
The CLI supports voice-based interaction for conversational commerce:| Component | Provider | Description |
|---|---|---|
| Speech-to-Text | OpenAI Whisper | Audio transcription |
| Text-to-Speech | ElevenLabs | Natural voice synthesis |
| Session Management | VoiceModeController | Per-session state, 30-min TTL |
6.6 Permission Model
All write operations require explicit opt-in:6.7 Agent Routing
The harness automatically routes requests to specialized agents:6.8 Event Capture Integration
When sync is configured, commerce operations automatically emit events:7. Multi-Channel Messaging Gateway
7.1 Overview
The messaging gateway enables AI commerce agents to operate across 9 communication platforms, providing omnichannel customer service, order management, and proactive notifications.7.2 Architecture
7.3 Channel Support
| Channel | Protocol | Status | Features |
|---|---|---|---|
| Cloud API | GA | Rich media, templates, quick replies | |
| Telegram | Bot API | GA | Inline keyboards, commands, groups |
| Discord | Gateway + REST | GA | Slash commands, embeds, threads |
| Slack | Events + Web API | GA | Blocks, modals, slash commands |
| Signal | signal-cli | GA | Encrypted messaging |
| Google Chat | Spaces API | GA | Cards, dialogs |
| WebChat | WebSocket | GA | Embeddable widget, real-time |
| iMessage | AppleScript | Experimental | macOS only |
| Teams | Bot Framework | Experimental | Adaptive cards |
7.4 Gateway Infrastructure
Session Store: SQLite-backed persistent sessions with per-conversation state, allowing agents to maintain context across messages and platform reconnections. Middleware Stack: Koa-style onion model with composable middleware:- Rate limiting (per-user, per-channel)
- Content filtering (profanity, PII detection)
- Language detection
- Request logging and metrics
7.5 Orchestrator
The multi-channel orchestrator launches and manages gateway instances from configuration:8. Operational Infrastructure
8.1 Heartbeat Monitor
The heartbeat monitor provides proactive health checking for commerce operations:| Checker | Trigger | Action |
|---|---|---|
low-stock | Stock below threshold | Alert, auto-reorder |
abandoned-carts | Cart idle > timeout | Recovery notification |
revenue-milestone | Target reached/missed | Dashboard alert |
pending-returns | Return aging > days | Escalation |
overdue-invoices | Invoice past due | Collection notification |
subscription-churn | Cancellation spike | Retention campaign |
8.2 Permission Sandboxing
Fine-grained permission control for API access: Permission Levels:- API key authentication (Bearer token + query parameter)
- Per-route permission levels with longest-prefix matching
- Per-HTTP-method overrides
- Sandbox mode blocking dangerous operations (browser automation, shell execution)
- Timing-safe key comparison
- Every MCP tool mapped to a required permission level
8.3 Persistent Memory
SQLite-backed conversation memory for maintaining context across sessions:| Feature | Description |
|---|---|
| Per-conversation summaries | Automatic summarization of interactions |
| Fact extraction | Key facts stored for future reference |
| Token tracking | Usage monitoring per conversation |
| Keyword search | Find relevant past interactions |
| Vector retrieval | Semantic similarity search over memory |
| Auto-cleanup | Configurable retention policies |
8.4 Browser Automation
Chrome DevTools Protocol (CDP) integration for web interaction:- Headless Chrome spawning and lifecycle management
- Navigation, DOM queries, JavaScript evaluation
- Screenshot capture
- No Puppeteer dependency (pure CDP implementation)
- Use cases: storefront testing, catalog sync, web scraping
8.5 Daemon Mode
Systemd service manager for production deployments:8.6 Scaffold Server
Code generation system for bootstrapping e-commerce storefronts:8.7 Prometheus Metrics
Feature-gated observability (metrics feature flag):
9. Evaluation
9.1 Performance
Embedded Engine Benchmarks:| Operation | SQLite | PostgreSQL |
|---|---|---|
| Create Order | 1.2ms | 3.5ms |
| List Orders (100) | 0.8ms | 2.1ms |
| Inventory Adjustment | 0.9ms | 2.8ms |
| Tax Calculation | 0.3ms | 0.3ms |
| Cart Checkout | 4.5ms | 8.2ms |
| Vector Search (1000 products) | ~15ms | ~20ms |
| Hybrid Search (RRF) | ~25ms | ~30ms |
| Metric | Value |
|---|---|
| Events/second (sustained) | 10,000+ |
| Batch size | 100-1000 events |
| Sequencing latency (p99) | 50ms |
| Merkle tree construction | ~5ms/1000 events |
| Metric | Value |
|---|---|
| Block time | 2 seconds |
| commitBatch gas | ~150,000 |
| verifyInclusion gas | ~30,000 |
| L1 batch submission | ~10 minutes |
9.2 Security Properties
Cryptographic Guarantees:- Event Integrity: SHA-256 payload hashes prevent tampering
- Inclusion Proofs: Merkle trees enable O(log n) verification
- Ordering Finality: Sequence numbers are immutable once assigned
- State Continuity: Each batch links to previous state root
- Agent Authentication: Ed25519 signatures with key rotation
- Encryption Groups: X25519-based end-to-end encryption for sensitive data
- Payment Security: x402 signed intents with replay protection via nonces
| Attack | Mitigation |
|---|---|
| Event replay | UUID event_id deduplication |
| Intent replay | command_id deduplication |
| Payment replay | Nonce-based x402 intent deduplication |
| Sequencer equivocation | State root chain verification |
| Data tampering | Merkle proofs, on-chain anchoring |
| Agent impersonation | Ed25519 signing with key registry |
| Unauthorized access | Permission sandboxing, API key auth |
| Channel injection | Middleware content filtering |
9.3 Scalability
Horizontal Scaling:| Component | Strategy |
|---|---|
| Embedded Engine | Per-agent instances, no coordination |
| Sequencer | Read replicas, partition by tenant |
| Event Store | PostgreSQL partitioning by sequence |
| L2 Settlement | OP Stack inherent scalability |
| Messaging Gateway | Per-channel horizontal scaling |
| Timeframe | Events | Storage (est.) |
|---|---|---|
| 1 month | 10M | 5 GB |
| 1 year | 120M | 60 GB |
| 5 years | 600M | 300 GB |
10. Related Work
10.1 Embedded Databases
SQLite pioneered the embedded database model, demonstrating that client-server architecture is unnecessary for most applications. iCommerce applies this principle to commerce. DuckDB extends embedded analytics, inspiring our embedded forecasting capabilities.10.2 Event Sourcing
EventStore and Kafka provide event streaming infrastructure. VES differs by:- Targeting agent-to-agent coordination
- Providing cryptographic commitments
- Supporting offline-first operation
- Including end-to-end encryption groups
10.3 Commerce Platforms
Shopify, Stripe, and BigCommerce provide SaaS commerce infrastructure. iCommerce differs by:- Embedded architecture (no network dependency)
- Agent-first design (MCP tools, not dashboards)
- Verifiable execution (Merkle proofs)
- Native stablecoin payments (x402)
10.4 Layer-2 Solutions
Optimism and Arbitrum provide general-purpose L2 scaling. Set Chain specializes for commerce with:- SetRegistry for event anchoring
- SetPaymaster for merchant gas sponsorship
- Integration with off-chain sequencer
- x402 payment settlement
10.5 Agent Payment Protocols
x402 builds on the HTTP 402 status code to enable machine-to-machine payments. Unlike traditional payment processors that require human-facing checkout flows, x402 operates entirely at the protocol level, enabling autonomous agents to negotiate and settle payments as part of standard HTTP request/response cycles.10.6 Conversational Commerce
Twilio, MessageBird, and Vonage provide messaging APIs. The StateSet messaging gateway differs by:- Deep commerce engine integration (not just messaging)
- AI-native design (agents as first-class participants)
- Event-driven notifications from commerce operations
- Identity resolution across platforms
11. Conclusion
StateSet iCommerce represents a new paradigm for commerce infrastructure: embedded, verifiable, and agent-first. The five-layer architecture provides:- Local autonomy via the embedded engine with 32 commerce domains
- Global coordination via Verifiable Event Sync with end-to-end encryption
- Cryptographic finality via Set Chain settlement
- Native payments via the x402 HTTP payment protocol
- Omnichannel presence via the 9-channel messaging gateway
11.1 Future Work
Near-term (2026):- Zero-knowledge validity proofs for event batches
- Agent-to-agent negotiation protocol
- Cross-chain settlement bridges
- Expanded vector search with custom embedding models
- Additional messaging channels (Matrix, RCS)
- Decentralized identity integration
- Federated learning across tenants
- On-device ML models for demand prediction
- Real-time collaborative editing of commerce data
- Fully autonomous supply chain orchestration
- Cross-border compliance automation
- Global commerce network federation
- Autonomous agent marketplaces with x402 settlement
References
- SQLite Consortium. “SQLite: A Self-Contained SQL Database Engine.” https://sqlite.org
- Ethereum Foundation. “Optimistic Rollups.” https://ethereum.org/en/developers/docs/scaling/optimistic-rollups/
- Anthropic. “Model Context Protocol Specification.” https://modelcontextprotocol.io
- Merkle, R.C. “A Digital Signature Based on a Conventional Encryption Function.” CRYPTO 1987.
- Lamport, L. “Time, Clocks, and the Ordering of Events in a Distributed System.” CACM 1978.
- Coinbase. “x402: HTTP-Native Payments Protocol.” https://www.x402.org
- OpenAI. “Text Embedding Models.” https://platform.openai.com/docs/guides/embeddings
Appendix A: System Statistics
| Component | Metric | Value |
|---|---|---|
| stateset-core | Lines of Code | ~45,000 |
| stateset-db | Lines of Code | ~55,000 |
| stateset-embedded | Lines of Code | ~39,000 |
| Total Rust (3 crates) | Lines of Code | ~139,000 |
| Node.js binding | Technology | NAPI-RS |
| Python binding | Technology | PyO3 |
| Ruby binding | Technology | Magnus |
| PHP binding | Technology | ext-php-rs |
| Java binding | Technology | JNI |
| Kotlin binding | Technology | JNI |
| Swift binding | Technology | C FFI |
| .NET binding | Technology | P/Invoke |
| Go binding | Technology | cgo |
| WASM binding | Technology | wasm-pack |
| CLI (mcp-server) | Size | 221 KB |
| CLI (harness) | Size | 62 KB |
| Domain Modules | Count | 32 |
| Domain Types | Count | 400+ |
| Database Tables | Count | 70+ |
| Database Migrations | Count | 28 |
| API Methods | Count | 700+ |
| Language Bindings | Count | 10 |
| Commerce Skills | Count | 38 |
| AI Providers | Count | 4 |
| Messaging Channels | Count | 9 |
| Heartbeat Checkers | Count | 6 |
| CLI Programs | Count | 26+ |
| Sequencer | Lines of Code | ~5,000 |
| Set Chain Contracts | Lines of Code | ~1,000 |
| Anchor Service | Lines of Code | ~2,250 |
Appendix B: API Summary
Embedded Engine (per domain)
Commerce Operations:Sequencer API
MCP Sync Tools
Heartbeat API
Gateway API
StateSet iCommerce v0.3.1 January 2026