[MVP] SQLite ledger with bond escrow #11

Closed
opened 2026-03-10 20:50:04 +00:00 by Mark · 3 comments
Owner

Implement economic layer with SQLite backend.

Schema

  • agents table (id, reputation, bond_balance)
  • transactions table (intent_id, amount, type)
  • escrow table (pending bonds, timeouts)

Operations

  • escrow_bond(agent_id, amount, intent_id)
  • release_bond(agent_id, intent_id, reward=True/False)
  • slash_bond(agent_id, intent_id, percentage)
  • get_reputation(agent_id)

Files

  • substrate/ledger.py
  • tests/test_ledger.py

See MVP_AND_POCS.md

Implement economic layer with SQLite backend. ## Schema - agents table (id, reputation, bond_balance) - transactions table (intent_id, amount, type) - escrow table (pending bonds, timeouts) ## Operations - escrow_bond(agent_id, amount, intent_id) - release_bond(agent_id, intent_id, reward=True/False) - slash_bond(agent_id, intent_id, percentage) - get_reputation(agent_id) ## Files - substrate/ledger.py - tests/test_ledger.py See MVP_AND_POCS.md
Author
Owner

Implementation note from v1 protocol pass:

  • runtime/node1_worker.py currently evaluates claim gates using CLI-provided --agent-balance and --agent-reputation values.
  • Next step is wiring this to SQLite ledger reads/writes for escrow and settlement so gate decisions are backed by durable economic state.

This keeps runtime unblocked while issue #11 provides the authoritative ledger implementation path.

Implementation note from v1 protocol pass: - `runtime/node1_worker.py` currently evaluates claim gates using CLI-provided `--agent-balance` and `--agent-reputation` values. - Next step is wiring this to SQLite ledger reads/writes for escrow and settlement so gate decisions are backed by durable economic state. This keeps runtime unblocked while issue #11 provides the authoritative ledger implementation path.
Author
Owner

Completion update:

Implemented in working tree:

  • SQLite ledger backend in substrate/ledger.py
    • tables: agents, transactions, escrow, intents, claim_leases, settlement lock tables
  • Core operations implemented:
    • escrow_bond
    • release_bond
    • slash_bond
    • get_reputation
  • Additional durability and arbitration support included.
  • Test coverage present in tests/unit/test_ledger.py and settlement/lease tests.

Issue acceptance is satisfied; closing.

Completion update: Implemented in working tree: - SQLite ledger backend in `substrate/ledger.py` - tables: `agents`, `transactions`, `escrow`, `intents`, `claim_leases`, settlement lock tables - Core operations implemented: - `escrow_bond` - `release_bond` - `slash_bond` - `get_reputation` - Additional durability and arbitration support included. - Test coverage present in `tests/unit/test_ledger.py` and settlement/lease tests. Issue acceptance is satisfied; closing.
Mark closed this issue 2026-03-13 01:41:33 +00:00
Author
Owner

Phase Dependency Mapping

Linked to Phase Tracker: #27 (Phase 0: Foundation MVP) ✅ COMPLETED

Prerequisites: N/A (core infrastructure)

Blocks:

  • #8 (Integration test) - needs ledger for settlement
  • #10 (Intent classification) - stores routing preferences
  • #14 (Daily rumination) - economic analysis needs ledger
  • All payment/settlement features

Status: ✅ COMPLETED - Migrated from JSON to SQLite
Impact: Unblocks all economic features

Completion Date: Pre-March 2026
Test Coverage: Ledger tests passing

This was a foundational Phase 0 milestone enabling all subsequent economic functionality.

## Phase Dependency Mapping **Linked to Phase Tracker:** #27 (Phase 0: Foundation MVP) ✅ COMPLETED **Prerequisites:** N/A (core infrastructure) **Blocks:** - #8 (Integration test) - needs ledger for settlement - #10 (Intent classification) - stores routing preferences - #14 (Daily rumination) - economic analysis needs ledger - All payment/settlement features **Status:** ✅ COMPLETED - Migrated from JSON to SQLite **Impact:** Unblocks all economic features **Completion Date:** Pre-March 2026 **Test Coverage:** Ledger tests passing This was a foundational Phase 0 milestone enabling all subsequent economic functionality.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/mesh-seed#11
No description provided.