System Architecture & Protocol Design
How Vigil orchestrates forward obligation modeling, liquidity route selection, metered x402 settlements, and verifiable HCS consensus logs.
Protocol Interaction Diagram
Mirror-Node Verified Architecture┌───────────────────────────────────────────────────────────────────────────┐
│ VIGIL ARCHITECTURE │
└───────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────┐
│ Vigil Discovery Registry (:3004) │
│ (Machine Discovery & HCS Registered) │
└──────────────────────┬───────────────────────┘
│ GET /services
▼
┌───────────────────────────────────────────────────────────────────────────┐
│ Vigil Agent (:3002) │
│ ┌────────────────┐ ┌──────────────────┐ ┌───────────────────────────┐ │
│ │ Treasury Core │ │ Solvency Engine │ │ Autonomous Router Matrix │ │
│ │ (HBAR & FUSDC) │ │ (PCR & Shortfall)│ │ (VigilRouter vs DEX) │ │
│ └───────┬────────┘ └────────┬─────────┘ └─────────────┬─────────────┘ │
└──────────┼────────────────────┼──────────────────────────┼────────────────┘
│ │ │
│ │ Swap Leg 1: HBAR │ POST /settle
│ ▼ ▼
│ ┌─────────────────────────────────────────────────┐
│ │ VigilRouter LP Service (:3003) │
│ │ Rate: 2 HBAR/FUSDC + 30 bps · Mirror Verified │
│ └────────────────────────┬────────────────────────┘
│ │ Swap Leg 2: FUSDC
│ 402 → Pay FUSDC → Proof 200 ▼
▼ ┌─────────────────────────────┐
┌───────────────────────────────────────┐ │ Hedera Token Service │
│ Merchant API Service (:3001) │ │ (0.0.10510032) │
│ • /market-data (x402 metered) │ │ Fixed Fee: 0.01 FUSDC/tx │
│ • /refund (safety fallback) │ └──────────────┬──────────────┘
│ • Replay Protection Store │ │
└──────────────────┬────────────────────┘ │
│ │
▼ ▼
┌───────────────────────────────────────────────────────────────────────────┐
│ Hedera Consensus Service (HCS) │
│ • Audit Topic: 0.0.10524552 (Immutable State Machine Log) │
│ • Identity Topic: 0.0.10524553 (HCS-14 Agent Identity & Policy Vault) │
└───────────────────────────────────────────────────────────────────────────┘Autonomous Agent Treasury & Solvency Engine
Located in apps/agent. The agent monitors its native balances and evaluates forward obligations across scheduled tasks.
When PCR is below 110.0%, a SHORTFALL_DETECTED event is emitted to the HCS audit topic. The agent calculates the exact shortfall (e.g., 10.30 FUSDC) and formulates an acquisition order for 11.00 FUSDC.
VigilRouter LP Service (Two-Leg Settlement)
Located in apps/router. Vigil provides an automated liquidity venue that swaps HBAR for FUSDC at a deterministic rate of 2 HBAR per FUSDC plus 30 bps LP fee.
Two-Leg Settlement Sequence:
- Leg 1 (HBAR Deposit): Agent transfers 22.066 HBAR to the Router LP account on Hedera.
- Mirror Verification: Router queries the Hedera Mirror Node to confirm the transfer succeeded within freshness bounds (< 120s) and checks replay store.
- Leg 2 (FUSDC Payout): Router transfers 11.00 FUSDC to the Agent account and logs
SWAP_SETTLEDto HCS topic0.0.10524552.
x402 Protocol & Metered API Service
Located in apps/api-service. The Merchant operates a market intelligence API gated behind the HTTP 402 Payment Required standard.
Metering & Fee Assessment:
Queries are priced dynamically: 0.50 FUSDC base + 0.10 FUSDC per field requested (price, volume, sentiment, volatility, trend = 1.00 FUSDC). Every transfer is assessed a 0.01 FUSDC fixed custom fee directly to the fee collector under HIP-18.
Hedera Consensus Service (HCS-14 Identity & Audit)
Every critical lifecycle event is published to HCS topic 0.0.10524552. In addition, the agent anchors its capabilities, public keys, and solvency policy bounds to HCS Identity Topic 0.0.10524553 under an HCS-14-inspired standard.
Observe the Protocol in Action
Test the live router quotes, solvency transitions, and metered x402 calls on Hedera Testnet.
