-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·90 lines (75 loc) · 2.62 KB
/
setup.sh
File metadata and controls
executable file
·90 lines (75 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env bash
# Setup script for x402 L402 Feed Reader
#
# Prerequisites:
# - Docker installed and running
# - This repo cloned with submodules:
# git clone --recurse-submodules <repo-url>
#
# Architecture:
# litd (watch-only, Neutrino) <--gRPC--> lnd-signer (keys only)
# No full Bitcoin node needed. Neutrino syncs via compact block filters.
#
# Credentials are stored at ~/.lnget/ and never committed to git.
set -e
TOOLS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/lightning-agent-tools" && pwd)"
LNGET_DIR="${LNGET_DIR:-$HOME/.lnget}"
CREDS_BUNDLE="$LNGET_DIR/signer/credentials-bundle"
cleanup() {
echo ""
echo "Setup failed at step above. Containers may be partially running."
echo "To clean up: cd $TOOLS_DIR && skills/lnd/scripts/stop-lnd.sh"
}
trap cleanup ERR
echo "=== x402 Lightning Setup ==="
echo ""
echo "Using lightning-agent-tools at: $TOOLS_DIR"
echo ""
if ! command -v docker &>/dev/null; then
echo "Error: Docker is required. Install it from https://docker.com"
exit 1
fi
if ! docker info &>/dev/null; then
echo "Error: Docker daemon is not running. Start Docker and try again."
exit 1
fi
if [ ! -d "$TOOLS_DIR/skills" ]; then
echo "Error: lightning-agent-tools submodule not initialized."
echo "Run: git submodule update --init --recursive"
exit 1
fi
cd "$TOOLS_DIR"
echo "--- Step 1/5: Installing Docker images ---"
skills/lnd/scripts/install.sh &
skills/lightning-security-module/scripts/install.sh &
wait
echo ""
echo "--- Step 2/5: Starting litd (watch-only) + signer ---"
skills/lnd/scripts/start-lnd.sh --watchonly
echo ""
echo "--- Step 3/5: Setting up signer wallet ---"
skills/lightning-security-module/scripts/setup-signer.sh --container litd-signer
echo ""
echo "--- Step 4/5: Importing credentials ---"
skills/lnd/scripts/import-credentials.sh --bundle "$CREDS_BUNDLE"
echo ""
# Workaround: create-wallet.sh doesn't define SCRIPT_DIR but sources
# $SCRIPT_DIR/../../lib/rest.sh — set it so the relative path resolves.
echo "--- Step 5/5: Creating watch-only wallet ---"
SCRIPT_DIR="$TOOLS_DIR/skills/lnd/scripts" skills/lnd/scripts/create-wallet.sh --container litd
echo ""
trap - ERR
echo "=== Setup Complete ==="
echo ""
echo "Node is syncing on testnet via Neutrino (no full Bitcoin node)."
echo "This may take a while to reach chain tip."
echo ""
echo "Check status:"
echo " cd lightning-agent-tools && skills/lnd/scripts/lncli.sh getinfo"
echo ""
echo "Credentials stored at:"
echo " $LNGET_DIR/lnd/ (watch-only node)"
echo " $LNGET_DIR/signer/ (signer - KEEP SECURE)"
echo ""
echo "To stop:"
echo " cd lightning-agent-tools && skills/lnd/scripts/stop-lnd.sh"