Skip to main content

Collection of pythong classes and interfaces to integrate Pickhardt Payments to your applicatoin

Project description

Pickhardt Payments Package

The pickhardtpayments package is a collection of classes and interfaces that help you to test and implement your dialect of Pickhardt Payments into your on Lightning Application.

What are Pickhardt Payments?

Pickhardt Payments are the method of deliverying satoshis from on Lightning network Node to another by using probabilistic payment delivery in a round based payment loop that updeates our belief of the remote liquidity in the Uncertainty Network and generates optimally reliable and cheap payment flows in every round by solving a piece wise linearized min integer cost flow problem with a seperable cost function.

As of now the two main features of the cost function are the linearized_uncertainty_unit_cost (effectively proportional to 1/channel_capacity) and the linearized_routing_unit_cost (effectivly just the ppm).

Depenencies

For simplicity the library currently uses a min cost flow solver from google's ortools and internally it stores all graphs and networks in networkx. I do not recommend writing critical in production or enterprise software on top of networkx as the library is rather slow and has a huge overhead of handling memory.

The dependencies can be found at:

build and install

Onestep install is via pip by typing pip install pickhardtpayments to your command line

If 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 Code

This 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 future

from 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 & Funding

This work is funded via various sources including NTNU & BitMEX as well as many generous donors via https://donate.ln.rene-pickhardt.de or https://www.patreon.com/renepickhardt Feel free to go to my website at https://ln.rene-pickhardt.de to 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pickhardtpayments-0.0.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pickhardtpayments-0.0.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file pickhardtpayments-0.0.0.tar.gz.

File metadata

  • Download URL: pickhardtpayments-0.0.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.3

File hashes

Hashes for pickhardtpayments-0.0.0.tar.gz
Algorithm Hash digest
SHA256 ed096e29504b7eb95ad1cd204d2f2d523a4fa087ea69eeca1b2b955ea924f215
MD5 c0e757954ff8cc9261ec0ac662d876d3
BLAKE2b-256 593f9934ca3412b8fa3dbcaae20600e4e804b37b6c3c4541ea7ff549f67945b4

See more details on using hashes here.

File details

Details for the file pickhardtpayments-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pickhardtpayments-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1c069034d282c38d2641abda52f4f61386d2785e73a99fcce1eb20a547ccc23
MD5 1677ee0616ac0a44f9664f1b3c4b89d1
BLAKE2b-256 8c50825f60b4cb517b62eedd76cd4693e3670ea4a7b3204128a504b1ec40add2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page