In early 2018 we created the first version of our Lightning Visualizer. This project displays a graph of the Lightning Network routing information and has a cool node search tool that lets you find nodes by various attributes.

The original version of the code used LND as a backend.  LND did the heavy lifting on the Lightning Network side which allowed the Lighting Visualizer to simply build a nice visualization.

Around the same time we created the Lightning Visualizer we also started working on libraries that implemented various parts of the Lightning Network BOLT specifications. Eventually this code was merged into a single code repository we dubbed LNTools.

The LNTools codebase expanded to include direct connection to the network, interaction with peers, retrieving gossip information, and building a full state graph among other things. LNTools' first major milestone was making the Lightning Visualizer directly connect to the network and maintain its own routing state.

Lightning Visualizer no longer requires an external Lightning Network node!

Lightning Visualizer now uses various libraries in LNTools to connect to a peer, retrieve and store the gossip state, validate messages via bitcoind, and maintain a nice graph that can be consumed by the visualization engine.

If you're curious how it comes together, you can checkout the code repository for lnviz.altangent.com.

On LNTools

LNTools is designed to be a modular implementation of the Lightning Network BOLT specifications. Our hope is that it is used for building prototypes, researching, testing, and learning.

We don't intend to make an alternative to LND, Eclair, c-Lightning, or any other full node implementation but hope that this project will be useful to some of you out there.

We have a few design goals in mind, both of which are works in progress:

  1. Keep things modular with nice clean interfaces
  2. Minimize use of external dependencies

Without further ado, a few modules that make up the bulk of the code:

  • @lntools/noise - provides a full implementation of the secure transport layer used by Lightning Network nodes. With this library you can connect to any node on the network, or you can just connect to another process running this module, whatever floats your boat. All of the TCP socket code exists here and this module can function independently of the rest of the codebase.
  • @lntools/wire - contains all messages and serialization/deserialization methods used by the network. It also contains a peer class that establishes and maintains a connection to another node and code for handling gossip messages, validating them, and persisting them to a store. The gossip code may get pulled out into a separate module.
  • @lntools/bitcoin - contains utilities for parsing and creating Bitcoin transactions. Many other libraries exist for similar functionality but it's fun code to write.
  • @lntools/bitcoind - a simple bitcoind client for RPC and Zeromq connectivity. Pretty straightforward library.
  • @lntools/chainmon - uses a bitcoind client to listen to broadcast transactions. It can be used to monitor the spending of UTXOs.
  • @lntools/gossip-rocksdb - stores gossip messages in a Rocksdb database
  • @lntools/graph - converts gossip messages into a routing graph

There are a number of other helper libraries to orchestrate a lot of this code as well. Check out the full repository with all packages and examples at https://github.com/altangent/lntools.

One of the next tasks is adding documentation to make the library more accessible. We've also been documenting our journey and hope to explain some of the implementation details of the Lighting Network in the near future.

We still have a ways to go on this project. We are big fans of open-source software and welcome contributions of any form. If you find a problem or have a question please add an issue to the repository.

Until then, enjoy Lightning Visualizer and LNTools!

Lighting Visualizer GitHub
https://github.com/altangent/lightning-viz

LNTools GitHub
https://github.com/altangent/lntools