Package: pickhardtpayments
Pickhardt Payments PackageThepickhardtpaymentspackage is a collection of classes and interfaces that help you to test and implement your dialect ofPickhardt Paymentsinto your on Lightning Application.What are Pickhardt Payments?Pickhardt Payments are the method of deliverying satoshis from on Lightning network Node to another by usingprobabilistic payment deliveryin a round basedpayment loopthat updeates ourbeliefof the remoteliquidityin theUncertainty Networkand generatesoptimally reliable and cheap payment flowsin every round by solving apiece wise linearized min integer cost flow problemwith a seperable cost function.As of now the two main features of the cost function are thelinearized_uncertainty_unit_cost(effectively proportional to1/channel_capacity) and thelinearized_routing_unit_cost(effectivly just theppm).DepenenciesFor simplicity the library currently uses a min cost flow solver from google'sortoolsand internally it stores all graphs and networks innetworkx.
I do not recommend writing critical in production or enterprise software on top ofnetworkxas the library is rather slow and has a huge overhead of handling memory.The dependencies can be found at:https://github.com/networkxhttps://github.com/google/or-toolsbuild and installOnestep install is via pip by typingpip install pickhardtpaymentsto your command lineIf you want to build and install the library yourself you can do:git clone https://github.com/renepickhardt/pickhardtpayments.git
cd pickhardtpayments
python -m build
pip install -e .Example CodeThis is a very stripped down example that shows how to run the library.
Have a look at the example folder to find a longer version and more examples for the futurefrom pickhardtpayments.ChannelGraph import ChannelGraph
from pickhardtpayments.UncertaintyNetwork import UncertaintyNetwork
from pickhardtpayments.OracleLightningNetwork import OracleLightningNetwork
from pickhardtpayments.SyncSimulatedPaymentSession import SyncSimulatedPaymentSession


#we first need to import the chanenl graph from c-lightning jsondump
#you can get your own data set via:
# $: lightning-cli listchannels > listchannels20220412.json
# alternatively you can go to https://ln.rene-pickhardt.de to find a data dump
channel_graph = ChannelGraph("listchannels20220412.json")

uncertainty_network = UncertaintyNetwork(channel_graph)
oracle_lightning_network = OracleLightningNetwork(channel_graph)
#we create ourselves a payment session which in this case operates by sending out the onions
#sequentially 
payment_session = SyncSimulatedPaymentSession(oracle_lightning_network, 
                                 uncertainty_network,
                                 prune_network=False)

#we need to make sure we forget all learnt information on the Uncertainty Nework
payment_session.forget_information()

#we run the simulation of pickhardt payments and track all the results

#Rene Pickhardt's public node key
RENE = "03efccf2c383d7bf340da9a3f02e2c23104a0e4fe8ac1a880c8e2dc92fbdacd9df"
#Carsten Otto's public node key
C_OTTO = "027ce055380348d7812d2ae7745701c9f93e70c1adeb2657f053f91df4f2843c71"
tested_amount = 10_000_000 #10 million sats

payment_session.pickhardt_pay(RENE,C_OTTO, tested_amount,mu=0,base=0)Acknowledgements & FundingThis work is funded via various sources includingNTNU&BitMEXas well as many generous donors viahttps://donate.ln.rene-pickhardt.deorhttps://www.patreon.com/renepickhardtFeel free to go to my website athttps://ln.rene-pickhardt.deto learn how I have been contributing to the open source community and why it is important to have independent open source contributors. In case you also wish to support me I will be very grateful