diff --git a/lamassu-next/.gitignore b/lamassu-next/.gitignore index 258400b..c2dcfb7 100644 --- a/lamassu-next/.gitignore +++ b/lamassu-next/.gitignore @@ -69,3 +69,4 @@ docker/**/data/ tmp/ temp/ *.tmp +*.timestamp-*.mjs diff --git a/lamassu-next/CLAUDE.md b/lamassu-next/CLAUDE.md index 663bc5e..045052b 100644 --- a/lamassu-next/CLAUDE.md +++ b/lamassu-next/CLAUDE.md @@ -27,7 +27,7 @@ lamassu-next/ │ ├── lightning/ # Lightning.Pub RPC client ✅ │ ├── cashu/ # Cashu ecash (placeholder) │ └── ui-shared/ # Shared Vue components (placeholder) -└── docker/ # Development infrastructure (planned) +└── docker/ # Development infrastructure ✅ ``` ## Implementation Status @@ -53,7 +53,6 @@ lamassu-next/ - **apps/machine** - Tauri 2.x ATM kiosk with Vue 3 UI - **apps/dashboard** - Operator dashboard for fleet management - **packages/hal** - Rust hardware drivers (bill validators, dispensers, printers) -- **docker/** - strfry relay + Lightning.Pub for development ## Commands @@ -70,13 +69,79 @@ pnpm build # Run tests pnpm test -# Start infrastructure (Nostr relay, Lightning.Pub) -infra-up +# Infrastructure management +infra-up # Start all Docker services +infra-down # Stop all Docker services +infra-status # Show service status +infra-logs # Follow service logs -# Stop infrastructure -infra-down +# Bitcoin/Lightning (regtest) +btccli # Bitcoin CLI +lncli # LND CLI +mine-blocks # Mine regtest blocks (default: 1) +relay-test # Test Nostr relay connection ``` +## Development Infrastructure + +The `docker/` directory contains a complete development environment: + +| Service | Container | Port(s) | Description | +| ------------- | --------------------- | ----------- | ------------------------------------- | +| strfry | lamassu-relay | 7777 | Private Nostr relay | +| bitcoind | lamassu-bitcoind | 18443 | Bitcoin Core (regtest) | +| LND | lamassu-lnd | 10009, 8080 | Lightning node (Lightning.Pub's node) | +| LND Alice | lamassu-lnd-alice | 10010, 8081 | Second LND for payment testing | +| Lightning.Pub | lamassu-lightning-pub | 1776 | Nostr-native account system | +| PostgreSQL | lamassu-postgres | 5432 | Database for server-side state | + +### Quick Start + +```bash +devenv shell # Enter dev environment +infra-up # Start all services (30-60s first run) +mine-blocks 101 # Fund the regtest wallet +setup-channel # Open channel between Alice and LND +``` + +### Testing Payments + +The development setup includes two LND nodes to enable proper payment testing: + +1. **LND** (`lamassu-lnd`) - Used by Lightning.Pub to create invoices +2. **Alice** (`lamassu-lnd-alice`) - Used to pay invoices (simulates external payers) + +```bash +# Get Lightning.Pub admin token +curl -X POST "http://localhost:1776/api/admin/app/auth" \ + -H "Authorization: Bearer lamassu-dev-admin-token" \ + -d '{"name": "wallet"}' + +# Create user and invoice +curl -X POST "http://localhost:1776/api/app/user/add" -H "Authorization: Bearer $APP_TOKEN" \ + -d '{"identifier": "test-user", "balance": 0}' + +curl -X POST "http://localhost:1776/api/app/user/add/invoice" -H "Authorization: Bearer $APP_TOKEN" \ + -d '{"receiver_identifier": "test-user", "payer_identifier": "external", "http_callback_url": "", "invoice_req": {"amountSats": 1000, "memo": "Test"}}' + +# Pay from Alice +alice-pay +``` + +### MCP Tools Available + +Claude has access to these MCP servers for development: + +| MCP Server | Purpose | +| ------------ | ----------------------------------------- | +| docker-mcp | Container management (logs, status, etc.) | +| nostr-mcp | Nostr operations (post notes, profiles) | +| postgres-mcp | Database queries and schema inspection | +| mcp-nixos | NixOS/Nix package queries | +| forgejo-mcp | Git operations on Forgejo | + +Use these to interact with infrastructure directly during development. + ## Key Technologies | Component | Technology | Notes |