← All Projects/Flagship Technical Project

Rieko

Operational intelligence engine for Bitcoin and Lightning infrastructure

A deterministic systems engine written in Rust that ingests live telemetry from Bitcoin Core and LND, builds an in-memory graph, evaluates typed detectors, generates prioritized operational recommendations, and executes deterministic what-if simulations.

Core Operational Thesis

"Rieko helps Bitcoin and Lightning operators understand what is happening, why it matters, and what actions they should consider—deterministically, safely, and without blind automation."

The Operational Problem

Telemetry Volume vs. Actionable Signal

Operating Bitcoin Core and LND nodes generates massive streams of telemetry: channel capacities, HTLC forwarding events, peer disconnections, and dynamic fee fluctuations.

Operators face two failure modes: drowning in noisy dashboards without clear root-cause context, or relying on black-box automated rebalancing scripts that execute dangerous, costly mutations against live channels without deterministic simulation.

The Rieko Approach

Typed Pipeline & Mathematical Projections

Rieko structures node management as an immutable intelligence pipeline. Raw REST/RPC events are normalized into domain models, mapped onto a typed routing graph, and evaluated by deterministic detectors.

Instead of unverified rebalancing, Rieko v2 computes deterministic what-if simulations: projecting the exact mathematical outcome of a liquidity transfer against a historical snapshot with zero node contact.

Rieko Processing Pipeline

Deterministic execution from raw LND telemetry to replayable what-if projections

STAGE 01 OF 05

Ingestion & Normalization

Pulls channel, peer, and forwarding telemetry via LND REST or Bitcoin Core RPC normalizers into canonical domain models.

Technical Components & Invariants:
rieko-ingest-lndrieko-ingest-corerieko-domain
Design Invariants

Engineering Principles & Safety Model

01

Deterministic Detection

Every finding has a stable identity derived from canonical evidence. Replaying a snapshot produces zero duplicate alerts.

02

Typed Operational Evidence

Findings and recommendations are typed Rust structs with strictly validated invariants.

03

Decoupled LLM Layer

Language models provide optional human-readable summaries; they never participate in threshold evaluation or detector decisions.

04

Zero Node Mutation

The simulation subsystem produces local projections only. Simulation routes cannot contact or mutate a live node.

05

Single-Writer WAL Persistence

SQLite runs in WAL mode with synchronous=NORMAL. Monitor locks prevent dual writers while enabling concurrent read-only queries.

06

Append-Only Auditability

State changes and simulation projections are recorded into an append-only audit trail enforced by database triggers.

Rust Workspace Architecture

Modular Kernel & Engine Crates

Organized into clear domain layers ensuring pure mathematical logic is decoupled from side effects.

rieko-domainKernel

Core domain primitives, channel models, and balance types

rieko-graphKernel

Typed Lightning topology graph with path-finding algorithms

rieko-simulationKernel

Pure mathematical simulation models for liquidity redistribution

rieko-storagePersistence

SQLite WAL backend, transaction management, and migrations

rieko-findingsEngine

Typed findings, recommendation schemas, and fingerprinting

rieko-detectorsEngine

Deterministic liquidity and drift detection algorithms

rieko-recommendationsEngine

Finding-to-recommendation mapping and prioritization

rieko-simulation-appEngine

Simulation orchestration, projection comparisons, and reporting

rieko-alertsEngine

Alert deduplication, persistent cooldowns, and Telegram dispatcher

rieko-llmEngine

Optional OpenAI/Groq client for plain-language evidence explanation

rieko-statusEngine

O(1) system health assessment and node connectivity status

rieko-ingest-lndIngest

LND REST client, macaroon authentication, and data normalizer

rieko-ingest-coreIngest

Bitcoin Core RPC client and mempool/block normalizer

rieko-apiInterface

axum HTTP API routes, middleware, and embedded frontend delivery

rieko-cliInterface

Command-line interface entrypoint for scan, monitor, and simulations

rieko-executionFuture

Feature-gated node mutation module with strict runtime interlocks

v2 Deterministic Simulation

Pure Liquidity Redistribution Model

Every simulation is bound to exact source and destination channel snapshots observed at runtime. Replaying with identical inputs generates the same cryptographic SHA-256 fingerprint.

  • Projections compute baselines, deltas, assumptions, and confidence bounds.
  • Rate-limited to 5 requests/sec to prevent local compute exhaustion.
  • Contains explicit safety statement guaranteeing zero mutation.
Persistence & Storage Safety

Single-Writer WAL Architecture

Rieko uses an embedded SQLite database versioned transactionally with automatic schema upgrades. Readers query concurrently while a single monitor thread holds write authority.

  • WAL mode with synchronous=NORMAL and finite busy timeouts.
  • Append-only audit trail enforced by database triggers.
  • Status queries execute in O(1) time without full table scans.