lightning

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/lightning

/lightning

World-class Lightning lifecycle. Audit, plan, execute, verify—every time.
业界一流的Lightning生命周期管理。审计、规划、执行、验证——每次运行都覆盖全流程。

What This Does

功能说明

Examines your Lightning setup, finds all gaps, fixes them, and verifies payments end-to-end. No partial modes. Every run does the full cycle.
检查你的Lightning部署配置,找出所有问题并修复,同时端到端验证支付流程。无部分模式,每次运行都会完成全生命周期流程。

Branching

分支管理

Assumes you start on
master
/
main
. Before making code changes:
bash
git checkout -b fix/lightning-$(date +%Y%m%d)
Config-only changes (node config, env vars, services) don't require a branch. Code changes do.
假设你从
master
/
main
分支开始。在进行代码变更前:
bash
git checkout -b fix/lightning-$(date +%Y%m%d)
仅配置变更(节点配置、环境变量、服务)无需创建分支,代码变更则需要。

Process

操作流程

0. Environment Check

0. 环境检查

Confirm network and connectivity first. Before any Lightning ops:
bash
lncli --network=testnet getinfo | jq '.chains, .synced_to_chain'
lncli getinfo | jq '.uris, .identity_pubkey'
Check:
  • Testnet vs mainnet is intentional
  • Node is synced to chain
  • Peers reachable (no stale URIs)
**首先确认网络与连通性。**在执行任何Lightning操作前:
bash
lncli --network=testnet getinfo | jq '.chains, .synced_to_chain'
lncli getinfo | jq '.uris, .identity_pubkey'
检查项:
  • 确认使用Testnet还是Mainnet符合预期
  • 节点已同步至区块链
  • 对等节点可访问(无失效URI)

1. Audit

1. 审计

Spawn the auditor. Use the
lightning-auditor
subagent for deep analysis. It examines:
  • Channel health (active, disabled, policy asymmetry)
  • Liquidity (local/remote balance skew, inbound capacity)
  • Routing performance (failures, fee policy, CLTV)
  • Invoice hygiene (expiry, amountless, memo policy)
  • Security (macaroon use, no secrets logged)
  • Ops (backup status, watchtower, autopilot settings)
Run automated checks:
bash
lightning-auditor --full
**启动审计工具。**使用
lightning-auditor
子代理进行深度分析,检查内容包括:
  • 通道健康状态(活跃、禁用、策略不对称)
  • 流动性(本地/远程余额倾斜、入站容量)
  • 路由性能(失败情况、手续费策略、CLTV)
  • 发票规范(过期时间、无金额发票、备注策略)
  • 安全性(macaroon使用、无敏感信息日志)
  • 运维状态(备份状态、瞭望塔、自动领航设置)
运行自动化检查:
bash
lightning-auditor --full

2. Plan

2. 规划

From audit findings, build a remediation plan. Don't just list issues—plan the fixes.
For each finding:
  • Config issues → Fix directly (lnd.conf, systemd, env vars)
  • Channel issues → Plan closure/reopen or rebalancing
  • Code issues → Delegate to Codex with clear specs
Prioritize:
  1. P0 — Funds at risk, node offline, broken payments
  2. P1 — Liquidity dead ends, routing failures
  3. P2 — Suboptimal fees, imbalance, missing UX
  4. P3 — Nice-to-haves, metrics polish
基于审计结果制定修复计划,不仅要列出问题,还要规划具体修复方案。
针对每个问题:
  • 配置问题 → 直接修复(lnd.conf、systemd、环境变量)
  • 通道问题 → 规划关闭/重新开通通道或执行重新平衡
  • 代码问题 → 委托给Codex并提供明确规格
优先级排序:
  1. P0 — 资金风险、节点离线、支付失败
  2. P1 — 流动性死角、路由失败
  3. P2 — 手续费不合理、余额倾斜、缺失UX
  4. P3 — 优化项、指标完善

3. Execute

3. 执行

Fix everything. Don't stop at a report.
Config fixes (do directly):
bash
undefined
修复所有问题,不要仅停留在报告阶段。
配置修复(直接操作):
bash
undefined

Example: update env vars or config

示例:更新环境变量或配置

rg -n "LND_|lnd.conf" .

**Channel management:**
- Close dead channels, reopen with better peers
- Adjust fees and CLTV to match route goals
- Rebalance to restore inbound/outbound capacity

**Rebalancing:**
```bash
lncli --network=testnet listchannels | jq '.channels[] | {chan_id, local_balance, remote_balance}'
rg -n "LND_|lnd.conf" .

**通道管理:**
- 关闭失效通道,与优质对等节点重新开通通道
- 调整手续费和CLTV以匹配路由目标
- 执行重新平衡以恢复入站/出站容量

**重新平衡操作:**
```bash
lncli --network=testnet listchannels | jq '.channels[] | {chan_id, local_balance, remote_balance}'

4. Verify

4. 验证

Prove it works. Not "looks right"—actually works.
Connectivity + sync:
bash
lncli --network=testnet getinfo | jq '.synced_to_chain'
Invoice create + pay (use a second node):
bash
lncli --network=testnet addinvoice --amt 1000 --memo "smoke"
lncli --network=testnet payinvoice <bolt11>
Channel balance verification:
bash
lncli --network=testnet listchannels | jq '.channels[] | {chan_id, local_balance, remote_balance}'
If any verification fails, go back and fix it. Don't declare done until all checks pass.
证明功能正常运行,不是“看起来正常”,而是实际可用。
连通性与同步状态:
bash
lncli --network=testnet getinfo | jq '.synced_to_chain'
发票创建与支付(使用第二个节点):
bash
lncli --network=testnet addinvoice --amt 1000 --memo "smoke"
lncli --network=testnet payinvoice <bolt11>
通道余额验证:
bash
lncli --network=testnet listchannels | jq '.channels[] | {chan_id, local_balance, remote_balance}'
如果任何验证步骤失败,返回上一步修复问题,直到所有检查通过后再宣告完成。

Channel Management

通道管理指南

Guidance:
  • Prefer few high-quality peers over many weak ones
  • Avoid long-lived channels with dead liquidity
  • Keep inbound capacity for receiving use cases
  • Keep outbound capacity for paying and routing
  • Use fee policy to shape traffic, not to chase micro-yield
  • 优先选择少量优质对等节点,而非大量低效节点
  • 避免长期存在的流动性枯竭通道
  • 为接收场景保留足够入站容量
  • 为支付和路由场景保留足够出站容量
  • 使用手续费策略引导流量,而非追逐微额收益

Liquidity Planning

流动性规划

Plan capacity by purpose:
  • Send-first: higher local balance
  • Receive-first: higher remote balance
  • Routing: balanced channels, diverse peers
Targets:
  • Maintain 20-40% inbound on critical channels
  • Avoid >80% one-sided imbalance
  • Rebalance before outbound drops below 10%
按用途规划容量:
  • 优先发送:更高本地余额
  • 优先接收:更高远程余额
  • 路由节点:余额平衡的通道、多样化对等节点
目标指标:
  • 关键通道保持20-40%的入站容量
  • 避免超过80%的单向倾斜
  • 当出站容量低于10%时执行重新平衡

Default Stack

默认技术栈

Assumes LND + Bitcoin Core + systemd + Docker (optional). Adapts to other stacks—concepts are the same, only tooling differs.
默认采用LND + Bitcoin Core + systemd + Docker(可选)。可适配其他技术栈——核心概念一致,仅工具不同。

What You Get

最终成果

When complete:
  • Healthy channels with stable peers
  • Planned liquidity with clear inbound/outbound targets
  • Verified invoice creation and payment flow
  • Rebalancing executed where needed
  • Routing policy aligned with goals
  • Configuration sane and documented
完成后你将获得:
  • 与稳定对等节点建立的健康通道
  • 明确入站/出站目标的规划化流动性
  • 已验证的发票创建与支付流程
  • 按需执行的重新平衡操作
  • 与目标一致的路由策略
  • 合理且已归档的配置