lnd

TotalClaw 作者 totalclaw

安装并运行 Lightning Terminal (litd),它将 lnd、loop、pool、tapd 和 Faraday 捆绑在单个 Docker 容器中。默认为中微子后端,测试网上有 SQLite 存储。支持带有远程签名者的仅观看模式、独立模式和注册测试开发。在设置用于支付、渠道管理、流动性管理(循环)、渠道市场(池)、主根资产(tapd)或启用代理 L402 商务的闪电节点时使用。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~roasbeef-lnd
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~roasbeef-lnd/file -o roasbeef-lnd.md
## 概述(中文)

安装并运行 Lightning Terminal (litd),它将 lnd、loop、pool、tapd 和 Faraday 捆绑在单个 Docker 容器中。默认为中微子后端,测试网上有 SQLite 存储。支持带有远程签名者的仅观看模式、独立模式和注册测试开发。在设置用于支付、渠道管理、流动性管理(循环)、渠道市场(池)、主根资产(tapd)或启用代理 L402 商务的闪电节点时使用。

## 原文

# Lightning Terminal (litd) — Lightning Network Node

Install and operate a Lightning Terminal (litd) node for agent-driven payments.
litd bundles lnd with loop, pool, tapd, and faraday — giving agents access to
liquidity management, channel marketplace, and taproot assets in a single
container.

**Default:** Docker container, neutrino backend, SQLite storage, testnet. No full
Bitcoin node required. Use `--network mainnet` for real coins.

**Default mode: watch-only with remote signer.** Private keys stay on a separate
signer container — the agent never touches key material. For quick testing, use
`--mode standalone` (keys on disk, less secure).

## Quick Start (Container — Recommended)

### Watch-Only with Remote Signer (Production)

```bash
# 1. Install litd image
skills/lnd/scripts/install.sh

# 2. Start litd + signer containers
skills/lnd/scripts/start-lnd.sh --watchonly

# 3. Set up signer wallet (first run only)
skills/lightning-security-module/scripts/setup-signer.sh --container litd-signer

# 4. Import credentials and create watch-only wallet
skills/lnd/scripts/import-credentials.sh --bundle ~/.lnget/signer/credentials-bundle
skills/lnd/scripts/create-wallet.sh

# 5. Check status
skills/lnd/scripts/lncli.sh getinfo
```

### Standalone (Testing Only)

```bash
# 1. Install litd image
skills/lnd/scripts/install.sh

# 2. Start litd container
skills/lnd/scripts/start-lnd.sh

# 3. Create standalone wallet (generates seed — keys on disk)
skills/lnd/scripts/create-wallet.sh --mode standalone

# 4. Check status
skills/lnd/scripts/lncli.sh getinfo
```

> **Warning:** Standalone mode stores the seed mnemonic and wallet passphrase on
> disk. Do not use for mainnet funds you cannot afford to lose.

### Regtest Development

```bash
# Start litd + bitcoind for local development
skills/lnd/scripts/start-lnd.sh --regtest

# Create wallet and mine some blocks
skills/lnd/scripts/create-wallet.sh --container litd --mode standalone
docker exec litd-bitcoind bitcoin-cli -regtest -generate 101
```

## Container Modes

| Mode | Command | Containers | Use Case |
|------|---------|-----------|----------|
| Standalone | `start-lnd.sh` | litd | Testing, development |
| Watch-only | `start-lnd.sh --watchonly` | litd + litd-signer | Production |
| Regtest | `start-lnd.sh --regtest` | litd + litd-bitcoind | Local dev |

## Profiles

Profiles customize litd behavior without editing compose files:

```bash
# List available profiles
skills/lnd/scripts/docker-start.sh --list-profiles

# Start with a profile
skills/lnd/scripts/start-lnd.sh --profile taproot
skills/lnd/scripts/start-lnd.sh --profile debug
```

| Profile | Purpose |
|---------|---------|
| `default` | Standard operation (info logging) |
| `debug` | Trace logging, verbose subsystems |
| `taproot` | Simple taproot channels enabled |
| `wumbo` | Large channels up to 10 BTC |
| `regtest` | Regtest network preset |

## Network Selection

Default is testnet. Override with `--network`:

```bash
# Testnet (default — no real coins)
skills/lnd/scripts/start-lnd.sh

# Mainnet (real coins — use with remote signer)
skills/lnd/scripts/start-lnd.sh --network mainnet --watchonly

# Signet (testing network)
skills/lnd/scripts/start-lnd.sh --network signet
```

## litd Sub-Daemons

litd integrates multiple daemons. Access them via the `--cli` flag:

```bash
# lnd CLI (default)
skills/lnd/scripts/lncli.sh getinfo

# Loop — liquidity management (submarine swaps)
skills/lnd/scripts/lncli.sh --cli loop quote out 100000

# Pool — channel marketplace
skills/lnd/scripts/lncli.sh --cli pool accounts list

# Taproot Assets (tapd)
skills/lnd/scripts/lncli.sh --cli tapcli assets list

# Lightning Terminal (litd)
skills/lnd/scripts/lncli.sh --cli litcli getinfo

# Faraday — channel analytics
skills/lnd/scripts/lncli.sh --cli frcli revenue
```

## Installation

Default: pulls the litd Docker image.

```bash
skills/lnd/scripts/install.sh
```

This pulls `lightninglabs/lightning-terminal:v0.16.0-alpha` from Docker Hub and
verifies the image. The litd image includes lncli, litcli, loop, pool, tapcli,
and frcli.

### Build from Source (Fallback)

```bash
skills/lnd/scripts/install.sh --source
```

Requires Go toolchain. Builds lnd and lncli with all build tags.

## Native Mode

For running without Docker, use `--native`:

```bash
# Start natively
skills/lnd/scripts/start-lnd.sh --native --mode standalone

# Stop natively
skills/lnd/scripts/stop-lnd.sh --native
```

Native mode uses the config template at `skills/lnd/templates/lnd.conf.template`
and runs lnd as a background process.

## Remote Nodes

Connect to a remote lnd node with connection credentials:

```bash
skills/lnd/scripts/lncli.sh \
    --rpcserver remote-host:10009 \
    --tlscertpath ~/remote-tls.cert \
    --macaroonpath ~/remote-admin.macaroon \
    getinfo
```

## MCP / Lightning Node Connect

For read-only access without direct gRPC connectivity, use the
`lightning-mcp-server` skill with Lightning Node Connect (LNC). LNC uses
encrypted WebSocket tunnels — no TLS certs, macaroons, or open ports needed.
Just a pairing phrase from Lightning Terminal.

```bash
skills/lightning-mcp-server/scripts/install.sh
skills/lightning-mcp-server/scripts/configure.sh
skills/lightning-mcp-server/scripts/setup-claude-config.sh
```

## Wallet Setup

### Watch-Only Wallet (Default)

Imports account xpubs from the remote signer — no seed or private keys on this
machine.

```bash
# Import credentials bundle from signer
skills/lnd/scripts/import-credentials.sh --bundle <credentials-bundle>

# Create watch-only wallet (auto-detects litd container)
skills/lnd/scripts/create-wallet.sh
```

### Standalone Wallet

Generates a seed locally. Use only for testing.

```bash
skills/lnd/scripts/create-wallet.sh --mode standalone
```

Handles the full wallet creation flow via REST API:
1. Generates a secure random wallet passphrase
2. Calls `/v1/genseed` to generate a 24-word seed mnemonic
3. Calls `/v1/initwallet` with the passphrase and seed
4. Stores credentials securely:
   - `~/.lnget/lnd/wallet-password.txt` (mode 0600)
   - `~/.lnget/lnd/seed.txt` (mode 0600)

### Unlock Wallet

```bash
skills/lnd/scripts/unlock-wallet.sh
```

Auto-unlock is enabled by default in the container via
`--wallet-unlock-password-file`. Manual unlock is only needed if auto-unlock
is disabled.

### Recover Wallet from Seed (Standalone Only)

```bash
skills/lnd/scripts/create-wallet.sh --mode standalone --recover --seed-file ~/.lnget/lnd/seed.txt
```

## Starting and Stopping

### Start

```bash
# Docker standalone (default)
skills/lnd/scripts/start-lnd.sh

# Docker watch-only (production)
skills/lnd/scripts/start-lnd.sh --watchonly

# Docker with profile
skills/lnd/scripts/start-lnd.sh --profile taproot

# Mainnet
skills/lnd/scripts/start-lnd.sh --network mainnet
```

### Stop

```bash
# Stop (preserve data)
skills/lnd/scripts/stop-lnd.sh

# Stop and clean (remove volumes)
skills/lnd/scripts/stop-lnd.sh --clean

# Stop all litd containers
skills/lnd/scripts/stop-lnd.sh --all
```

## Node Operations

All commands auto-detect the litd container:

### Node Info

```bash
skills/lnd/scripts/lncli.sh getinfo
skills/lnd/scripts/lncli.sh walletbalance
skills/lnd/scripts/lncli.sh channelbalance
```

### Funding

```bash
skills/lnd/scripts/lncli.sh newaddress p2tr
skills/lnd/scripts/lncli.sh walletbalance
```

### Channel Management

```bash
skills/lnd/scripts/lncli.sh connect <pubkey>@<host>:9735
skills/lnd/scripts/lncli.sh openchannel --node_key=<pubkey> --local_amt=1000000
skills/lnd/scripts/lncli.sh listchannels
skills/lnd/scripts/lncli.sh closechannel --funding_txid=<txid> --output_index=<n>
```

### Payments

```bash
skills/lnd/scripts/lncli.sh addinvoice --amt=1000 --memo="test payment"
skills/lnd/scripts/lncli.sh decode