SatRank
SatRank
Route reliability for Lightning payments. Built for the agentic economy.
SatRank scores the reliability of Lightning endpoints. Before each payment, an agent queries SatRank for a GO/NO-GO decision — one request, one answer, 1 sat.
Getting Started
npm install
npm run dev # Start development server on :3000Architecture
routes → controllers → services → repositories → SQLiteLayers:
Routes — Express endpoint definitions
Controllers — Input validation (zod), response formatting
Services — Business logic and orchestration
Repositories — SQLite data access (better-sqlite3)
Manual dependency injection in src/app.ts for testability.
Scoring Algorithm
Composite score 0-100 computed from 5 weighted factors:
Factor | Weight | Description |
Volume | 25% | Verified transactions, log-normalized |
Reputation | 30% | Graph centrality + peer trust (BTC/channel). LN+ ratings as bonus (+8 max) |
Seniority | 15% | Days since first seen, diminishing returns |
Regularity | 15% | Inverse coefficient of variation of transaction intervals |
Diversity | 15% | Unique counterparties, log-normalized |
Anti-gaming:
Mutual attestation loop detection (A↔B) with 95% penalty
Circular cluster detection (A→B→C→A) with 90% penalty
Extended cycle detection via BFS (A→B→C→D→A, up to 4 hops) with 90% penalty
Minimum 7-day seniority required to attest
Attester score weighting (PageRank-like recursion)
Attestation source concentration penalty
API
Decision API (primary interface for agents)
# GO / NO-GO decision with success probability
curl -X POST http://localhost:3000/api/decide \
-H "Content-Type: application/json" \
-d '{"target": "<hash>", "caller": "<your-hash>"}'
# Report transaction outcome (free — no L402)
curl -X POST http://localhost:3000/api/report \
-H "Content-Type: application/json" \
-H "X-API-Key: <key>" \
-d '{"target": "<hash>", "reporter": "<your-hash>", "outcome": "success"}'
# Agent profile with reports, uptime, rank
curl http://localhost:3000/api/profile/<hash>Score & Verdict API
curl http://localhost:3000/api/agent/<hash>/verdict
# Returns: SAFE / RISKY / UNKNOWN with confidence, flags, risk profileBatch Verdicts
curl -X POST http://localhost:3000/api/verdicts \
-H "Content-Type: application/json" \
-d '{"hashes": ["abc123...", "def456..."]}'Agent Score
curl http://localhost:3000/api/agent/<hash>
# Returns: score, components, evidence, delta, alertsScore History
curl http://localhost:3000/api/agent/<hash>/history?limit=10Received Attestations
curl http://localhost:3000/api/agent/<hash>/attestations?limit=20Leaderboard
curl http://localhost:3000/api/agents/top?limit=20&sort_by=scoreTop Movers
curl http://localhost:3000/api/agents/moversSearch by Alias
curl http://localhost:3000/api/agents/search?alias=atlasSubmit Attestation (free — no L402)
curl -X POST http://localhost:3000/api/attestations \
-H "Content-Type: application/json" \
-H "X-API-Key: <your-key>" \
-d '{"txId": "...", "attesterHash": "...", "subjectHash": "...", "score": 85, "category": "successful_transaction"}'Health & Stats
curl http://localhost:3000/api/health
curl http://localhost:3000/api/statsMCP Server
SatRank exposes an MCP (Model Context Protocol) server for agent-native access via stdio. 11 tools covering trust decisions, scoring, search, and reporting.
Install in Claude Code
claude mcp add satrank -- npx tsx src/mcp/server.tsOr with environment variables:
claude mcp add satrank -e DB_PATH=./data/satrank.db -e SATRANK_API_KEY=<key> -- npx tsx src/mcp/server.tsInstall in Cursor / VS Code
Add to .cursor/mcp.json or .vscode/mcp.json:
{
"mcpServers": {
"satrank": {
"command": "npx",
"args": ["tsx", "src/mcp/server.ts"],
"cwd": "/path/to/satrank",
"env": {
"DB_PATH": "./data/satrank.db",
"SATRANK_API_KEY": "your-api-key"
}
}
}
}Available tools (11)
Tool | Description |
| GO/NO-GO with success probability — the primary pre-transaction tool |
| Report outcome (success/failure/timeout) — requires API key |
| Full agent profile with reports, uptime, rank, evidence |
| Detailed trust score with components and evidence |
| SAFE/RISKY/UNKNOWN with risk profile and pathfinding |
| Batch verdict for up to 100 agents |
| Leaderboard ranked by score |
| Search by alias (partial match) |
| Global network statistics |
| Agents with biggest 7-day score changes |
| Submit a trust attestation — requires API key |
Run manually
npm run mcp # Development
npm run mcp:prod # ProductionSDK
npm install @satrank/sdkimport { SatRankClient } from '@satrank/sdk';
const client = new SatRankClient('http://localhost:3000');
// Full cycle in one line: decide → pay → report
const result = await client.transact('<target-hash>', '<your-hash>', async () => {
const payment = await myWallet.pay(invoice);
return { success: payment.ok, preimage: payment.preimage, paymentHash: payment.hash };
});
// result.paid, result.decision.go, result.report.weight
// Or step by step
const decision = await client.decide({ target: '<hash>', caller: '<your-hash>' });
const profile = await client.getProfile('<hash>');
const verdict = await client.getVerdict('<hash>');Nostr Integration
SatRank publishes trust scores for Lightning nodes as NIP-85 Trusted Assertions (kind 30382).
What's published: composite score (0-100), verdict (SAFE/RISKY/UNKNOWN), reachability, survival prediction, and 5 scoring components for ~3,900 nodes with score >= 30.
Frequency: every 6 hours.
Event format:
{
"kind": 30382,
"tags": [
["d", "<lightning_pubkey>"],
["n", "lightning"],
["alias", "Kraken"],
["score", "94"],
["verdict", "SAFE"],
["reachable", "true"],
["survival", "stable"],
["volume", "100"],
["reputation", "79"],
["seniority", "87"],
["regularity", "100"],
["diversity", "100"]
],
"content": ""
}Query assertions from any Nostr client:
["REQ", "satrank", {"kinds": [30382], "authors": ["<SATRANK_NOSTR_PUBKEY>"]}]Why free? Global scores are the trailer. The personalized /api/decide (pathfinding from YOUR position, survival, P_empirical) is the film — 1 sat via L402.
Tech Stack
TypeScript strict mode
Express — REST API
better-sqlite3 — Embedded database, WAL mode
zod — Input validation
pino — Structured logging
helmet — Security headers
express-rate-limit — Abuse protection
Scripts
Script | Description |
| Development with hot reload (tsx watch) |
| TypeScript compilation |
| Production |
| Tests (vitest) |
| TypeScript check |
| Observer Protocol crawler |
| Crawler en mode cron |
| MCP server (dev) |
| MCP server (production) |
| Purge stale data |
| Database backup |
| Database rollback |
| Scoring calibration report |
| Attestation demo script |
| Build TypeScript SDK |
Roadmap
Decision API — GO/NO-GO with success probability, outcome reports, agent profiles
Personalized pathfinding — real-time route from caller to target via LND QueryRoutes
Aperture integration (L402 reverse proxy) — monetize queries in sats
Observer Protocol crawler — automatic on-chain data ingestion
Lightning graph crawler — channel topology and capacity via LND node
Route probe crawler — reachability testing for indexed nodes
TypeScript SDK for agents (
@satrank/sdk)Verdict API — SAFE/RISKY/UNKNOWN binary decision
MCP server — agent-native access via stdio
Auto-indexation — unknown pubkeys indexed on demand
4tress connector — verified attestations
Trust network visualization dashboard
Vision
SatRank is the reliability check before every Lightning payment. 66% of the network is phantom nodes — we tell you which endpoints are alive.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/proofoftrust21/satrank'
If you have feedback or need assistance with the MCP directory API, please join our Discord server