Awesome
<p align="center"> <img width="150" src="assets/node-lightning-logo.svg" width="100" alt="Node Lightning logo"> </p> <h1 align="center">Node-Lightning (formerly LNTools)</h1> <div align="center"> </div>About the Project
Node-Lightning is an implementation of the Bitcoin Lightning Network in the Node.js runtime. The goal of this project is to implement the BOLT specifications to enable testing, research, and education. This project is not intended to replace or compete with the major implementations, though our hope is that the implementation will be fully functional.
This library contains the core packages and several examples. There is currently no runtime for this project.
The architecture philosophies for packages is:
- Minimize external dependencies - the Node.js ecosystem is rife with excess dependency usage. This project attempts to minimize the usage of external dependencies as much as possible (there are very few external modules in use at this point).
- Reduce complexity using semi-formalized state machines - the Lightning Network is a complex beast. It is very difficult to reason about code that has high cyclomatic complexity. To reduce cognitive load, allow for isolated testing, and enable composibility and extensibility, code is frequently broken into state machines and combined with concepts from state charts. This library is not using metaprogramming techniques, though we are using many of the concepts. This enables the last point.
- Engineer for modular composibility - The goal is to enable composibility of various state machines which enables swapping out implementations or direct extensibility of complex processes.
The goal of this project is ambitious and there is a still a long road ahead. Refer to issues and the wiki for more information on how this project is structured and how you can contribute.
Structure and Modules
Node-Lightning is structured as a monorepo with individual packages existing inside of packages
.
- @node-lightning/lightning - lightning specific code
- @node-lightning/bitcoin - tools for building and parsing Bitcoin blocks and transactions
- @node-lightning/bitcoind - bitcoind RPC and zeromq client
- @node-lightning/bufio - utilities for working with Buffers
- @node-lightning/chainmon - transaction and block monitoring tools
- @node-lightning/checksum - implements checksums such as CRC32C
- @node-lightning/crypto - common cryptography utilities
- @node-lightning/gossip-rocksdb - stores gossip messages in RocksDB
- @node-lightning/invoice - encoding/decoding for invoices
- @node-lightning/logger - logging utility
- @node-lightning/noise - Noise Protocol socket/server
Examples of usage can be found inside examples
- examples/peer - simple peer connection
- examples/gossip - gossip using gossip queries
- examples/graph - full gossip, storage, and graph construction
BOLT Status
Current status of Lightning RFC specification implementation:
- BOLT 1 - Base Protocol: @node-lightning/lightning
- BOLT 2 - Peer Protocol for Channel Management
- BOLT 3 - Bitcoin Transaction and Script Format: @node-lightning/bitcoin, @node-lightning/lightning
- BOLT 4 - Onion Routing Protocol
- BOLT 5 - Recommendations for On-chain Transaction Handling
- BOLT 7 - P2P Node and Channel Discovery: @node-lightning/lightning
- BOLT 8 - Encrypted and Authenticated Transport: @node-lightning/noise
- BOLT 9 - Assigned Feature Flags: @node-lightning/lightning
- BOLT 10 - DNS Bootstrap and Assisted Node Location: @node-lightning/lightning
- BOLT 11 - Invoice Protocol for Lightning Payments: @node-lightning/invoice