docs(daemon): add README documenting API surface + AX debt
Some checks are pending
Security Scan / security (push) Waiting to run
Test / Test (push) Waiting to run

102 endpoints across 3 categories (chain RPC, wallet proxy, REST).
Documents the banned import debt (encoding/json, net/http) and
the migration plan to core/api.

server.go is 2339 lines with 84 handlers — split plan documented
but deferred to avoid conflicts with parallel agent work.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 04:11:01 +01:00
parent 22d54828a8
commit 08c3370821
No known key found for this signature in database
GPG key ID: AF404715446AEB41
2 changed files with 40 additions and 1 deletions

View file

@ -8,7 +8,6 @@ package chain
import (
"bytes"
"encoding/hex"
"strings"
"dappco.re/go/core"
coreerr "dappco.re/go/core/log"

40
daemon/README.md Normal file
View file

@ -0,0 +1,40 @@
# daemon — Lethean Go Chain Daemon
JSON-RPC + REST API server backed by the Go chain.
## File Structure
| File | Purpose | Methods |
|------|---------|---------|
| server.go | Core RPC router + all handlers (LEGACY — needs splitting) | 84 |
| wallet_rpc.go | Wallet RPC proxy to C++ wallet | 16 |
| server_test.go | Unit tests for RPC handlers | 22 |
| server_integration_test.go | Go-vs-C++ comparison tests | 6 |
| coverage_test.go | Tests ALL 48 RPC methods in one pass | 1 |
## API Surface
- 69 chain JSON-RPC methods (native Go + CGo crypto)
- 16 wallet proxy methods (C++ wallet backend)
- 17 HTTP/REST endpoints (web-friendly JSON)
- Total: 102 endpoints
## AX Debt
server.go uses banned imports (encoding/json, net/http).
Migration to core/api is tracked. When core/api integration happens:
- JSON encoding → core.JSONMarshalString
- HTTP routing → core/api router
- SSE → core/api SSEBroker
- Metrics → core/api middleware
## Categories (for future file split)
1. Chain queries (getinfo, getheight, getblockheaderbyheight, etc.)
2. Alias operations (get_all_alias_details, get_alias_by_address, etc.)
3. Crypto utilities (validate_signature, generate_keys, fast_hash, etc.)
4. Explorer/analytics (get_chain_stats, get_difficulty_history, etc.)
5. Service discovery (get_gateways, get_vpn_gateways, get_network_topology)
6. REST endpoints (/api/info, /api/block, /api/aliases, /health, /metrics)
7. SSE (/events/blocks)
8. Admin (pool, relay, reset stubs)