Lightning Network Integration
SatSigner provides seamless integration with the Lightning Network through LND (Lightning Network Daemon) connectivity. Connect your existing LND node to send and receive instant, low-fee Bitcoin payments.Overview
The Lightning integration allows you to:- Connect to remote LND nodes via REST API
- Monitor node status, channels, and peers in real-time
- Create and decode Lightning invoices
- Send payments through the Lightning Network
- View channel balances and liquidity
- Track payment history and preimages
LND REST API Connection
Connection Methods
SatSigner supports connecting to LND nodes through the REST API interface: LND REST (Currently Available)- Uses macaroon-based authentication
- Supports remote connections over HTTPS
- Requires connection string in format:
config=https://your-node.com/config.json
- LND RCP: Direct gRPC connection for lower latency
- LDK: Embedded Lightning node running directly in the app
Connection Configuration
The connection string points to a JSON configuration file containing:macaroon: Hex-encoded admin or invoice macaroon for authenticationuri: REST API endpoint URL of your LND nodecert: (Optional) TLS certificate for self-signed certificates
Setting Up Your Connection
Step 1: Prepare Your LND Node
- Ensure your LND node has REST API enabled
- Generate an admin or invoice macaroon
- Create a configuration JSON file with your node details
- Host the config file on a secure HTTPS endpoint
Step 2: Connect in SatSigner
- Navigate to Lightning from the main menu
- Tap LND Rest to initiate connection
- Either:
- Scan QR Code: Scan your config QR code
- Paste: Paste your connection string (
config=https://...)
- Tap Connect to Node
Step 3: Verify Connection
Once connected, SatSigner will:- Node alias and public key
- Connection status (Connected/Disconnected)
- Number of active channels
- Number of connected peers
- Chain synchronization status
- Block height
Node Management
Viewing Node Information
Access comprehensive node details:Channel Management
Monitor your Lightning channels:Creating Lightning Invoices
Generate invoices for receiving payments:- Payment request (bolt11 invoice string)
- Payment hash
- Expiration time
- Amount and description
Sending Lightning Payments
Payment Flow
- Decode Invoice: Parse bolt11 payment request
- Send Payment: Execute payment via
/v1/channels/transactions
- Poll for Status: Check payment completion
Connection Persistence
SatSigner stores your LND configuration securely:- Configuration persisted to secure storage (MMKV)
- Connection status monitored every 30 seconds
- Automatic reconnection on network changes
- Node info and channels cached locally
API Endpoints Used
SatSigner interacts with these LND REST endpoints:| Endpoint | Method | Purpose |
|---|---|---|
/v1/getinfo | GET | Fetch node information |
/v1/balance/blockchain | GET | Get on-chain balance |
/v1/channels | GET | List channels |
/v1/invoices | POST | Create invoice |
/v1/channels/transactions | POST | Send payment |
/v1/payments/{hash} | GET | Check payment status |
Security Considerations
Macaroon Security
- Never share your admin macaroon publicly
- Use invoice-only macaroons for receiving payments
- Use read-only macaroons for monitoring
- Rotate macaroons periodically
Network Security
- Always use HTTPS for remote connections
- Verify TLS certificates when possible
- Consider using Tor for additional privacy
- Keep connection strings secure
Backup Best Practices
- Backup your LND seed phrase separately
- Store channel backups (SCB files) securely
- Document your node configuration
- Test recovery procedures
Troubleshooting
Connection Issues
“Failed to connect to LND node”- Verify REST API is enabled on your LND node
- Check firewall rules allow connections
- Confirm macaroon has required permissions
- Test endpoint URL in a browser
- Ensure JSON is properly formatted
- Verify all required fields are present
- Check connection string format:
config=https://...
Payment Failures
“No route found”- Insufficient inbound/outbound liquidity
- Recipient not reachable
- Try increasing max fee or CLTV delta
- Network congestion
- Offline routing nodes
- Try again with different route hints
Advanced Features
Custom Request Handler
For advanced users, SatSigner exposes a generic request handler:Implementation Reference
Core Hook:apps/mobile/hooks/useLND.ts:1
Connection Setup: apps/mobile/app/(authenticated)/(tabs)/(signer,explorer,converter)/signer/lightning/LNDRest/index.tsx:29
State Management: apps/mobile/store/lightning.ts:1
Type Definitions: apps/mobile/types/models/LND.ts:1
Future Enhancements
Upcoming Lightning features:- LDK Integration: Embedded Lightning node
- LNURL Support: LNURL-pay and LNURL-withdraw
- Keysend Payments: Spontaneous payments without invoices
- Multi-path Payments: Split payments across multiple routes
- Channel Rebalancing: Automated liquidity management
- Submarine Swaps: On-chain to Lightning swaps