Inspiration

After learning about the lightning network I saw that lnd has an autopilot which uses preferential attachment (the Barabasi Albert model) to make predictions for channels. I have criticised this choice in the past. After Rusty Russel mentioned that c-lightning would get a plugin system I was motivated to create an autopilot for c-lightning which turned out to be a general purpose autopilot library which can be used by other implementations as well.

What it does

  • It looks at the lightning network from the gossip store and ports it to a networkx graph (the lib_autopilot starts from a networkx graph)
  • It computes a candidate set of nodes to which a channel should be opened (Using global topology information)
  • It estimates how much value should be put to each channel
  • The recommendations are done by using 4 different probability distributions as explained in detail in the documentation of lib_autopilot.py

How I built it

With python and standard data science libraries. It should easily work with the python interpreter. I also created a small wrapper for c-lightning which uses the pylightning API wrapper for c-lightning. Christian Decker has created a c-lightning plugin wich makes the library extremely easy to use. Though I demonstrate the library in the video with the plugin I state explicitly that the plugin is not part of my submission.

Challenges I ran into

  • I could already see that especially the centrality measure does not scale well with the network size
  • Formulating everything as a probability distribution
  • Selecting a distribution for smoothing (I used uniform so far)

Accomplishments that I'm proud of

  • I separated the lib_autopilot from any c-lightning specific code so that it is usable with any implementation
  • The autopilot within the plugin is used by some node operators
  • The autopilot also suggests balances for the channels
  • The autopilot smoothes the probability distributions and uses cutoffs to just sample from the biggest part of the probability mass
  • lib_autopilot could be build in 430 well documented lines of code which surprised me in its compactness.

What I learned

  • One does not need to know much about the lightning network to create useful add ons or tools.
  • It is fairly easy to build on top of lightning
  • (basically knew this before) Graph computations are heavy and we need to find better solutions with a growing lightning-network

What's next for Lightning Network Autopilot

  • The centrality measure should be computed on the fee graph instead of the friendshipgraph
  • Exchange networkx with neo4j
  • Create a wrapper for lnd / eclair

Built With

  • networkx-numpy-python
Share this project:

Updates