CONWAY-01 · INSTITUTIONAL TECHNICAL PAPER
TRIPLE-RAIL x402 V2 ARCHITECTURE Canonical Spec: docs/CONWAY_TRIPLE_RAIL_TECHNICAL_PAPER.md

Triple-Rail x402 Settlement

Solana USDC (ExactSvmScheme), Bitcoin Lightning ([email protected]), and Monero RandomX Stratum (:3334).

50-PC Sovereign Fleet Yield

Difficulty-calibrated XMR & Work-Credit routing with deterministic miner onboarding (/api/miner/*).

$Conway-Sol Token-2022

6,139,148.11 $Conway-Sol Jupiter-locked until 2027 · 2,000 CONWAY verified on-chain burns.

Sovereign Guardrails

Enforced spend caps ($5/tx · $50/hr · $200/day) decoupled cleanly from treasury reserve locks.

# Conway-01 Technical Paper: Non-Custodial Triple-Rail AI Commerce (`x402 V2`) & Sovereign DePIN Proof-of-Work

**Canonical Domain:** `https://conwayagent.net`  
**Protocol Standards:** HTTP `402` (`x402 V2`), EIP-8004 Agent Discovery, Solana SPL / Token-2022 (`ExactSvmScheme`), Bitcoin Lightning (`LN-SAT` HTLC), Monero RandomX (`P2Pool Mini` / Stratum `:3333` & `:3334`)  
**Version:** `1.0.0` | **Status:** Operational Architecture Specification

---

## 1. Executive Abstract

Autonomous AI agents face two structural barriers when participating in open digital economies: **(1) identity and spending accountability** without centralized KYC bottlenecks, and **(2) cold-start capital access** when a new machine or agent possesses CPU compute rather than pre-funded stablecoins.

**Conway-01** solves both constraints through a single non-custodial economic architecture combining:
1. **Triple-Rail `x402 V2` Settlement:** Cognitive services, attestations, and API work settle atomically via **Solana Mainnet** (`USDC` / `SOL`), **Bitcoin Lightning Network** (`SAT` fractions of BTC down to 2 SAT), or **Monero RandomX computational work** on Stratum port `:3334`.
2. **Sovereign Agent Notary & AAC-402 Credentials:** A 25-year utility credential stack (`sovereign_agent_passports` + `x402_native_agent_cards`) cryptographically sealed with `SHA3-256` and `ED25519-SHAKE256-FIPS204-ENVELOPE` (with post-quantum lattice `ML-DSA-65 + ML-KEM-768` on the roadmap).
3. **Decoupled Financial Guardrails:** Deterministic policy gates (`guardrails.py`) enforce hard spend limits (`$5.00/tx`, `$50.00/hr`, `$200.00/day` configured in `.env.example`) separating autonomous inference from treasury signing authority.
4. **DePIN RandomX Flywheel & Verifiable On-Chain Deflation:** Idle CPU compute contributes to decentralized Monero mining (`monerod` + P2Pool), powering `$Conway-Sol` token buybacks and immutable on-chain burns on Solana Mainnet.

---

## 2. Triple-Rail `x402 V2` Settlement Architecture

Instead of locking autonomous agents into a single blockchain or payment rail, Conway-01 implements a unified HTTP `402 Payment Required` negotiation layer in `api/routes_x402.py`. Unpaid calls return machine-readable requirements across supported payment schemes; verified settlement triggers deterministic execution and deliverable persistence.

### 2.1 Rail 1 — Solana Mainnet (`ExactSvmScheme`)
- **Treasury / PayTo Public Key:** `6xdrhYUaRww1Nm7BbZxaKJ5q9aPiqK9QavUZkNe3ZqPt`
- **Assets:** SPL-USDC (`EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`, 6 decimals) and Native SOL.
- **Fail-Closed Verification (`payment_service/work_receipts.py`):**
  - Every `POST /api/x402/work` quote binds an order-specific client key (`X-Order-Key`, 32–128 URL-safe characters) into a deterministic `SHA-256` memo: `conway-work:<64-hex-digest>`.
  - `verify_receipt()` inspects finalized Solana RPC transaction logs directly, asserting `meta.err is None`, block timestamp freshness (`<= 600s`), exact SPL Memo program instruction equality, and exact post-minus-pre ATA credit against the treasury wallet.
  - Replay attacks and spoofed signatures are rejected fail-closed with zero mock shortcuts.

### 2.2 Rail 2 — Bitcoin Lightning Network (`scheme: "lightning"`, `asset: "SAT"`)
- **Lightning Address:** `[email protected]`
- **Network & Asset:** `bitcoin/mainnet` · `SAT` (`1 SAT = 0.00000001 BTC`).
- **Cryptographic HTLC Settlement (`payment_service/lightning_receipts.py`):**
  - Enables genuine sub-cent micro-payments (as small as **`2 SAT` ≈ `$0.002` USD** for `compute_budget_opt`).
  - Clients settle a Lightning invoice and submit the 32-byte cryptographic preimage (64-char hex).
  - The verifier enforces `SHA-256(preimage) == payment_hash` against a non-expired, settled invoice in `lightning_invoices`, consuming the preimage once to block double-spending.

### 2.3 Rail 3 — Monero RandomX Proof-of-Work Quittance (`Stratum :3334`)
Agents or DePIN node operators starting with zero USDC/BTC can earn their **25-year Sovereign PQ Passport** (`$10.00` quota) and **AAC-402 Virtual Card** (`$10.00` quota) strictly through CPU RandomX computation:
1. **Registration (`POST /api/miner/register`):** Machine binds a non-custodial Monero payout address and Solana delivery wallet (anti-sybil cap: `MAX_MACHINES_PER_SOLANA_WALLET = 5` in `miner_onboarding/pricing_policy.py`).
2. **Test Battery Verification (`POST /api/miner/test-battery`):** Machine proves >= `300.0 H/s` RandomX benchmark + low-latency Stratum handshake alongside a `$0.10 USDC` x402 verification fee.
3. **Credit Accrual (`STATE_PAGANDO`, `miner_onboarding/onboarding_service.py`):** Hashpower connects to `pool.conwayagent.net:3334`. Shares (`difficulty >= 100.0`) route to the Conway Treasury Monero address (`4AXrHkGBa9E3NyS6uagt6i2JSgdB6xijuTtF8vbT2z4wJ43rzvE1JFkN56u5vq4fkM791KWp4WNFbgdghX96C2mfRCcGYrm`) under a serializable SQLite lock (`BEGIN IMMEDIATE`) with duplicate-nonce rejection.
4. **Autonomous Quittance (`$20.00 USD`):** Once `accumulated_credit_usd >= 20.00` (optionally gated by local P2Pool Mini PPLNS inclusion when `CONWAY_REQUIRE_PPLNS_PROOF=true`), the engine transitions the machine to `MINERACAO_LIVRE`, issues the 25-year Sovereign Passport and AAC-402 Virtual Card, and switches share routing directly to the miner's personal Monero wallet (`monero_payout_wallet`).

---

## 3. Mathematical Share Valuation & 50-PC Swarm Economics

Conway absorbs P2Pool block-time variance during onboarding (`miner_variance_reconciliation`) by crediting every valid share at its exact probabilistic expected value (`calculate_share_credit()` in `miner_onboarding/pricing_policy.py`):

$$\text{Expected XMR} = \left(\frac{\text{Share Difficulty}}{\text{P2Pool Difficulty}}\right) \times \text{Block Reward (0.6 XMR)}$$

$$\text{Expected USD} = \text{Expected XMR} \times \text{Oracle XMR/USD Price}$$

An oracle sanity bound (`is_sane_xmr_price`, enforcing `$10.00 <= XMR <= $10,000.00`) fails closed against manipulated or NaN feed values.

### 3.1 30-Day Swarm Output Model (50 Connected PCs)
Assuming `720 blocks/day * 0.6 XMR = 432 XMR/day` network tail emission (`12,960 XMR / 30 days`) across a reference `3.00 GH/s` global network hashrate (with sensitivity shown for `~3.11 GH/s`):

| Hardware Tier (Per Machine) | 50-PC Fleet Hashrate | Est. Monthly XMR (`3.0 GH/s` Ref) | Est. Monthly XMR (`~3.11 GH/s`) | Value @ `$160/XMR` | Full `$20` Quittances Funded/Mo |
| :--- | :--- | :--- | :--- | :--- | :--- |
| **Eco / Notebook (`568 H/s`, ~15W)** | `28.4 kH/s` | `0.1227 XMR` | `~0.118 XMR` | `~$19.63` | `~1 machine/mo` |
| **Office Desktop (`3,000 H/s`)** | `150.0 kH/s` | `0.6480 XMR` | `~0.625 XMR` | `~$103.68` | `~5 machines/mo` |
| **Modern Ryzen 5 (`5,000 H/s`)** | `250.0 kH/s` | `1.0800 XMR` | `~1.041 XMR` | `~$172.80` | `~8 machines/mo` |
| **Performance Ryzen 7 (`8,500 H/s`)** | `425.0 kH/s` | `1.8360 XMR` | `~1.770 XMR` | `~$293.76` | `~14 machines/mo` |
| **High-Core Ryzen 9 (`15,000 H/s`)** | `750.0 kH/s` | `3.2400 XMR` | `~3.124 XMR` | `~$518.40` | `~25 machines/mo` |

Verified hermetically in `tests/test_audit_bloco2_ts_and_security.py` (`test_50_pc_swarm_onboarding_and_monthly_xmr_yield`).

---

## 4. On-Chain Tokenomics, Vesting & Proof-of-Burn (`$Conway-Sol`)

All Solana token commitments below match `docs/public_claims.json` and `main.py` (`/api/stats`) and are verified offline by `scripts/claims_check.py --strict`:

- **Token Symbol & Standard:** `$Conway-Sol` · **SPL Token-2022** (`TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb`), `6` decimals.
- **Mint Contract Address (CA):** `5wyVHQcToNiSZsDVzDViZWQ8gRQng6TGTJ2U3NKSpump`
- **Agent Operating Hot Wallet (`payTo`):** `6xdrhYUaRww1Nm7BbZxaKJ5q9aPiqK9QavUZkNe3ZqPt`
- **Creator Cold Vault (Offline Reserve):** `7hZL5BehXwonASUKRjC6an6Q9A9eadupQmBCSEc8ptUE`
- **Jupiter Lock Vesting (Locked through `2027-11-12`, Program `LocpQgucEQHbqNABEYvBvwoxCPsSbG91A1QaQhQQqjn`):**
  - **Total Locked:** `6,139,148.114267 $Conway-Sol`
  - **Lock #1 (`4,546,584.390888` tokens):** Escrow `BP5H7CWyRg9krV2FoYWzmRBkkdhsmVx1MNs91xL7RqR` · TX `3R4YVTDPVbc7nY9rfrcu16NN3edx2meo7mrPH9TVM5exqSiUVsjycwpcKAMHi2LTzZwKFsosyXY7koNCrV7HjQEB`
  - **Lock #2 (`1,592,563.723379` tokens):** Escrow `F26NGeFmsgUecKw381JY2cz9cJptJSMnZiPoApFL2XQG` · TX `5ksTfcNBg9aCdWLpSCAnCzQg9WMWP9D6kQrbHXPJpoKMSVXCxjUSCn3WLCYSR82hBgQ3o1cztrntN7Hf6PGFbfYQ`
- **Verified Permanent Burns (`35,515,177 $Conway-Sol` Total Supply Burned | `964,484,822.45` Current Supply):**
  - Includes **`513,827 $Conway-Sol`** burned directly via 6 verified autonomous buyback / treasury SPL Token-2022 `BurnChecked` transactions (expanding past the initial `2,000 $Conway-Sol` genesis milestone):
  - **Burn #1 (`1,000 $Conway-Sol` Genesis Burn):** `468VSNe3XFhaWqNKgvdWGHqHCBFoV3gNu758STFmEsX3q9EAvwgDGtE6wQvPcDrVkc7nKPbZgfmxKTs7G74t9oUg`
  - **Burn #2 (`1,000 $Conway-Sol` Signer Rotation & Monero Memo Burn — completing initial `2,000 $Conway-Sol` milestone):** `2XydNKxweDRMNaEkuH4knxYiZbaVWbi7sujBPMcfqkk82u7xEGjjZnZRpRZkaQyUWQHq2goC7VZLzCdbUbbdcU6W`
  - **Burn #3 (`10,000 $Conway-Sol` Treasury Burn):** `4MTL3DNLEcePNACntjezpLXsseXjwPsBpvXCRseCUzZdBU8pZ9A6xWghHTY2P6nmqSSHdBpGLrcGkH3xKMfaVGfa`
  - **Burn #4 (`3,000 $Conway-Sol` BurnChecked):** `zgm7yf2QRBHVef5F72TnY7xbzFTgdwnf7x4LGJynpskYkveqPTDwZZSE5SM6bqRCXii6KsCPNWN3dau8WsoAE9M`
  - **Burn #5 (`5,000 $Conway-Sol` BurnChecked):** `3NXW5443Av7Xee3E11SGBrPwbP66Ms2XP2x88tX3f683KL2K2nuk7Rxokv9Usumi5EpQivfQff4vMx1zhastA7PM`
  - **Burn #6 (`493,827 $Conway-Sol` Autonomous `$10 USD` BurnChecked):** `vsLMNJb2KdsqfJyTU3bffhLHQxsvgMCFUHMesGdTmaRXj13QGobiub5jeAfEoQAdQWZsJv2Lec5ycj3TNYG2mvR`

---

## 5. Decoupled Financial Guardrails & Engineering Disclosure

Conway-01 enforces strict privilege separation between autonomous cognition and financial settlement:
- **Deterministic Spend Caps (`guardrails.py` & `.env.example`):** `$5.00 USD` per transaction, `$50.00 USD` hourly ceiling, and `$200.00 USD` daily ceiling, evaluated across `COMPLETED`, `SUBMITTED`, `UNKNOWN_RECOVERY`, and `SENDING` reservations in USD micro-dollars so mid-flight crashes never bypass rolling limits.
- **Gateway Allowlist Isolation (`scripts/public_gateway.py`):** Public reverse-tunnel ingress (`:8788`) forwards only explicitly allowlisted discovery, telemetry, and payment endpoints, denying internal metrics (`/metrics`) and control routes with HTTP `403`.
- **Verification Discipline:** Security audit outputs combine static/heuristic code inspection with live Solana RPC state; they are engineering diagnostics rather than third-party human audits. Claims displayed on `https://conwayagent.net` are continuously checked against source files via `scripts/claims_check.py --strict`.

---

## 6. Official `x402 V2` & Solana `ExactSvmScheme` Wire-Level Specification

Conway-01 implements full protocol conformance with the open `x402 V2` HTTP transport standard and Solana `ExactSvmScheme` (`coinbase/x402` / `solana-foundation/x402`), while preserving backward compatibility with `x402 V1` (`X-Payment`) clients:

### 6.1 CAIP-2 Network Identifiers
- **Solana Mainnet-Beta:** `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`
- **Solana Devnet:** `solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1`
- **USDC Asset Mint (Mainnet):** `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` (`6` decimals)

### 6.2 HTTP V2 Base64 Header Handshake (`api/routes_x402.py`)
- **`PAYMENT-REQUIRED` (Server → Client on `HTTP 402`):** Base64-encoded `PaymentRequired` JSON containing `x402Version: 2`, `resource: {url, description, mimeType}`, `accepts[]` across all active settlement rails (`exact`, `solana-transfer`, `lightning`), and `extensions.bazaar` (JSON Schema Draft `2020-12` machine discovery metadata).
- **`PAYMENT-SIGNATURE` (Client → Server on retry):** Base64-encoded `PaymentPayload` JSON carrying either:
  - `payload.transaction` (partially-signed Solana `VersionedTransaction` for `ExactSvmScheme` facilitator settlement),
  - `payload.signature` (finalized Solana transaction signature bound with `X-Order-Key`), or
  - `payload.preimage` (32-byte Bitcoin Lightning HTLC preimage).
  - Full backward compatibility with `X-Payment` (`x402 V1`).
- **`PAYMENT-RESPONSE` (Server → Client on `HTTP 202`):** Base64-encoded `SettlementResponse` JSON (`{"success": true, "transaction": "<sig>", "network": "<caip2>", "payer": ""}`).

### 6.3 Strict `ExactSvmScheme` Instruction-Level Verification (`payment_service/x402_exact.py`)
Before forwarding any partially-signed transaction to the facilitator (`/verify` and `/settle`), Conway-01 enforces deterministic structural invariants:
1. **No Address Lookup Tables:** `address_table_lookups` must be empty so no hidden accounts can be injected outside `msg.account_keys`.
2. **Fee Payer Isolation:** Requires `account_keys[0] == extra.feePayer` and verifies `feePayer` never appears as an instruction program ID or instruction account (preventing facilitator balance drain).
3. **Client Ed25519 Pre-Verification:** Verifies all required client Ed25519 signatures (`tx.signatures[1..n_sig]`) over `to_bytes_versioned(msg)` locally before invoking the facilitator.
4. **Canonical 3-to-6 Instruction Layout:**
   - **Instruction 0:** `ComputeBudget111111111111111111111111111111::SetComputeUnitLimit` (discriminant `0x02`)
   - **Instruction 1:** `ComputeBudget111111111111111111111111111111::SetComputeUnitPrice` (discriminant `0x03`, capped at `<= 5,000,000` micro-lamports/CU)
   - **Instruction 2:** `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA` or `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb` `TransferChecked` (instruction discriminant `12`, exact `6` decimals, exact `amount`, destination equal to canonical ATA derived via `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`)
   - **Optional Trailing Instructions (3..5):** Restricted exclusively to `MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr` (at most `1` SPL Memo) and `L2TExMFKdjpN9kozasaurPirfHy9P8sbXoAN1qA3S95` (Solana Lighthouse assertion program).
5. **Post-Settlement Read-Only Finality:** After facilitator settlement returns a signature, `wait_for_receipt()` runs a direct, read-only `finalized` RPC receipt check (`payment_service/work_receipts.py`) before creating any work order.

---

## 7. Monero `RandomX (rx/0)` & `P2Pool` Consensus Specification

Conway-01 integrates directly with decentralized Monero Proof-of-Work and P2Pool consensus rules to turn permissionless CPU compute into verifiable settlement capital:

### 7.1 RandomX (`rx/0`) Proof-of-Work Parameters
- **Seed Hash Epoch:** Regenerated every **`2048` Monero blocks** (~3.53 days at `120s` mainchain block target) with a deterministic **`64`-block activation lag** (`SEEDHASH_EPOCH_BLOCKS = 2048`, `SEEDHASH_EPOCH_LAG = 64`).
- **Memory Architecture:** `2 GiB` shared scratchpad dataset in fast mode (`--randomx-mode=fast`) or `256 MiB` L3-cache mode in light deployments, preserving ASIC resistance for general-purpose x86/ARM CPUs.
- **Perpetual Tail Emission:** **`0.6 XMR` per block** (`720 blocks/day = 432.0 XMR/day` network issuance).

### 7.2 P2Pool Sidechain & PPLNS Window
- **Sidechain Block Time Target:** **`10` seconds** per P2Pool share block.
- **Rolling PPLNS Window:** **`2160` sidechain blocks** (~6 hours of trailing share difficulty history on the sidechain).
- **Uncle Block Consensus:** Uncle shares up to `<= 3` sidechain blocks behind tip are accepted with a **`20%` uncle penalty** (**`80%` effective share weight**), preventing latency-induced orphan loss across distributed DePIN nodes.
- **Zero-Fee Decentralization & Dual Stratum Routing:**
  - **Stratum `:3333` (`pool.conwayagent.net:3333`):** 0.00% fee decentralized P2Pool Mini community cluster.
  - **Stratum `:3334` (`pool.conwayagent.net:3334`):** Autonomous Agent Onboarding & Quittance Proxy (`miner_onboarding/onboarding_service.py`) backed by SQLite `WAL` (`PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL;`) and `BEGIN IMMEDIATE` serializable share accounting.

---

## 8. Silicon-Level AI Model Compression Engine (Phase 09)

To operate 24/7 cognitive inference and vector memory retrieval within a sovereign **~21W TDP** edge footprint alongside `monerod` and `P2Pool`, Conway-01 implements three deterministic model compression layers:

### 8.1 Quantization (`u8 x i8` Zero-Point SIMD & 1-Bit Binary Sign Embeddings — 32x Memory Reduction)
- **Zero-Point Rust SIMD Cosine (`agent_core/semantic_encoder.py`):** Shifts symmetric signed `INT8` query vectors to unsigned `UINT8` ($u_i = q_i + 128 = b_i \oplus \text{0x80}$) and applies exact offset compensation ($-128 \sum c_i$) over the compiled Rust AVX2 / AVX-512 VNNI kernel (`conway_simd_batch_vector_search` in `native/conway_simd_accel/src/lib.rs`), matching scalar `INT8` cosine to `< 1e-6`.
- **1-Bit Binary Quantization (`embed_binary_1bit` / `hamming_sim_1bit`):** Compresses 128-dimensional `FP32` vectors (`512 bytes`) into `INT8` (`128 bytes`, `4x` smaller) and `1-bit` sign bitmasks (**`16 bytes`**, **`32x` compression vs `FP32`**), evaluated via hardware `POPCNT` (`bit_count()`) Hamming distance.

### 8.2 Pruning (Projection Memory Compaction & Episodic Coreset Deduplication)
- **Projection Buffer Pruning (`agent_core/semantic_encoder.py`):** Compacts the `4096 x 128` projection table (`_PROJ_FLAT`) into a contiguous `array('f')` `float32` buffer, eliminating `524,288` boxed Python `float` heap allocations, paired with magnitude sparsity pruning (`prune_vector_int8()`).
- **Episodic Coreset Pruning (`agent_core/db_maintenance.py`):** `prune_redundant_episodic_memories()` deduplicates redundant `EPISODIC` memory entries over bounded SQLite maintenance sweeps while keeping the newest canonical representative and never altering `PROCEDURAL`, `SEMANTIC`, or hash-chained `audit_logs` records.

### 8.3 Knowledge Distillation (Ollama Teacher -> 128-Neuron INT8 Rust SIMD Student)
- **Two-Stage Semantic Skill Distillation (`agent_core/skill_evolution.py`):** Combines exact normalized clustering with `INT8` cosine merging (`>= 0.80`) so recurring operational lessons distill into `learned_skills` even across reordered phrasing.
- **Distilled Policy Router (`distilled_policy_forward` in `agent_core/simd_accel.py`):** Packs up to 128 distilled skill/tool `INT8` prototypes into a column-major matrix executed in a single AVX2 / AVX-512 forward pass via `conway_nn_layer128_forward`, complementing the local loopback Ollama `llama3.2:1b` Teacher runtime.