Megalithic Documentation
website·Indexed 32 days ago
https://docs.megalithic.me/Guides and documentation for the Lightning Network, including the Megalith Node, Rizful for Lightning payments and Nostr zaps, and technical instructions for running routing nodes, Taproot Assets, and integrating with BTCPay Server, Alby, and Nostr clients like Damus and Amethyst.
What's inside Megalithic
- OpenReceive is a free, open-source (MIT), self-hosted tool for handling inbound Bitcoin Lightning payments. It allows developers to integrate a checkout process into their applications without requiring a payment processor, account, API key, or KYC. Payments settle directly into a wallet controlled by the user via a receive-only Nostr Wallet Connect (NWC) code, ensuring that the server never holds spending keys and funds never pass through a third party.
Overview of Rizful as a Lightning Wallet
Rizful is a free, browser-based, no-KYC Lightning wallet designed for sending and receiving payments and zapping on Nostr. It is compatible with any device (phone, tablet, desktop) and remains online 24/7 to receive payments. Key features include permanent Lightning Addresses, NIP-05 Nostr identity verification, and NWC (Nostr Wallet Connect) support for clients like Damus, Amethyst, and Primal.Overview of BLFS (Bitcoin Lightning for Shopify)
BLFS is an open-source (MIT license) server-side application that connects NWC (Nostr Wallet Connect) financial services to Shopify merchants. It allows Shopify stores to accept Bitcoin Lightning payments by generating Lightning invoices for consumers.
Key architectural details:
- Requirements: Runs on nearly any Linux server with minimal compute power.
- Tech Stack: Deployed via Docker Compose; uses SQLite, Node.js, Caddy, and optional Litestream replication.
- Decentralization: Anyone can run a BLFS instance and connect it to any NWC financial service.
- Monetization: BLFS operators can optionally charge a percentage fee on transactions based on their agreement with the merchant.
# Source code available at https://github.com/MegalithicBTC/BLFSOverview of Megalith LSPS1 Inbound Liquidity Service
Megalith provides a Lightning Service Provider (LSP) service following the LSPS1 (bLIP51) standard to help users obtain inbound liquidity (the ability to receive payments). While the LSPS1 specification suggests BOLT8 for communication, Megalith currently implements the negotiation steps using HTTP REST requests. Because HTTP is used instead of BOLT8, Megalith introduces two extensions to the spec: apublic_keyparameter increate_orderand aurisfield inget_infoto identify the client node and provide connection details.Overview of Lightning Swap for merchants
Lightning Swap allows merchants to accept payments in altcoins or stablecoins (such as USDT, USDC, SOL, and ETH) and receive the settlement instantly as Bitcoin (sats) on the Lightning Network. This enables merchants to maintain a single-asset treasury (Bitcoin) while providing customers the flexibility to pay with assets they already hold on various chains.Understand Lightning Network routing privacy
The Lightning Network is designed to conceal the movement of funds. Publicly available data only shows the total size of a channel between two nodes; it does not reveal who opened the channel, who is using it, or the current balances on either side. Individual payment movements across a node's 'hop' are kept private and secured by the Onion Routing Protocol, preventing outside observers from tracking specific payments.Integrate Rizful onboarding for Lightning payments in Nostr clients
Rizful provides an OAuth-like integration flow for Nostr clients to give users instant access to Lightning payments and zaps. Unlike traditional Nostr wallets that tie funds to a user's nsec (private key), Rizful uses email/password authentication, reducing the risk of fund loss due to misplaced keys or exposed nsecs.
When a user completes the onboarding flow, the app receives:
- NWC URI: A Nostr Wallet Connect string used for making Lightning payments.
- Lightning Address: Used for receiving payments and can be used as a NIP-05 identifier.
Understand the risks of Altcoins compared to Bitcoin
Altcoins are alternative cryptocurrencies created by copying or modifying Bitcoin's open-source code. While they often promise technical improvements over Bitcoin (such as higher speed and lower fees), they frequently introduce significant risks:
- Centralization: Many altcoins are not truly decentralized. For example, Solana's nodes are largely run by its founders and early marketers, making the network vulnerable to outages and legal shutdowns.
- Founder Risk: Unlike Bitcoin (where the founder, Satoshi Nakamoto, remained anonymous and did not sell his holdings), altcoin founders often retain a majority of coins and sell them to retail investors to achieve a profitable 'exit,' often leading to a price crash.
- Reliability: Centralized control can lead to network instability, requiring manual reboots by a small team of engineers, which contradicts the goal of a resilient, decentralized medium of exchange.
List active Lightning channels using lncli
To view details about your active channels, including liquidity and fee rates, use thelncli listchannelscommand. This is the command-line equivalent of the channel liquidity views found in LNDG.lncli listchannelsArchitecture for LND Node Monitoring and Alarms
To implement a robust monitoring system that detects both node health and network connectivity failures, the following components are required:
- Main LND Node: The primary node being monitored.
- LND Watchtower Node: A second LND node in a different physical location and network used to verify the Main Node's connectivity.
- VPS Queue Listener: A separate Linux VPS (different from the Clearnet IP VPS) to process queue messages.
- Queuing System: A service like RabbitMQ (e.g., CloudAMQP) or AWS SQS to transport status messages.
- Alerting App: A service like Pushover to receive notifications on a mobile device.
Understand the LND and lncli architecture
LND consists of two primary components:
lndandlncli.lnd(Lightning Network Daemon): A background daemon that manages the actual node operations, including peer connections, blockchain monitoring, payment forwarding, and channel maintenance. It must run continuously.lncli(LND Command Line Interface): A client tool used to send requests to the runninglndprocess via gRPC calls. It is a control plane that tellslndwhat to do and then exits.
Because
lncliuses the same gRPC API as GUI dashboards, any action possible in a GUI can be performed vialncli.Implement Lightning routing and discovery (BOLT #4, #7)
BOLT #4 details 'Onion Routing', explaining how nodes communicate securely and how multi-path payments are handled. BOLT #7 covers 'P2P Node and Channel Discovery', describing the 'gossip' mechanism nodes use to share information about public channels across the network.