I'm interested in finding paths from senders whose node you don't run to potential receivers. According to https://api.lightning.community/?python#queryroutes , you can do that by specifying the parameter source_pub_key to be any public key you wish and not just yours. In reality, this does not work as the querryroutes command does not support any other parameters than:


dest value: the 33-byte hex-encoded public key for the payment destination

amt value: the amount to send expressed in satoshis

fee_limit value: maximum fee allowed in satoshis when sending the payment

fee_limit_percent value: percentage of the payment’s amount used as the maximum fee allowed when sending the payment

final_cltv_delta value: number of blocks the last hop has to reveal the preimage

use_mc: use mission control probabilities

Does anyone know if there used to be a possibility of adding source_pub_key and it was removed or it never existed in the first place? More importantly, is there a way to construct paths from a source to a destination, when you don't actually run the node of the source and you don't care about actually forwarding payments and packets but rather just constructing paths according to the shortest paths algorithm of lnd.

1 Answer 1


I don't know if that possibility ever existed as an api call 8n lnd. but you can certainly call the describegraph api call to get all nodes and channels that are publically known. This json blob can easily be imported with a few lines of code as a graph in any graph library such as neo4j or networkx once the network is there you can run any pathfinding algorithm from any source to any destination. Note that due to routing fees the shortest paths should be searched from destination to sender as the feerate is dynamic and depends on the fees that will have to be paid by future nodes and not only on the payment amount

  • Thank you for the answer! The reason I seeked for the api call is because the path finding algorithms the clients use (lnd, eclair, c-lightning) are much more complicated than the default algorithms of packages like networkx use. If you are aware of any python implementation that calculates the shortest paths the way lnd does, please let me know 🙂
    – George
    Oct 2, 2019 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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