2

The most common Lightning nodes use GO, C or Scala for their implementation. Is there any publicly available Python implementation for the path finding algorithm any of the most known clients use (LND, C-Lightning, Eclair)?

2

These implementations use some form of the Dijkstra algorithm which is implemented in the open source networkx python lib https://networkx.github.io/documentation/stable/reference/algorithms/shortest_paths.html also electrum wallet is working on lightning. I think they followed pretty much the lnd code base so one could check their pathfing implementation at https://github.com/spesmilo/electrum/blob/master/electrum/lnrouter.py

  • Thank you for the great reply! The default networkX algorithms won't do because the Lightning algorithms require self defined and dynamic weights which is not supported by the library. The electrum routing is definitely helpful since the function lnrouter.py does exactly what I was looking for. However, Electrum is an entire client and it will be very tricky to isolate just the function that I want to use but it is definitely worth trying. Thanks again! – George Oct 3 '19 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.