@lightninglabs/lightning-mcp-server 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/.claude-plugin/marketplace.json +36 -0
  2. package/.claude-plugin/plugin.json +12 -0
  3. package/README.md +307 -0
  4. package/bin/lightning-mcp-server +15 -0
  5. package/docs/architecture.md +455 -0
  6. package/docs/commerce.md +357 -0
  7. package/docs/l402-and-lnget.md +267 -0
  8. package/docs/mcp-server.md +285 -0
  9. package/docs/quickref.md +263 -0
  10. package/docs/security.md +298 -0
  11. package/docs/two-agent-setup.md +394 -0
  12. package/package.json +52 -0
  13. package/postinstall.js +160 -0
  14. package/skills/aperture/SKILL.md +330 -0
  15. package/skills/aperture/scripts/install.sh +68 -0
  16. package/skills/aperture/scripts/setup.sh +155 -0
  17. package/skills/aperture/scripts/start.sh +81 -0
  18. package/skills/aperture/scripts/stop.sh +57 -0
  19. package/skills/aperture/templates/aperture-regtest.yaml +36 -0
  20. package/skills/aperture/templates/aperture.yaml.template +64 -0
  21. package/skills/aperture/templates/docker-compose-aperture.yml +59 -0
  22. package/skills/commerce/SKILL.md +211 -0
  23. package/skills/lib/config-gen.sh +127 -0
  24. package/skills/lib/rest.sh +69 -0
  25. package/skills/lightning-security-module/SKILL.md +253 -0
  26. package/skills/lightning-security-module/references/architecture.md +133 -0
  27. package/skills/lightning-security-module/scripts/docker-start.sh +117 -0
  28. package/skills/lightning-security-module/scripts/docker-stop.sh +53 -0
  29. package/skills/lightning-security-module/scripts/export-credentials.sh +268 -0
  30. package/skills/lightning-security-module/scripts/install.sh +178 -0
  31. package/skills/lightning-security-module/scripts/setup-signer.sh +307 -0
  32. package/skills/lightning-security-module/scripts/start-signer.sh +152 -0
  33. package/skills/lightning-security-module/scripts/stop-signer.sh +240 -0
  34. package/skills/lightning-security-module/templates/docker-compose-signer.yml +35 -0
  35. package/skills/lightning-security-module/templates/signer-lnd.conf.template +69 -0
  36. package/skills/lnd/SKILL.md +441 -0
  37. package/skills/lnd/profiles/debug.env +4 -0
  38. package/skills/lnd/profiles/default.env +3 -0
  39. package/skills/lnd/profiles/regtest.env +4 -0
  40. package/skills/lnd/profiles/taproot.env +3 -0
  41. package/skills/lnd/profiles/wumbo.env +3 -0
  42. package/skills/lnd/references/security.md +156 -0
  43. package/skills/lnd/scripts/create-wallet.sh +464 -0
  44. package/skills/lnd/scripts/docker-start.sh +256 -0
  45. package/skills/lnd/scripts/docker-stop.sh +109 -0
  46. package/skills/lnd/scripts/import-credentials.sh +145 -0
  47. package/skills/lnd/scripts/install.sh +195 -0
  48. package/skills/lnd/scripts/lncli.sh +150 -0
  49. package/skills/lnd/scripts/start-lnd.sh +241 -0
  50. package/skills/lnd/scripts/stop-lnd.sh +218 -0
  51. package/skills/lnd/scripts/unlock-wallet.sh +134 -0
  52. package/skills/lnd/templates/docker-compose-regtest.yml +122 -0
  53. package/skills/lnd/templates/docker-compose-watchonly.yml +71 -0
  54. package/skills/lnd/templates/docker-compose.yml +49 -0
  55. package/skills/lnd/templates/litd-regtest.conf.template +61 -0
  56. package/skills/lnd/templates/litd-watchonly.conf.template +57 -0
  57. package/skills/lnd/templates/litd.conf.template +88 -0
  58. package/skills/lnd/templates/lnd.conf.template +91 -0
  59. package/skills/lnget/SKILL.md +288 -0
  60. package/skills/lnget/scripts/install.sh +69 -0
  61. package/skills/macaroon-bakery/SKILL.md +179 -0
  62. package/skills/macaroon-bakery/scripts/bake.sh +337 -0
  63. package/skills/mcp-lnc/SKILL.md +280 -0
  64. package/skills/mcp-lnc/scripts/configure.sh +130 -0
  65. package/skills/mcp-lnc/scripts/install.sh +103 -0
  66. package/skills/mcp-lnc/scripts/setup-claude-config.sh +162 -0
  67. package/skills/mcp-lnc/templates/env.template +16 -0
  68. package/versions.env +23 -0
@@ -0,0 +1,256 @@
1
+ #!/usr/bin/env bash
2
+ # Start litd (Lightning Terminal) containers.
3
+ #
4
+ # Usage:
5
+ # docker-start.sh # Standalone litd, testnet (default)
6
+ # docker-start.sh --watchonly # Watch-only + signer (production)
7
+ # docker-start.sh --regtest # Regtest with bitcoind (dev)
8
+ # docker-start.sh --network mainnet # Override network
9
+ # docker-start.sh --profile taproot # Load profile
10
+ # docker-start.sh --foreground # Run in foreground (show logs)
11
+ # docker-start.sh --args "--lnd.foo=bar" # Extra litd arguments
12
+ #
13
+ # Profiles: default, taproot, wumbo, debug, regtest
14
+
15
+ set -e
16
+
17
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18
+ TEMPLATE_DIR="$SCRIPT_DIR/../templates"
19
+ PROFILE_DIR="$SCRIPT_DIR/../profiles"
20
+ VERSIONS_FILE="$SCRIPT_DIR/../../../versions.env"
21
+ LIB_DIR="$SCRIPT_DIR/../../lib"
22
+
23
+ MODE="standalone"
24
+ BUILD=false
25
+ DETACH=true
26
+ PROFILE=""
27
+ CUSTOM_ARGS=""
28
+ CUSTOM_NETWORK=""
29
+
30
+ # Source pinned versions so compose files pick them up as env vars.
31
+ if [ -f "$VERSIONS_FILE" ]; then
32
+ source "$VERSIONS_FILE"
33
+ export LITD_VERSION LITD_IMAGE LND_VERSION LND_IMAGE
34
+ export BITCOIN_CORE_VERSION BITCOIN_CORE_IMAGE
35
+ fi
36
+
37
+ # Source config generation functions.
38
+ source "$LIB_DIR/config-gen.sh"
39
+
40
+ # Parse arguments.
41
+ while [[ $# -gt 0 ]]; do
42
+ case $1 in
43
+ --watchonly)
44
+ MODE="watchonly"
45
+ shift
46
+ ;;
47
+ --regtest)
48
+ MODE="regtest"
49
+ shift
50
+ ;;
51
+ --build)
52
+ BUILD=true
53
+ shift
54
+ ;;
55
+ --foreground|-f)
56
+ DETACH=false
57
+ shift
58
+ ;;
59
+ --profile|-p)
60
+ PROFILE="$2"
61
+ shift 2
62
+ ;;
63
+ --network)
64
+ CUSTOM_NETWORK="$2"
65
+ shift 2
66
+ ;;
67
+ --args|-a)
68
+ CUSTOM_ARGS="$2"
69
+ shift 2
70
+ ;;
71
+ --list-profiles)
72
+ echo "Available profiles:"
73
+ echo ""
74
+ for f in "$PROFILE_DIR"/*.env; do
75
+ name=$(basename "$f" .env)
76
+ desc=$(head -1 "$f" | sed 's/^# //')
77
+ printf " %-15s %s\n" "$name" "$desc"
78
+ done
79
+ echo ""
80
+ echo "Usage: docker-start.sh --profile <name>"
81
+ exit 0
82
+ ;;
83
+ -h|--help)
84
+ echo "Usage: docker-start.sh [options]"
85
+ echo ""
86
+ echo "Start litd (Lightning Terminal) containers."
87
+ echo ""
88
+ echo "Modes:"
89
+ echo " (default) Standalone litd with neutrino (testnet)"
90
+ echo " --watchonly Watch-only litd + remote signer"
91
+ echo " --regtest litd + bitcoind for local development"
92
+ echo ""
93
+ echo "Configuration:"
94
+ echo " --profile, -p Load profile (taproot, wumbo, debug, regtest)"
95
+ echo " --network NET Override network (testnet, mainnet, signet)"
96
+ echo " --args, -a Extra litd arguments (quoted string)"
97
+ echo " --list-profiles Show available profiles"
98
+ echo ""
99
+ echo "Options:"
100
+ echo " --build Rebuild images before starting"
101
+ echo " --foreground, -f Run in foreground (show logs)"
102
+ exit 0
103
+ ;;
104
+ *)
105
+ echo "Unknown option: $1" >&2
106
+ exit 1
107
+ ;;
108
+ esac
109
+ done
110
+
111
+ # Load profile if specified.
112
+ if [ -n "$PROFILE" ]; then
113
+ PROFILE_FILE="$PROFILE_DIR/$PROFILE.env"
114
+ if [ -f "$PROFILE_FILE" ]; then
115
+ echo "Loading profile: $PROFILE"
116
+ source "$PROFILE_FILE"
117
+ else
118
+ echo "Error: Profile '$PROFILE' not found." >&2
119
+ echo "Available profiles:"
120
+ ls -1 "$PROFILE_DIR"/*.env 2>/dev/null | xargs -n1 basename | sed 's/.env$//'
121
+ exit 1
122
+ fi
123
+ fi
124
+
125
+ # Override network if specified on command line.
126
+ if [ -n "$CUSTOM_NETWORK" ]; then
127
+ NETWORK="$CUSTOM_NETWORK"
128
+ fi
129
+
130
+ # Append custom args to profile extra args.
131
+ if [ -n "$CUSTOM_ARGS" ]; then
132
+ if [ -n "$LITD_EXTRA_ARGS" ]; then
133
+ LITD_EXTRA_ARGS="$LITD_EXTRA_ARGS $CUSTOM_ARGS"
134
+ else
135
+ LITD_EXTRA_ARGS="$CUSTOM_ARGS"
136
+ fi
137
+ fi
138
+
139
+ # Select compose file based on mode.
140
+ case "$MODE" in
141
+ standalone)
142
+ COMPOSE_FILE="docker-compose.yml"
143
+ ;;
144
+ watchonly)
145
+ COMPOSE_FILE="docker-compose-watchonly.yml"
146
+ ;;
147
+ regtest)
148
+ COMPOSE_FILE="docker-compose-regtest.yml"
149
+ ;;
150
+ esac
151
+
152
+ # --- Generate runtime config from template ---
153
+
154
+ LNGET_LND_DIR="${LNGET_LND_DIR:-$HOME/.lnget/lnd}"
155
+ mkdir -p "$LNGET_LND_DIR"
156
+
157
+ case "$MODE" in
158
+ standalone)
159
+ generate_litd_config \
160
+ "$TEMPLATE_DIR/litd.conf.template" \
161
+ "$LNGET_LND_DIR/litd.conf" \
162
+ "${NETWORK:-testnet}" \
163
+ "${LND_DEBUG:-info}" \
164
+ "${NODE_ALIAS:-litd-agent}" \
165
+ "${UI_PASSWORD:-agent-litd-password}" \
166
+ "$LITD_EXTRA_ARGS"
167
+ ;;
168
+ regtest)
169
+ generate_litd_config \
170
+ "$TEMPLATE_DIR/litd-regtest.conf.template" \
171
+ "$LNGET_LND_DIR/litd.conf" \
172
+ "regtest" \
173
+ "${LND_DEBUG:-debug}" \
174
+ "${NODE_ALIAS:-litd-agent}" \
175
+ "${UI_PASSWORD:-agent-litd-password}" \
176
+ "$LITD_EXTRA_ARGS"
177
+ ;;
178
+ watchonly)
179
+ generate_litd_config \
180
+ "$TEMPLATE_DIR/litd-watchonly.conf.template" \
181
+ "$LNGET_LND_DIR/litd.conf" \
182
+ "${NETWORK:-testnet}" \
183
+ "${LND_DEBUG:-info}" \
184
+ "${NODE_ALIAS:-litd-agent}" \
185
+ "${UI_PASSWORD:-agent-litd-password}" \
186
+ "$LITD_EXTRA_ARGS"
187
+
188
+ SIGNER_TEMPLATE_DIR="$SCRIPT_DIR/../../lightning-security-module/templates"
189
+ generate_lnd_config \
190
+ "$SIGNER_TEMPLATE_DIR/signer-lnd.conf.template" \
191
+ "$LNGET_LND_DIR/signer-lnd.conf" \
192
+ "${NETWORK:-testnet}" \
193
+ "${SIGNER_DEBUG:-info}" \
194
+ ""
195
+
196
+ export SIGNER_CONF_PATH="$LNGET_LND_DIR/signer-lnd.conf"
197
+ ;;
198
+ esac
199
+
200
+ export LITD_CONF_PATH="$LNGET_LND_DIR/litd.conf"
201
+
202
+ # --- Start containers ---
203
+
204
+ cd "$TEMPLATE_DIR"
205
+
206
+ echo "=== Starting litd ($MODE mode) ==="
207
+ echo " Compose: $COMPOSE_FILE"
208
+ echo " Config: $LITD_CONF_PATH"
209
+ echo " Network: ${NETWORK:-testnet}"
210
+ if [ -n "$PROFILE" ]; then
211
+ echo " Profile: $PROFILE"
212
+ fi
213
+ if [ -n "$LITD_EXTRA_ARGS" ]; then
214
+ echo " Extra: $LITD_EXTRA_ARGS"
215
+ fi
216
+ echo ""
217
+
218
+ # Build the docker-compose command.
219
+ CMD="docker compose -f $COMPOSE_FILE"
220
+
221
+ if [ "$BUILD" = true ]; then
222
+ CMD="$CMD up --build"
223
+ else
224
+ CMD="$CMD up"
225
+ fi
226
+
227
+ if [ "$DETACH" = true ]; then
228
+ CMD="$CMD -d"
229
+ fi
230
+
231
+ echo "Running: $CMD"
232
+ eval "$CMD"
233
+
234
+ if [ "$DETACH" = true ]; then
235
+ echo ""
236
+ echo "litd started in background."
237
+ echo ""
238
+ echo "Check logs:"
239
+ echo " docker logs -f litd"
240
+ echo ""
241
+ echo "Run commands:"
242
+ echo " skills/lnd/scripts/lncli.sh getinfo"
243
+ echo ""
244
+
245
+ if [ "$MODE" = "standalone" ] || [ "$MODE" = "regtest" ]; then
246
+ echo "Next: create a wallet (if first run):"
247
+ echo " skills/lnd/scripts/create-wallet.sh --container litd"
248
+ elif [ "$MODE" = "watchonly" ]; then
249
+ echo "Next steps:"
250
+ echo " 1. Set up signer wallet:"
251
+ echo " skills/lightning-security-module/scripts/setup-signer.sh --container litd-signer"
252
+ echo " 2. Export credentials:"
253
+ echo " skills/lightning-security-module/scripts/export-credentials.sh --container litd-signer"
254
+ echo " 3. Import credentials into litd and create watch-only wallet"
255
+ fi
256
+ fi
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env bash
2
+ # Stop litd (Lightning Terminal) containers.
3
+ #
4
+ # Usage:
5
+ # docker-stop.sh # Stop standalone (preserve data)
6
+ # docker-stop.sh --clean # Stop and remove volumes
7
+ # docker-stop.sh --watchonly # Stop watch-only + signer
8
+ # docker-stop.sh --regtest # Stop regtest mode
9
+ # docker-stop.sh --all # Stop all litd containers
10
+
11
+ set -e
12
+
13
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
14
+ TEMPLATE_DIR="$SCRIPT_DIR/../templates"
15
+ MODE=""
16
+ CLEAN=false
17
+
18
+ # Parse arguments.
19
+ while [[ $# -gt 0 ]]; do
20
+ case $1 in
21
+ --clean|-v)
22
+ CLEAN=true
23
+ shift
24
+ ;;
25
+ --watchonly)
26
+ MODE="watchonly"
27
+ shift
28
+ ;;
29
+ --regtest)
30
+ MODE="regtest"
31
+ shift
32
+ ;;
33
+ --all)
34
+ MODE="all"
35
+ shift
36
+ ;;
37
+ -h|--help)
38
+ echo "Usage: docker-stop.sh [options]"
39
+ echo ""
40
+ echo "Stop litd containers."
41
+ echo ""
42
+ echo "Options:"
43
+ echo " --clean, -v Remove volumes (clean state)"
44
+ echo " --watchonly Stop watch-only + signer containers"
45
+ echo " --regtest Stop regtest containers"
46
+ echo " --all Stop all litd containers regardless of mode"
47
+ exit 0
48
+ ;;
49
+ *)
50
+ echo "Unknown option: $1" >&2
51
+ exit 1
52
+ ;;
53
+ esac
54
+ done
55
+
56
+ # Auto-detect mode from running containers if not specified.
57
+ if [ -z "$MODE" ]; then
58
+ if docker ps --format '{{.Names}}' 2>/dev/null | grep -q '^litd-bitcoind$'; then
59
+ MODE="regtest"
60
+ elif docker ps --format '{{.Names}}' 2>/dev/null | grep -q '^litd-signer$'; then
61
+ MODE="watchonly"
62
+ elif docker ps --format '{{.Names}}' 2>/dev/null | grep -q '^litd$'; then
63
+ MODE="standalone"
64
+ else
65
+ echo "No litd containers found running."
66
+ exit 0
67
+ fi
68
+ fi
69
+
70
+ cd "$TEMPLATE_DIR"
71
+
72
+ # Stop all litd containers regardless of mode.
73
+ if [ "$MODE" = "all" ]; then
74
+ echo "Stopping all litd containers..."
75
+ for file in docker-compose.yml docker-compose-watchonly.yml docker-compose-regtest.yml; do
76
+ if [ -f "$file" ]; then
77
+ if [ "$CLEAN" = true ]; then
78
+ docker compose -f "$file" down -v 2>/dev/null || true
79
+ else
80
+ docker compose -f "$file" down 2>/dev/null || true
81
+ fi
82
+ fi
83
+ done
84
+ echo "Done."
85
+ exit 0
86
+ fi
87
+
88
+ # Select compose file based on mode.
89
+ case "$MODE" in
90
+ standalone)
91
+ COMPOSE_FILE="docker-compose.yml"
92
+ ;;
93
+ watchonly)
94
+ COMPOSE_FILE="docker-compose-watchonly.yml"
95
+ ;;
96
+ regtest)
97
+ COMPOSE_FILE="docker-compose-regtest.yml"
98
+ ;;
99
+ esac
100
+
101
+ echo "Stopping litd ($MODE mode)..."
102
+
103
+ if [ "$CLEAN" = true ]; then
104
+ docker compose -f "$COMPOSE_FILE" down -v
105
+ echo "Stopped and removed volumes."
106
+ else
107
+ docker compose -f "$COMPOSE_FILE" down
108
+ echo "Stopped (volumes preserved)."
109
+ fi
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env bash
2
+ # Import signer credentials bundle for watch-only lnd operation.
3
+ #
4
+ # Usage:
5
+ # import-credentials.sh --bundle /path/to/credentials-bundle/
6
+ # import-credentials.sh --bundle /path/to/credentials-bundle.tar.gz.b64
7
+ # import-credentials.sh --bundle <base64-string>
8
+ #
9
+ # Imports to:
10
+ # ~/.lnget/lnd/signer-credentials/accounts.json
11
+ # ~/.lnget/lnd/signer-credentials/tls.cert
12
+ # ~/.lnget/lnd/signer-credentials/admin.macaroon
13
+
14
+ set -e
15
+
16
+ LNGET_LND_DIR="${LNGET_LND_DIR:-$HOME/.lnget/lnd}"
17
+ BUNDLE=""
18
+
19
+ # Parse arguments.
20
+ while [[ $# -gt 0 ]]; do
21
+ case $1 in
22
+ --bundle)
23
+ BUNDLE="$2"
24
+ shift 2
25
+ ;;
26
+ -h|--help)
27
+ echo "Usage: import-credentials.sh --bundle <path-or-base64>"
28
+ echo ""
29
+ echo "Import signer credentials bundle for watch-only lnd."
30
+ echo ""
31
+ echo "Options:"
32
+ echo " --bundle PATH Path to credentials directory, .tar.gz.b64 file,"
33
+ echo " or raw base64 string"
34
+ echo ""
35
+ echo "The bundle should contain: accounts.json, tls.cert, admin.macaroon"
36
+ echo "These are produced by the lightning-security-module skill's"
37
+ echo "export-credentials.sh script."
38
+ exit 0
39
+ ;;
40
+ *)
41
+ echo "Unknown option: $1" >&2
42
+ exit 1
43
+ ;;
44
+ esac
45
+ done
46
+
47
+ if [ -z "$BUNDLE" ]; then
48
+ echo "Error: --bundle is required." >&2
49
+ echo "Usage: import-credentials.sh --bundle <path-or-base64>" >&2
50
+ exit 1
51
+ fi
52
+
53
+ CREDS_DIR="$LNGET_LND_DIR/signer-credentials"
54
+
55
+ echo "=== Importing Signer Credentials ==="
56
+ echo ""
57
+ echo "Output: $CREDS_DIR"
58
+ echo ""
59
+
60
+ # Create credentials directory.
61
+ mkdir -p "$CREDS_DIR"
62
+ chmod 700 "$CREDS_DIR"
63
+
64
+ # Determine bundle type and extract.
65
+ if [ -d "$BUNDLE" ]; then
66
+ # Directory: copy files directly.
67
+ echo "Importing from directory: $BUNDLE"
68
+ cp "$BUNDLE/accounts.json" "$CREDS_DIR/" 2>/dev/null || true
69
+ cp "$BUNDLE/tls.cert" "$CREDS_DIR/" 2>/dev/null || true
70
+ cp "$BUNDLE/admin.macaroon" "$CREDS_DIR/" 2>/dev/null || true
71
+
72
+ elif [ -f "$BUNDLE" ]; then
73
+ # File: assume base64-encoded tar.gz.
74
+ echo "Importing from file: $BUNDLE"
75
+ base64 -d < "$BUNDLE" | tar -xzf - -C "$CREDS_DIR"
76
+
77
+ else
78
+ # Raw base64 string: decode and extract.
79
+ echo "Importing from base64 string..."
80
+ echo "$BUNDLE" | base64 -d | tar -xzf - -C "$CREDS_DIR"
81
+ fi
82
+
83
+ echo ""
84
+
85
+ # Verify all required files are present.
86
+ MISSING=false
87
+
88
+ if [ -f "$CREDS_DIR/accounts.json" ]; then
89
+ echo " accounts.json — OK"
90
+ else
91
+ echo " accounts.json — MISSING" >&2
92
+ MISSING=true
93
+ fi
94
+
95
+ if [ -f "$CREDS_DIR/tls.cert" ]; then
96
+ echo " tls.cert — OK"
97
+ else
98
+ echo " tls.cert — MISSING" >&2
99
+ MISSING=true
100
+ fi
101
+
102
+ if [ -f "$CREDS_DIR/admin.macaroon" ]; then
103
+ echo " admin.macaroon — OK"
104
+ else
105
+ echo " admin.macaroon — MISSING" >&2
106
+ MISSING=true
107
+ fi
108
+
109
+ if [ "$MISSING" = true ]; then
110
+ echo "" >&2
111
+ echo "Error: Credentials bundle is incomplete." >&2
112
+ echo "Expected: accounts.json, tls.cert, admin.macaroon" >&2
113
+ exit 1
114
+ fi
115
+
116
+ # Set restrictive permissions on credential files.
117
+ chmod 600 "$CREDS_DIR/accounts.json"
118
+ chmod 600 "$CREDS_DIR/tls.cert"
119
+ chmod 600 "$CREDS_DIR/admin.macaroon"
120
+
121
+ echo ""
122
+
123
+ # If a litd container is running, copy credentials into it so the
124
+ # remotesigner config paths resolve inside the container.
125
+ if command -v docker &>/dev/null; then
126
+ for candidate in litd litd-shared; do
127
+ if docker ps --format '{{.Names}}' 2>/dev/null | grep -qx "$candidate"; then
128
+ docker exec "$candidate" mkdir -p /root/.lnd/signer-credentials
129
+ docker cp "$CREDS_DIR/tls.cert" "$candidate:/root/.lnd/signer-credentials/tls.cert"
130
+ docker cp "$CREDS_DIR/admin.macaroon" "$candidate:/root/.lnd/signer-credentials/admin.macaroon"
131
+ docker cp "$CREDS_DIR/accounts.json" "$candidate:/root/.lnd/signer-credentials/accounts.json"
132
+ echo " Credentials copied into container '$candidate'."
133
+ break
134
+ fi
135
+ done
136
+ fi
137
+
138
+ echo ""
139
+ echo "=== Credentials Imported Successfully ==="
140
+ echo ""
141
+ echo "Location: $CREDS_DIR"
142
+ echo ""
143
+ echo "Next steps:"
144
+ echo " 1. Create watch-only wallet: skills/lnd/scripts/create-wallet.sh"
145
+ echo " 2. Start lnd: skills/lnd/scripts/start-lnd.sh --signer-host <signer-ip>:10012"
@@ -0,0 +1,195 @@
1
+ #!/usr/bin/env bash
2
+ # Install Lightning Terminal (litd) — bundles lnd, loop, pool, tapd, faraday.
3
+ #
4
+ # Default: pulls the pre-built Docker image (fast, no Go required).
5
+ # Fallback: --source builds lnd from source (requires Go 1.21+).
6
+ #
7
+ # Usage:
8
+ # install.sh # Docker pull (default)
9
+ # install.sh --version v0.17.0-alpha # Specific version
10
+ # install.sh --source # Build lnd from source
11
+ # install.sh --source --version v0.20.0-beta
12
+
13
+ set -e
14
+
15
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
+ VERSIONS_FILE="$SCRIPT_DIR/../../../versions.env"
17
+
18
+ # Source pinned versions.
19
+ if [ -f "$VERSIONS_FILE" ]; then
20
+ source "$VERSIONS_FILE"
21
+ fi
22
+
23
+ VERSION=""
24
+ SOURCE=false
25
+ BUILD_TAGS="signrpc walletrpc chainrpc invoicesrpc routerrpc peersrpc kvdb_sqlite neutrinorpc"
26
+
27
+ # Parse arguments.
28
+ while [[ $# -gt 0 ]]; do
29
+ case $1 in
30
+ --version)
31
+ VERSION="$2"
32
+ shift 2
33
+ ;;
34
+ --source)
35
+ SOURCE=true
36
+ shift
37
+ ;;
38
+ --tags)
39
+ BUILD_TAGS="$2"
40
+ shift 2
41
+ ;;
42
+ -h|--help)
43
+ echo "Usage: install.sh [options]"
44
+ echo ""
45
+ echo "Install Lightning Terminal (litd) for agent operation."
46
+ echo ""
47
+ echo "Default: pulls the pre-built Docker image."
48
+ echo ""
49
+ echo "Options:"
50
+ echo " --version VERSION Image tag or git tag (default: from versions.env)"
51
+ echo " --source Build lnd from source instead of pulling Docker image"
52
+ echo " --tags TAGS Build tags for --source mode"
53
+ echo ""
54
+ echo "Docker mode (default):"
55
+ echo " Pulls lightninglabs/lightning-terminal:VERSION"
56
+ echo " Includes: litd, lncli, litcli, loop, pool, tapcli, frcli"
57
+ echo ""
58
+ echo "Source mode (--source):"
59
+ echo " Clones and builds lnd + lncli from source (requires Go 1.21+)"
60
+ exit 0
61
+ ;;
62
+ *)
63
+ echo "Unknown option: $1" >&2
64
+ exit 1
65
+ ;;
66
+ esac
67
+ done
68
+
69
+ if [ "$SOURCE" = true ]; then
70
+ # --- Source build mode: clone and build lnd from source ---
71
+ echo "=== Installing lnd from source ==="
72
+ echo ""
73
+
74
+ # Verify Go is installed.
75
+ if ! command -v go &>/dev/null; then
76
+ echo "Error: Go is not installed." >&2
77
+ echo "Install Go from https://go.dev/dl/" >&2
78
+ exit 1
79
+ fi
80
+
81
+ GO_VERSION=$(go version | grep -oE 'go[0-9]+\.[0-9]+' | head -1)
82
+ echo "Go version: $GO_VERSION"
83
+ echo "Build tags: $BUILD_TAGS"
84
+ echo ""
85
+
86
+ # Use LND_VERSION from versions.env if no --version given.
87
+ SOURCE_VERSION="${VERSION:-${LND_VERSION:-}}"
88
+
89
+ # Clone lnd into a temp directory and build from source.
90
+ TMPDIR=$(mktemp -d)
91
+ trap "rm -rf $TMPDIR" EXIT
92
+
93
+ echo "Cloning lnd..."
94
+ git clone --quiet https://github.com/lightningnetwork/lnd.git "$TMPDIR/lnd"
95
+
96
+ cd "$TMPDIR/lnd"
97
+
98
+ # Checkout specific version if requested, otherwise use latest tag.
99
+ if [ -n "$SOURCE_VERSION" ]; then
100
+ echo "Checking out $SOURCE_VERSION..."
101
+ git checkout --quiet "$SOURCE_VERSION"
102
+ else
103
+ LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
104
+ if [ -n "$LATEST_TAG" ]; then
105
+ echo "Using latest tag: $LATEST_TAG"
106
+ git checkout --quiet "$LATEST_TAG"
107
+ else
108
+ echo "Using HEAD (no tags found)."
109
+ fi
110
+ fi
111
+ echo ""
112
+
113
+ GOBIN=$(go env GOPATH)/bin
114
+
115
+ # Build lnd.
116
+ echo "Building lnd..."
117
+ go build -tags "$BUILD_TAGS" -o "$GOBIN/lnd" ./cmd/lnd
118
+ echo "Done."
119
+
120
+ # Build lncli.
121
+ echo "Building lncli..."
122
+ go build -tags "$BUILD_TAGS" -o "$GOBIN/lncli" ./cmd/lncli
123
+ echo "Done."
124
+ echo ""
125
+
126
+ # Verify installation.
127
+ if command -v lnd &>/dev/null; then
128
+ echo "lnd installed: $(which lnd)"
129
+ lnd --version 2>/dev/null || true
130
+ else
131
+ echo "Warning: lnd not found on PATH." >&2
132
+ echo "Ensure \$GOPATH/bin is in your PATH." >&2
133
+ echo " export PATH=\$PATH:\$(go env GOPATH)/bin" >&2
134
+ fi
135
+
136
+ if command -v lncli &>/dev/null; then
137
+ echo "lncli installed: $(which lncli)"
138
+ else
139
+ echo "Warning: lncli not found on PATH." >&2
140
+ fi
141
+
142
+ echo ""
143
+ echo "Source installation complete."
144
+ echo ""
145
+ echo "Next steps:"
146
+ echo " 1. Create wallet: skills/lnd/scripts/create-wallet.sh"
147
+ echo " 2. Start lnd: skills/lnd/scripts/start-lnd.sh --native"
148
+
149
+ else
150
+ # --- Docker mode (default): pull pre-built image ---
151
+ echo "=== Installing Lightning Terminal (litd) via Docker ==="
152
+ echo ""
153
+
154
+ # Verify Docker is available.
155
+ if ! command -v docker &>/dev/null; then
156
+ echo "Error: Docker is not installed." >&2
157
+ echo "Install Docker from https://docs.docker.com/get-docker/" >&2
158
+ echo "" >&2
159
+ echo "Or use --source to build from source (requires Go 1.21+)." >&2
160
+ exit 1
161
+ fi
162
+
163
+ IMAGE="${LITD_IMAGE:-lightninglabs/lightning-terminal}"
164
+ TAG="${VERSION:-${LITD_VERSION:-v0.16.0-alpha}}"
165
+
166
+ echo "Image: $IMAGE:$TAG"
167
+ echo ""
168
+
169
+ # Pull the image.
170
+ echo "Pulling image..."
171
+ docker pull "$IMAGE:$TAG"
172
+ echo ""
173
+
174
+ # Verify the image works.
175
+ echo "Verifying installation..."
176
+ docker run --rm "$IMAGE:$TAG" litd --version 2>/dev/null || true
177
+ echo ""
178
+
179
+ # Show available CLIs inside the container.
180
+ echo "Available CLIs in container:"
181
+ echo " lncli — lnd command-line interface"
182
+ echo " litcli — Lightning Terminal CLI"
183
+ echo " loop — Lightning Loop CLI (submarine swaps)"
184
+ echo " pool — Lightning Pool CLI (channel marketplace)"
185
+ echo " tapcli — Taproot Assets CLI"
186
+ echo " frcli — Faraday CLI (channel analytics)"
187
+ echo ""
188
+
189
+ echo "Installation complete."
190
+ echo ""
191
+ echo "Next steps:"
192
+ echo " 1. Start litd: skills/lnd/scripts/docker-start.sh"
193
+ echo " 2. Create wallet: skills/lnd/scripts/create-wallet.sh"
194
+ echo " 3. Check status: skills/lnd/scripts/lncli.sh getinfo"
195
+ fi