Skip to content

manumonti/ln-payment

Repository files navigation

Bitcoin Lightning Network Payment Challenge

A full-stack application for Bitcoin Lightning Network payments between nodes. This project demonstrates end-to-end invoice generation, payment execution, and real-time status tracking using LND nodes within a Polar-simulated network.

ln-payment-payment gif

📚 Documentation

For detailed information, please refer to the following guides:

  • Setup & Run Guide: Detailed instructions on how to run the application.
  • API Documentation: Details of all REST endpoints available in the backend.
  • Architecture: In-depth look at the technology stack, system design, and database schema.

🛠 Features

  • Invoice Generation: Create BOLT-11 invoices with custom amounts and memos.
  • Payment Execution: Pay invoices from a different node with real-time status updates. Invoice decoding and validation is performed before payment execution.
  • Transaction History: View past invoices and payments in a unified list with status updates. Transactions are persisted in the database.
  • Balance Tracking: Real-time calculation of node balance based on local database records.
  • Real-time updates: Frontend and Backend communicate via WebSockets to provide real-time updates on invoice and payment status.
  • RESTful API: Backend server exposes a RESTful API for frontend and external applications.
  • Session tokens: Backend server uses session tokens to connect to multiple LND nodes.
  • Reconnection on restart: Connections to LND nodes automatically restored after server restart.
  • Dockerized Stack: Easy deployment of Frontend, Backend, and PostgreSQL database with a single docker-compose command.
  • Docker networking: Docker network configured to connect to LND nodes running in Polar.
  • DB management: Easy access to the PostgreSQL database for monitoring and management through pgAdmin web interface.

🏗 Tech Stack

  • Frontend: Typescript, React library, Next.js React framework, Untitled.ui React components.
  • Backend: Typescript, Node.js runtime environment, Express web application framework.
  • Database: PostgreSQL.
  • Lightning Network: Simulated LND (Lightning Network Daemon) nodes via Polar.
  • Code Style: ESLint code linter, Prettier code formatter, Husky for pre-commit Git hook.
  • Testing: Jest unit testing framework for backend.

📋 TODOs

  • Add unit tests for frontend components
  • Add e2e tests for frontend components
  • Better error handling
  • Better consistency between API endpoints responses
  • Transactions and Balance pages are updated in real-time

📷 Screenshots

Payment page

ln-payment-payment gif

Invoice page

ln-payment-invoice gif

Transactions page

ln-payment-transactions

Balance page

ln-payment-balance

About

Full-stack app that enables Bitcoin Lightning Network invoice payments

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors