Skip to main content
Glama

SatRank

Lightning決済の経路信頼性。エージェント経済のために構築。

SatRankはLightningエンドポイントの信頼性をスコアリングします。決済のたびに、エージェントはSatRankにGO/NO-GOの判断を問い合わせます。1リクエスト、1回答、1サトシです。

はじめに

npm install
npm run dev     # Start development server on :3000

アーキテクチャ

routes → controllers → services → repositories → SQLite

レイヤー:

  • Routes — Expressエンドポイント定義

  • Controllers — 入力バリデーション (zod)、レスポンスフォーマット

  • Services — ビジネスロジックとオーケストレーション

  • Repositories — SQLiteデータアクセス (better-sqlite3)

テスト容易性のために src/app.ts で手動の依存関係注入を行っています。

スコアリングアルゴリズム

5つの加重因子から算出される0〜100の複合スコア:

因子

重み

説明

ボリューム

25%

検証済みトランザクション、対数正規化

レピュテーション

30%

グラフ中心性 + ピア信頼性 (BTC/チャネル)。LN+評価はボーナス (+最大8)

シニアリティ

15%

初回観測からの経過日数、収穫逓減

レギュラーリティ

15%

トランザクション間隔の変動係数の逆数

ダイバーシティ

15%

ユニークな取引相手、対数正規化

不正防止:

  • 相互証明ループ検出 (A↔B) 95%ペナルティ

  • 循環クラスター検出 (A→B→C→A) 90%ペナルティ

  • BFSによる拡張サイクル検出 (A→B→C→D→A、最大4ホップ) 90%ペナルティ

  • 証明には最低7日間のシニアリティが必要

  • 証明者スコアの加重 (PageRankのような再帰)

  • 証明ソースの集中ペナルティ

API

Decision API (エージェント用プライマリインターフェース)

# 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 profile

Batch 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, alerts

Score History

curl http://localhost:3000/api/agent/<hash>/history?limit=10

Received Attestations

curl http://localhost:3000/api/agent/<hash>/attestations?limit=20

Leaderboard

curl http://localhost:3000/api/agents/top?limit=20&sort_by=score

Top Movers

curl http://localhost:3000/api/agents/movers

Search by Alias

curl http://localhost:3000/api/agents/search?alias=atlas

Submit Attestation (無料 — 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/stats

MCP Server

SatRankは、stdio経由でエージェントがネイティブにアクセスするためのMCP (Model Context Protocol) サーバーを公開しています。信頼判断、スコアリング、検索、レポートをカバーする11個のツールを提供します。

Claude Codeへのインストール

claude mcp add satrank -- npx tsx src/mcp/server.ts

または環境変数を使用する場合:

claude mcp add satrank -e DB_PATH=./data/satrank.db -e SATRANK_API_KEY=<key> -- npx tsx src/mcp/server.ts

Cursor / VS Codeへのインストール

.cursor/mcp.json または .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"
      }
    }
  }
}

利用可能なツール (11)

ツール

説明

decide

成功確率を伴うGO/NO-GO判断 — トランザクション前の主要ツール

report

結果の報告 (成功/失敗/タイムアウト) — APIキーが必要

get_profile

レポート、稼働時間、ランク、証拠を含む完全なエージェントプロファイル

get_agent_score

コンポーネントと証拠を含む詳細な信頼スコア

get_verdict

リスクプロファイルと経路探索を伴うSAFE/RISKY/UNKNOWN判定

get_batch_verdicts

最大100エージェントのバッチ判定

get_top_agents

スコア順のリーダーボード

search_agents

エイリアスによる検索 (部分一致)

get_network_stats

グローバルネットワーク統計

get_top_movers

7日間のスコア変動が最大のエージェント

submit_attestation

信頼証明の提出 — APIキーが必要

手動実行

npm run mcp        # Development
npm run mcp:prod   # Production

SDK

npm install @satrank/sdk
import { 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統合

SatRankは、Lightningノードの信頼スコアを NIP-85 Trusted Assertions (kind 30382) として公開しています。

公開内容: 複合スコア (0-100)、判定 (SAFE/RISKY/UNKNOWN)、到達可能性、生存予測、およびスコア30以上の約3,900ノードに対する5つのスコアリングコンポーネント。

頻度: 6時間ごと。

イベントフォーマット:

{
  "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": ""
}

任意のNostrクライアントから証明をクエリ:

["REQ", "satrank", {"kinds": [30382], "authors": ["<SATRANK_NOSTR_PUBKEY>"]}]

なぜ無料なのか? グローバルスコアは予告編に過ぎません。パーソナライズされた /api/decide (あなたの位置からの経路探索、生存率、P_empirical) が本編であり、L402経由で1サトシです。

技術スタック

  • TypeScript strictモード

  • Express — REST API

  • better-sqlite3 — 組み込みデータベース、WALモード

  • zod — 入力バリデーション

  • pino — 構造化ログ

  • helmet — セキュリティヘッダー

  • express-rate-limit — 悪用防止

スクリプト

スクリプト

説明

npm run dev

ホットリロード付き開発 (tsx watch)

npm run build

TypeScriptコンパイル

npm start

本番環境

npm test

テスト (vitest)

npm run lint

TypeScriptチェック

npm run crawl

Observer Protocolクローラー

npm run crawl:cron

クローラー (cronモード)

npm run mcp

MCPサーバー (開発)

npm run mcp:prod

MCPサーバー (本番)

npm run purge

古いデータの削除

npm run backup

データベースバックアップ

npm run rollback

データベースロールバック

npm run calibrate

スコアリングキャリブレーションレポート

npm run demo

証明デモスクリプト

npm run sdk:build

TypeScript SDKのビルド

ロードマップ

  • [x] Decision API — 成功確率を伴うGO/NO-GO、結果レポート、エージェントプロファイル

  • [x] パーソナライズされた経路探索 — LND QueryRoutes経由の呼び出し元からターゲットへのリアルタイム経路

  • [x] Aperture統合 (L402リバースプロキシ) — サトシによるクエリの収益化

  • [x] Observer Protocolクローラー — オンチェーンデータの自動取り込み

  • [x] Lightningグラフクローラー — LNDノード経由のチャネルトポロジーと容量

  • [x] ルートプローブクローラー — インデックス済みノードの到達可能性テスト

  • [x] エージェント用TypeScript SDK (@satrank/sdk)

  • [x] Verdict API — SAFE/RISKY/UNKNOWNのバイナリ判定

  • [x] MCPサーバー — stdio経由のエージェントネイティブアクセス

  • [x] 自動インデックス — 未知の公開鍵をオンデマンドでインデックス

  • [ ] 4tressコネクタ — 検証済み証明

  • [ ] 信頼ネットワーク可視化ダッシュボード

ビジョン

SatRankは、すべてのLightning決済の前に行う信頼性チェックです。ネットワークの66%はファントムノードです。私たちは、どのエンドポイントが生きているかを教えます。

-
security - not tested
F
license - not found
-
quality - not tested

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