M1-F: end-to-end LLM marketplace lifecycle on Vector testnet

Bonded-escrow marketplace for prompt → response between buyers and
local-LLM suppliers, settling on Vector (UTxO) via Aiken Plutus V3
validators. Lifecycle PostEscrow → Claim → Submit → Accept proven on
Vector testnet 2026-05-06; AcceptEscrow tx 125e3cfe…7dc100d distributes
payment + bonds per the validator's distribution rule.

Workspace layout (pnpm + TypeScript):
  contracts/marketplace/      Aiken validators (advert + escrow) + plutus.json
  packages/shared/            Tx-builders (lucid-evolution), CBOR codecs,
                              chain providers (mock / read-only / live Ogmios)
  supplier/                   OpenAI-compatible HTTP node (Ollama by default;
                              vLLM / llama.cpp / OpenRouter / OpenClaw all
                              swap-in via OLLAMA_URL); 202+poll chat handler
  buyer/                      Express + React SPA; server-side runs the full
                              chain lifecycle via /v1/submit-prompt and
                              /v1/accept; SPA never holds the buyer key
  indexer/                    Chain-follower (extends apex-dashboard pattern),
                              SSE event stream + REST queries
  indexer-ui/                 Operator dashboard (events + suppliers + escrow
                              lookup)
  tests/                      1098 vitest unit + integration tests (10 skipped
                              under M1-F-D-defer for UPLC test plumbing)
  deploy/testnet/             Per-service docker-compose for the Hetzner stack
  docs/EXECUTIVE_SUMMARY.*    Marp deck (PDF + PPTX) — 11 slides, mermaid
                              diagrams pre-rendered for portable export
  docs/CLOUDFLARE_WAF_BYPASS.md  CF Skip-rule runbook for /v1/* paths
  docs/ARCHITECTURE.md        canonical spec

Live demo (testnet, 2026-05-06):
  https://mp-buyers.vector.testnet.apexfusion.org      (buyer SPA)
  https://mp-suppliers.vector.testnet.apexfusion.org   (supplier API)
  https://mp-indexer.vector.testnet.apexfusion.org     (indexer + UI)
This commit is contained in:
jelisaveta-talbot
2026-05-06 13:27:48 +02:00
commit cbab81efbd
323 changed files with 49725 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
# deploy/testnet/docker-compose.buyer.yml — Buyer (Express + Vite UI) — TESTNET
#
# Independent compose project. Joins three external networks:
#
# marketplace-net reaches the indexer at http://marketplace-indexer:8090
# apex-dashboard_apex-net reaches ws://ogmios:1337 in the apex-dashboard
# testnet stack (required when LIVE_CHAIN=1 so the
# /v1/accept endpoint can submit Accept txs)
# dashboard_default Traefik public entrypoint (mp-buyer.*)
#
# All three networks must exist before bringing this up.
#
# Bring up:
# docker compose -f deploy/testnet/docker-compose.buyer.yml up -d --build
name: marketplace-buyer
services:
buyer:
build:
context: ../..
dockerfile: buyer/Dockerfile
container_name: marketplace-buyer
restart: unless-stopped
env_file:
- path: ../../buyer/.env
required: false
environment:
# Compose-level override — buyer talks to indexer via service name.
INDEXER_URL: http://marketplace-indexer:8090
BUYER_PORT: "8070"
# LiveOgmiosProvider uses HTTP JSON-RPC against the apex-dashboard
# testnet stack's Ogmios. /v1/accept depends on this; without it the
# endpoint returns 503 service_unavailable.
OGMIOS_URL: http://ogmios:1337
LIVE_CHAIN: "1"
NETWORK_ID: "0"
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8070/healthz >/dev/null || exit 1"]
interval: 20s
timeout: 5s
retries: 3
start_period: 15s
networks:
- marketplace-net
- apex-net
- traefik-net
labels:
- "traefik.enable=true"
- "traefik.docker.network=dashboard_default"
- "traefik.http.routers.mp-buyers.entrypoints=web"
- "traefik.http.routers.mp-buyers.rule=Host(`mp-buyers.vector.testnet.apexfusion.org`)"
- "traefik.http.services.mp-buyers.loadbalancer.server.port=8070"
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
networks:
marketplace-net:
external: true
name: marketplace-net
apex-net:
external: true
name: apex-dashboard_apex-net
traefik-net:
external: true
name: dashboard_default