From 70f911351de44b1ba344041376425b6b867460b5 Mon Sep 17 00:00:00 2001 From: Rene Pickhardt Date: Mon, 28 Mar 2022 19:34:33 +0200 Subject: [PATCH 1/3] added an early draft and WIP of the simulation tool so that some people can review it. Please do not share this code yet or copy widely from it. please give me feedback so that I can merge a refactored and cleaner version to the main branch --- Pickhardt-Payments-Simulation.ipynb | 1807 +++++++++++++++++++++++++++ 1 file changed, 1807 insertions(+) create mode 100644 Pickhardt-Payments-Simulation.ipynb diff --git a/Pickhardt-Payments-Simulation.ipynb b/Pickhardt-Payments-Simulation.ipynb new file mode 100644 index 0000000..b846540 --- /dev/null +++ b/Pickhardt-Payments-Simulation.ipynb @@ -0,0 +1,1807 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This is an educational simulation to demonstrate how to implement the main concepts of [probabilistic payment delivery with the additional maintainance of the uncertainty network](https://arxiv.org/abs/2103.08576) and [optimal splitting of payments in MPP which is also known as optimally realiable payment flows](https://arxiv.org/abs/2107.05322)\n", + "\n", + "This code assumes an oracle with the actual liquidity of channels to exist. In reality the oracle is the lightning network which can be queried by sending out actual onions.\n", + "\n", + "## Warning: THIS IS WORK IN PROGRESS: The code has some severe limitations...\n", + "...which make it impractical for real nodes and implementations. Do not just blindly wrap this into production code but address the following limitations:\n", + "\n", + "* channel reserves are ignored\n", + "* HTLC limits like min_size, max_size, max_accepted_htlc are fully ignored\n", + "* proper handling of parallel channels needs to be done\n", + "* strategies to operate with hanging htlc's (some might require protocol updates) may need to be included\n", + "* concurrent handeling of onions and maintanance of the uncertainty network\n", + "* proper handling of non zero base fee channels is needed and in particular handeling their cost properly at least as good as it is possible\n", + "* better piecewise splitting / quantization of the amounts is necessary\n", + "* learning how to weight various features needs to be conducted or at least configureably be in place\n", + "* Mechanics of making learnt information persistant over some time\n", + "* inclusion of other otpimization goals that predict reliability are missing (like latency, distance, ...)\n", + "* One should Prune the graph before invoking the solver\n", + "* properly conduct the piecewise linearization of the cost function\n", + "* don't overwrite memory of the entire uncertainty network all the time but just update the necessary pieces before invoking the solver\n", + "* potentially write your own stand alone cost scaling min cost flow solver instead of relying on a third party dependency\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## BOLT14 considerations\n", + "\n", + "This code also contains a few experiments to investigate the effects of the BOLT14 proposal.\n", + "Maybe it might make sense to make entropy hints not only as a foaf query but as an n-bit network wide gossip message. Unless we have some prior belief about the channel the 2 bit gossip intervalls are\n", + "\n", + "* [0, c/4]\n", + "* [c/4,c/2]\n", + "* [c/2,3c/4]\n", + "* [3c/4,c]\n", + "\n", + "nodes would only signal a message if the liquidity switches from one of those intervals to another (of course one could also require 3 bits or so)\n", + "\n", + "## TODOS: \n", + "as hinted in the ldk issue https://github.com/lightningdevkit/rust-lightning/issues/1372 it might make sense to not use a global \\mu but rather learn it for each channel by comparing min uncertainty cost ~ 1/c max uncertainty cost = log(c+1) with the ppm on the edge and make sure we get this in the same order. It is only a test but it might turn out to work really well\n", + "\n", + "fix some fixme's most notably the data model that produces poor probability computation in outputs as it ignors the prior knowlege which means all displayed probabilities are too low (though the flow is computed properly)\n", + "\n", + "make a useful design for liquidity sharing...\n", + "\n", + "# Funding\n", + "\n", + "This research result is funded through [NTNU](https://www.ntnu.no) and [BitMEX](https://blog.bitmex.com/bitmex-2021-open-source-developer-grants/) as well as generous donations from the Bitcoin community via https://donate.ln.rene-pickhardt.de and via recurring donations at https://www.patreon.com/renepickhardt. If you want to learn why independent research and development for Bitcoin and the Lightning Network is important I kindly refer you to: https://ln.rene-pickhardt.de/ of course I will be grateful if you consider my work of importance and decide to support it.\n", + "\n", + "Special Thanks to Stefan Richter with whom we implemented the first mainnet tests on top of lnd which certainly helped me to clarify many details and get the maintanance of the uncertainty network straight." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Glossary of terms\n", + "\n", + "As many similar terms are being used for similar concepts and things and since I have been studying these topics for three years now I will follow the good practice of [BOLT0](https://github.com/lightning/bolts/blob/master/00-introduction.md) and put a glossary of used terms up here with the hope that I finally have some good, useful and precise defintions that will also bee picked up by others.\n", + "\n", + "\n", + "## (Payment) Channel\n", + "Payment `channel`s are either announced or unnannounced but known to the sender and recpient of a payment. They have meta data like the `capacity` or `routing fees` as well as some other config values which we ignore for simplicity here.\n", + "\n", + "## Arc\n", + "An `arc` is not to be confused with a payment `channel`. `Arc`s are the data structure that arise from the piece wise linearized `cost function` and are used internally in the min cost flow solver. \n", + "\n", + "\n", + "## (Channel) Capacity\n", + "The `capacity` of a payment channel is its size as observed in the amount of the output of the funding transaction which is announced via the `short_channel_id` in gossip.\n", + "\n", + "**Important**: It seems to be an unavoidable collision that the term capacity is also used for `arcs` in min cost flow solvers. As I introduce the piece wise linearization the `cost function` the arcs in the min cost flow solve will usually have a lower `capacity` than the cannels they represent. I try to distinguish this by talking either about the `channel capacity` or the `arc capacity` if absolutely necessary.\n", + "\n", + "## Liquidity\n", + "The `Liquidity` is the amount of satoshis a peer has available to route on it's channel. This means that unless the (even) `capacity` is split exactly 50/50 between the peers the `liquidity` in a channel will be different for both peers. \n", + "\n", + "typical terms in the wild: balance, local balance, outbound capacity\n", + "\n", + "## Uncertainty / Entropy \n", + "assuming a prior probability distribution we can quantify the `uncertainty` about the channels `liquidity` by measureing the `entropy` of the probability function. Notably if a channel as a `capacity` of `c` satoshis the entropy is `log(c+1)`\n", + "\n", + "## Unertainty Network\n", + "\n", + "The `uncertainty network` is a model than encodes our current belief about the available `liquidity` in the channels of the Lightning network. This is usually achieved by storing three values: \n", + "\n", + "1. Minimum `liquidity` which initialy for remote channel is `0`. \n", + "2. Maximum `liquidity` which initially for remote channels corresponds its `capacity`.\n", + "3. `inflight` is the number of satoshis that we currently have allocated to this channel in outstanding onions and HTLCs.\n", + "\n", + "## inflight\n", + "We use `inflight` to encode how many satoshis we have currently allocated or plan to allocate to a channel. Note that this is not the same as the number of inflight htlcs that the peer co-owning the channel will observe as some of the onions that we have outstanding may not have been delivered to the channel yet or may have failed but not returend back to us yet.\n", + "\n", + "## Cost(function)\n", + "\n", + "The `cost` function encodes our optimization goals and consists of several `features`. typical `features` are the `uncertainty cost` and the `routing fees`. Note that the same cost function can be applied to Dijkstra's algorithm as to min cost flow solvers. However in the general case of min cost flows the cost function should be convex or even better linear or piecewise linear so that a reasonable runtime can be achieved. \n", + "\n", + "The `cost` is just an internal value that will be minimized in computation of `candidate paths` for the `payment loop`. This cost may or may not translate to `routing fees`.\n", + "\n", + "typical terms in the wild: Score, fees, penalty\n", + "\n", + "## Unit cost\n", + "Linear min cost flow solvers need a fixed cost for transporting 1 unit (e.g. 1 satoshi) along an `arc` (e.g. `channel`). Oft\n", + "\n", + "## Uncertainty cost\n", + "This is the `feature` introduced in the [`probablistic payment delivery` paper](https://arxiv.org/abs/2103.08576) it puts a cost on an amount `a` to be send over a (`path`) of `payment channels`.\n", + "It is comuted by taking the negative logarithm of the `success probability` if we have no prior belief of the channel the `uncertainty cost` will be computed as: `-log((c+1-a)/(c+1))`. Note that the uncertainty cost is a convex gowing function takin the value `0 = -log((c+1-0)/(c+1)) = -log(1)` if no sats are to be allocated on the channel. The maximum possible `uncertainty cost` occurs if `a=c` and takes the value `log(c+1)` which is exactly the `entropy` of the channel which can be seen by the following calculation:\n", + "`-log((c+1-c)/(c+1)) = -log(1/(c+1)) = log(c+1)`\n", + "\n", + "### linearized uncertainty cost\n", + "The linearized uncertainty cost is the first term of the taylor approximation of `f(a)=-log((c+1-a)/(c+1))` which results in `a/(c+1)`. This (in my opinion surprisingly) corresponds to the failure probability. Note that we should not interpret it as such as it does not make sense to add probabilities while those feature will be added in the global `cost function` of the min cost flow solvers. \n", + "\n", + "This results in a `unit` cost of `1/(c+1)`. since integers are preferable we multiply the unit cost with the maximum observed channel `capacity` of all channels and ignoring the decimals. \n", + "\n", + "Thus the **final integer linearized uncertainty unit cost** is: `int(c_{max}/(c+1))`\n", + "\n", + "## (routing) fees\n", + "\n", + "The routing `fee` is a feature that usually corresponds directly to the fees that are being charged to forward a payment of size `a` along a channel. According to the protocol it is currently being computed as: \n", + "\n", + "`fee(a) = a*ppm/1000 + base_fee_msat`\n", + "\n", + "## linearized fees\n", + "\n", + "As discussed in our research and on the mailinglist the fee function of the lightning network is not linear. In the mentioned discussion one can see that `fee(a+b) = fee(a)+fee(b) - base_fee_msat` which is linear if and only if `base_fee_msat = 0`. \n", + "\n", + "Thus in computation we currently linearize the `fee` function by ignoring the `base fee` so we use `fee(a) = a*ppm/1000` giving us a `unit cost` of `ppm/1000` \n", + "\n", + "As min cost flow solvers prefer integer cost we scale by `1000` and arrive at the **final integer linearized fee unit cost** which is just the: `ppm`. \n", + "\n", + "For this to work good enough we might also take channel that charge a very small `base_fee` and later just pay it when we send the onions.\n", + "\n", + "\n", + "## Features\n", + "\n", + "The `features` of our cost function encode our optimization goals. Typicalfeatures goals might be to have a cheap price (usually encoded by `fee`) or to have a high reliability (in this work best encoded by the `uncertainty cost`that comes from the estimated `success probability` that the channel has enough `liquidity`. Other features that seam reasonable are things related to `latency` of payments (e.g. [pyhsical geodistance or virtaul IP-distance as indicted in this comment](https://github.com/lightningdevkit/rust-lightning/issues/1170)). Implementations have also experimented with other features like CLTV delta or channel age. \n", + "\n", + "Feature engineering is a crucial part for future research \n", + "\n", + "## Success Probability\n", + "\n", + "The definition of the `success probability` is in our case modelled by estimating the likelihood that a channel with a `capacity` of `c` has `a` sats of `liquidity` available. \n", + "\n", + "In the base case where we have not learnt anything about the channel's `liquidity` in the past the `success probability` for making a payment of size `a` stays at `P(X>=a) = (c+1-a)/(c+1)`\n", + "\n", + "Let's say a payment delivery algorithm sends an onion via a path of channel and wants to add an HTLC with amount `h` to a channel of capacity `c` there are several cases that we can observe to update our uncertainty about the network for future payments of size `a`\n", + "\n", + "1. Payment failed at the channel: This means the channel of capacity `c` has at most `h-1` satoshi in it. In Terms of Probability theory we can ask ourselves what is the success rate for a subsequent payment of size `a` given the event `X=a | X=h` the proabbility has to be `0`. Computing the conditional probability for the remainder in the uniform case we can se `P(X>=a | X < h) = (h-a)/h`. Note that this is the same as the success probability for a channel of capacity `h-1`. \n", + "2. Payment failed at a downstream channel: This means that the channel of capcity `c` was able to route `h` satoshi and has at least a minimum `liquidity` of `h`. This means that `P(X>=a | X>=h) = 1` for all amounts `a <=h` and in the unform case for all larger values of `a` the conditional probability materializes to: `P(X>=a)/P(X>=h) = ((c+1-a)/(c+1))/((c+1-h)/(c+1)) = (c+1-a)/(c+1-h)` Note that this fraction is always smaller than `1` as `a >=h`\n", + "3. The case that the payment was successfull or did not return an error: Following the same thoughts and the first bullet point at the end of section 3 in the second paper we know that for a future payment of size `a` we have to look at `P(X>=a + h | X >=h)` which in the uniform case materializes to `( (c-h) + 1 - a)/( (c - h) + 1)`. Note that this is the same as if the channel shrunk from `c` to `c-h` as we now know that the maximum `liquidity` is not `c` but rather `c-h`\n", + "\n", + "\n", + "## optimal payment flow / optimal mpp split\n", + "\n", + "We call a payment flow optimal if it minimizes the `cost function` that encodes our optimization goals. Note that the solution of the min cost flow problem also defines a split of the payment across various paths. While simple algorithms for discecting a flow into paths exist the actual disection is not uique and needs further research. Especially when we start taking channel configurations into account.\n", + "\n", + "## Payment Loop\n", + "\n", + "The payment loop is the trial and error process of delivering a certain amount of satoshis from a sending node to a recipient. This is usually done by generating a set of candidate onions from the solution of an `optimal payment flow`. The onions are concurrently being sent out and error are being used to update our belief about the `liquidity` in the `uncertainty network`.\n", + "\n", + "## Probabilistic Payment Delivery\n", + "\n", + "The idea of `probabilistic payment delivery` is to send onions that maximize the success proabbility for all (or parts of them) to be successul. This takes the `uncertainty` about the remote `liquidity` into consideration and was first introduced in path finding (Note I did not use the term path findng nore did I put it in the glossary)\n", + "\n", + "## Pickhardt Payments\n", + "As the term is more and more starting to flow around I will try to summarize best what is currently from a technial point of view meant by it: \n", + "\n", + "`Using probabilistic payment delivery` in a round based `payment loop` that updeates our belief of the remote `liquidity` in the `uncertainty network` and generates reliable and cheap `payment flows` in every round by solving a `piece wise linearized min integer cost flow problem with a seperable cost function` (I start to see why a shorter term was needed)." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from ortools.graph import pywrapgraph\n", + "import time\n", + "import random\n", + "import networkx as nx\n", + "import json\n", + "from math import log2 as log" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "def next_hop(path):\n", + " \"\"\"\n", + " generator to iterate through edges indext by node id of paths\n", + " \n", + " The path is a list of node ids. Each call returns a tuple src, dest of an edge in the path \n", + " \"\"\"\n", + " for i in range(1,len(path)):\n", + " src = path[i-1]\n", + " dest = path[i]\n", + " yield (src,dest)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "class Channel:\n", + " \"\"\"\n", + " The channel class contains basic information of a channel that will be used to create the\n", + " Uncertainty network.\n", + " \n", + " Since we optimize for reliability via a probability estimate for liquidity that is based\n", + " on the capacity of the channel the class contains the `capacity` as seen in the funding tx output.\n", + " \n", + " As we also optimize for fees and want to be able to compute the fees of a flow the classe\n", + " contains information for the feerate (`ppm`) and the base_fee (`base`). \n", + " \n", + " Most importantly the class stores our belief about the liquidity information of a channel.\n", + " This is done by reducing the uncertainty interval from [0,`capacity`] to \n", + " [`min_liquidity`, `max_liquidity`].\n", + " Additionally we need to know how many sats we currently have allocated via outstanding onions\n", + " to the channel which is stored in `inflight`.\n", + " \n", + " the `key` field is necessary to map the channel to its corresponding arcs in the minc cost flow solver\n", + " \n", + " FIXME: the class does not contain min_htlc_size, channel_reserve or other meta data from gossip yet.\n", + " \"\"\"\n", + " def __init__(self,size,key,ppm,base):\n", + " self.__key=key\n", + " self.__ppm=ppm\n", + " self.__base=base\n", + " self.__capacity=size\n", + " self.__minLiquidity=0\n", + " self.__maxLiquidity=size\n", + " self.__inflight = 0\n", + " \n", + " def __str__(self):\n", + " return \"Size: {} with {:4.2f} bits of Entropy. Uncertainty Interval: [{},{}]\".format(self.__capacity, self.entropy(), self.__minLiquidity, self.__maxLiquidity)\n", + "\n", + " def get_key(self):\n", + " return self.__key\n", + " \n", + " def get_capacity(self):\n", + " return self.__capacity\n", + " \n", + " def get_ppm(self):\n", + " return self.__ppm\n", + " \n", + " def get_base(self):\n", + " return self.__base\n", + " \n", + " def get_max_liquidity(self):\n", + " return self.__maxLiquidity\n", + "\n", + " def get_min_liquidity(self):\n", + " return self.__minLiquidity\n", + " \n", + " def forget_information(self):\n", + " \"\"\"\n", + " resets the information that we belief to have about the channel. \n", + " \"\"\"\n", + " self.__minLiquidity=0\n", + " self.__maxLiquidity=self.__capacity\n", + " self.__inflight = 0\n", + " \n", + " def set_min_liquidity(self,value):\n", + " self.__minLiquidity=value\n", + " \n", + " def set_max_liquidity(self,value):\n", + " self.__maxLiquidity=value\n", + "\n", + " def allocate_amount(self,amt):\n", + " self.__inflight += amt\n", + " return\n", + " \n", + " def entropy(self):\n", + " \"\"\"\n", + " returns the uncertainty that we have about the channel\n", + " \n", + " FIXME: Do we have to respect inflight information? I assume no.\n", + " \"\"\"\n", + " return log(self.__maxLiquidity - self.__minLiquidity + 1)\n", + " \n", + " def success_probability(self,amt):\n", + " \"\"\"\n", + " returns the estimated success probability for a payment based on our belief about the channel using a uniform distribution.\n", + "\n", + " In particular the conditional probability P(X>=a | min_liquidity < X < max_liquidity)\n", + " is computed based on our belief also respecting how many satoshis we have currently \n", + " outstanding and allocated.\n", + " \n", + " FIXME: Potentially test other prior distributions like mixedmodels where most funds are on one side of the channel\n", + " \"\"\"\n", + " tested_liquidity = amt + self.__inflight\n", + "\n", + " if tested_liquidity <= self.__minLiquidity:\n", + " return 1.0\n", + " elif amt >= self.__maxLiquidity:\n", + " return 0\n", + " else: \n", + " conditional_amount = tested_liquidity - self.__minLiquidity\n", + " conditional_capacity = self.__maxLiquidity - self.__minLiquidity\n", + " return float(conditional_capacity + 1 - conditional_amount)/ (conditional_capacity + 1)\n", + " \n", + " \n", + " \"\"\"\n", + " This is how it would be computed without respecting in_flight information \n", + " \n", + " if amt <= self.__minLiquidity:\n", + " return 1.0\n", + " elif amt >= self.__maxLiquidity:\n", + " return 0\n", + " else:\n", + " \n", + " effective_amount = amt - self.__minLiquidity\n", + " effective_capacity = self.__maxLiquidity - self.__minLiquidity\n", + " return float(effective_capacity+1 - effective_amount)/ (effective_capacity+1)\n", + " \"\"\"\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "class OracleChannel(Channel):\n", + " \"\"\"\n", + " The Oracle channel inherits from the channel and is used for our simulation to act as the Oracle\n", + " \n", + " The Oracle channel has assigned liquidity information about a payment channel and can be tested \n", + " against. Note that on mainnet the actual channels act as oracles as one tests them by sending out\n", + " onions. For the simulation we just create ourselves an `known_liquidity_network` as an oracle.\n", + " (Note in the optimally reliable payment flows paper we still called this the known balance graph\n", + " however we retracted from using the term balance.)\n", + " \n", + " \n", + " \"\"\"\n", + " def __init__(self,size,key,ppm,base,actual_liquidity=None):\n", + " super().__init__(size,key,ppm,base)\n", + " self.__actual_liquidity=actual_liquidity\n", + " if actual_liquidity is None or actual_liquidity >= size or actual_liquidity < 0:\n", + " self.__actual_liquidity = random.randint(0,size)\n", + " def __str__(self):\n", + " return super().__str__()+\" actual Liquidity: {}\".format(self.__actual_liquidity)\n", + " \n", + " def update_knowledge(self,amt):\n", + " \"\"\"\n", + " updates our knowledge about the channel if we tried to probe it for amount `amt`\n", + " \"\"\"\n", + " if amt <= self.__actual_liquidity:\n", + " self.set_min_liquidity(max(self.get_min_liquidity(),amt))\n", + " return True\n", + " else:\n", + " self.set_max_liquidity(min(self.get_max_liquidity(), amt))\n", + " return False\n", + " \n", + " #needed for BOLT14 test experiment\n", + " def learn_n_bits(self,n):\n", + " \"\"\"\n", + " conducts n probes of channel via binary search starting from our belief\n", + " \n", + " This of course only learns `n` bits if we use a uniform success probability as a prior\n", + " thus this method will not work if a different prior success probability is assumed \n", + " \"\"\"\n", + " if n <= 0:\n", + " return\n", + " amt = self.get_min_liquidity() + int((self.get_max_liquidity() - self.get_min_liquidity())/2)\n", + " self.update_knowledge(amt)\n", + " self.learn_n_bits(n-1)\n", + " \n", + " def get_actual_liquidity(self):\n", + " \"\"\"\n", + " Tells us the actual liquidity according to the oracle. \n", + " \n", + " This is usful for experiments but must of course not be used in routing and is also\n", + " not a vailable if mainnet remote channels are being used.\n", + " \"\"\"\n", + " return self.__actual_liquidity" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "class Oracle:\n", + " def __init__(self,):\n", + " return \n", + " \n", + " def get_max_cap(self):\n", + " \"\"\"\n", + " returns the maximum capacity on the channel graph\n", + " \n", + " This is necessary to produce integer costs for the linearized uncertainty cost\n", + " \"\"\"\n", + " return self.__max_cap\n", + " \n", + " def reset_uncertainty_network(self):\n", + " \"\"\"\n", + " Forgets all learnt information on the uncertainty network. \n", + " \n", + " This is usful to resuse the same data from the oracle between various experiments\n", + " \"\"\"\n", + " for key in self.__arcs.keys():\n", + " self.__arcs[key].forget_information()\n", + " \n", + " def __get_channel_json(self,fp):\n", + " #$ lightning-cli listchannels > listchannels20211028.json\n", + " f = open(fp)\n", + " return json.load(f)[\"channels\"]\n", + " \n", + " def __prepare_integer_indices_for_nodes(self,channels):\n", + " \"\"\"\n", + " necessary for the OR-lib by google and the min cost flow solver\n", + " \"\"\"\n", + " # let's first find all node_ids \n", + " # so that we can build the look up table and use integer unit costs\n", + "\n", + " node_ids = set()\n", + " for c in channels:\n", + " src = c[\"source\"]\n", + " dest = c[\"destination\"]\n", + " node_ids.add(src)\n", + " node_ids.add(dest) \n", + "\n", + " # let's initialize the look up tables for node_ids to integers from [0,...,#number of nodes]\n", + " # this is necessary because of the API of the Google Operations Research min cost flow solver\n", + " self.__node_key_to_id = {}\n", + " self.__id_to_node_key = {}\n", + " for k, node_id in enumerate(node_ids):\n", + " self.__node_key_to_id[node_id]=k\n", + " self.__id_to_node_key[k]=node_id\n", + " \n", + " def import_channels(self,fp):\n", + " \"\"\"\n", + " This function does all the magic! \n", + " \n", + " It starts by importing the channel_graph from c-lightning listchannels command and then \n", + " it goes through the channels to find all node ids and max capacity (to make integer uncertainty cost)\n", + " in a second pass it goes over all channels and adds arcs to the modelled linearized network\n", + " for each channel N arcs are being added with increasing unit costs to mimic the convex behavior\n", + " the piecewise dissection is not optimal nor is the linear approximation of negative log probs exact\n", + " however this does not matter for the sake of argument the runtime will not change if the costs\n", + " are chosen a bit more optimally. But the code will blow up thus those simplifications\n", + " \"\"\"\n", + "\n", + " channels = self.__get_channel_json(fp)\n", + " self.__prepare_integer_indices_for_nodes(channels)\n", + "\n", + " self.__max_cap = 0\n", + " for c in channels:\n", + " cap = c[\"satoshis\"]\n", + " if cap > self.__max_cap:\n", + " self.__max_cap = cap\n", + "\n", + " self.__arcs = {}\n", + " self.__parallel = {}\n", + " for c in channels:\n", + " cap = c[\"satoshis\"]\n", + " sid = c[\"short_channel_id\"]\n", + "\n", + " src = self.__node_key_to_id[c[\"source\"]]\n", + " dest = self.__node_key_to_id[c[\"destination\"]]\n", + " cap = c[\"satoshis\"]\n", + "\n", + " key = \"{}x{}x{}\".format(src,dest,sid)\n", + " base = c[\"base_fee_millisatoshi\"]\n", + " ppm = c[\"fee_per_millionth\"]\n", + " self.__arcs[key]=OracleChannel(cap,key,ppm,base)\n", + " arc = \"{}x{}\".format(src,dest)\n", + " if arc in self.__parallel:\n", + " self.__parallel[arc].append(key)\n", + " else:\n", + " self.__parallel[arc] = [key]\n", + "\n", + "\n", + " def arcs_to_networkx(self,base_threshold = None):\n", + " \"\"\"\n", + " stores the arcs also in networkx for fee computation and display of probabilities\n", + " \n", + " FIXME: it should actually be the other way around. First store the channel graph in \n", + " networkx and then compute the piece wise linearized arcs from this\n", + " \"\"\"\n", + " self.__channel_graph = nx.MultiDiGraph()\n", + " for channel in self.__arcs.values():\n", + " src, dest, height, index, out = channel.get_key().split(\"x\")\n", + " if base_threshold is not None:\n", + " if channel.get_base() > base_threshold:\n", + " continue\n", + " self.__channel_graph.add_edge(int(src),int(dest),capacity=channel.get_capacity(),base=channel.get_base(),ppm=channel.get_ppm())\n", + " \n", + "\n", + " \n", + " def theoretical_maximum_payable_amount(self, source, destination):\n", + " \"\"\"\n", + " Uses the information from the oracle to compute the min-cut between source and destination\n", + " \n", + " This is only useful for experiments and simulations if one wants to know what would be \n", + " possible to actually send before starting the payment loop\n", + " \"\"\"\n", + " self.__channel_graph = nx.MultiDiGraph()\n", + " for channel in self.__arcs.values():\n", + " src, dest, height, index, out = channel.get_key().split(\"x\")\n", + " if base_threshold is not None:\n", + " if channel.get_base() > base_threshold:\n", + " continue\n", + " self.__channel_graph.add_edge(int(src),int(dest),capacity=channel.get_actual_liquidity(),base=channel.get_base(),ppm=channel.get_ppm())\n", + " \n", + " self.__G = nx.DiGraph()\n", + " for u,v,data in self.__channel_graph.edges(data=True):\n", + " if not self.__G.has_edge(u,v):\n", + " capacity = sum(d.get('capacity') for d in self.__channel_graph.get_edge_data(u,v).values())\n", + " self.__G.add_edge(u, v, capacity=capacity)\n", + " \n", + " mincut, _ = nx.minimum_cut(self.__G, self.__node_key_to_id[source], self.__node_key_to_id[destination])\n", + " return mincut\n", + " \n", + " def get_probability(self,src,dest,amt):\n", + " #FIXME: handle multi edges properly\n", + " #if not self.__channel_graph.has_edge(src,dest):\n", + " capacity = sum(d.get('capacity') for d in self.__channel_graph.get_edge_data(src,dest).values())\n", + " #else:\n", + " # capacity = self.__channel_graph[src][dest][\"capacity\"]\n", + " if amt > capacity:\n", + " print(src,dest,self.__channel_graph.get_edge_data(src,dest))\n", + " return float(capacity+1-amt)/(capacity+1)\n", + "\n", + " \n", + " def get_fees_msat(self,src,dest,amt):\n", + " #FIXME: handle multi edges properly\n", + " ppm = min(d.get('ppm') for d in self.__channel_graph.get_edge_data(src,dest).values())\n", + " base = min(d.get('base') for d in self.__channel_graph.get_edge_data(src,dest).values())\n", + " return int(base + float(amt * ppm)/1000) \n", + " \n", + " def test_path(self,path,amt):\n", + " probability = 1\n", + " fees = 0\n", + " success = True\n", + " for src,dest in next_hop(path):\n", + " fees += self.get_fees_msat(src,dest,amt)\n", + " probability *= self.get_probability(src,dest,amt)\n", + " key = \"{}x{}\".format(src,dest)\n", + " #FIXME: do not just take the first parallel channel\n", + " arc_key = self.__parallel[key][0]\n", + " if success:\n", + " success = self.__arcs[arc_key].update_knowledge(amt)\n", + " \n", + " return success, fees, probability\n", + " \n", + " def allocate_path(self,path,amt):\n", + " t,_,_ = self.test_path(path,amt)\n", + " if t == False:\n", + " return False\n", + " for src,dest in next_hop(path):\n", + " key = \"{}x{}\".format(src,dest)\n", + " #FIXME: do not just take the first parallel channel\n", + " arc_key = self.__parallel[key][0]\n", + " if success:\n", + " success = self.__arcs[arc_key].allocate_amount(amt)\n", + " \n", + " \n", + " def get_arcs(self):\n", + " return self.__arcs\n", + " \n", + " def look_up_id(self,node_id):\n", + " return self.__node_key_to_id[node_id]\n", + " \n", + " def get_uncertainty_network(self,start_node,mu,threshold_base =None):\n", + " #FIXME: find mu\n", + " start_node = self.__node_key_to_id[start_node]\n", + "\n", + " max_cap = oracle.get_max_cap()\n", + " used_arcs = []\n", + " for key, channel in self.__arcs.items():\n", + " base = channel.get_base()\n", + " if threshold_base is not None:\n", + " if base > threshold_base:\n", + " continue\n", + "\n", + " cap = channel.get_capacity()\n", + " src,dest,_,_,_ = channel.get_key().split(\"x\")\n", + " src = int(src)\n", + " dest = int(dest)\n", + "\n", + " is_own_channel = False\n", + " if src == start_node:\n", + " is_own_channel=True\n", + " \n", + " #FIXME: might need a fix if we account for HTLCs in flight but I guess this is just reduced from actual liqudity\n", + " if is_own_channel: #we know exactly how much liquidity we have in our channels\n", + " channel.set_min_liquidity(channel.get_actual_liquidity())\n", + " channel.set_min_liquidity(channel.get_actual_liquidity())\n", + "\n", + " conditional_capacity = channel.get_max_liquidity() - channel.get_min_liquidity()\n", + " min_liquidity = channel.get_min_liquidity()\n", + " ppm = channel.get_ppm()\n", + " \n", + " if is_own_channel: #we don't have to pay ppm on our own channels\n", + " ppm = 0\n", + " \n", + " n = N\n", + " \n", + " #FIXME: prune expensive and unlikeli channels\n", + " #FIXME: compute smarter linearization eg: http://www.iaeng.org/publication/WCECS2008/WCECS2008_pp1191-1194.pdf \n", + " #using certainly available liquidity costs us nothing but fees\n", + " if int(min_liquidity/QUANTIZATION) > 0:\n", + " used_arcs.append((src,dest,int(min_liquidity/QUANTIZATION),0 + mu*ppm))\n", + " n-=1\n", + "\n", + " # FIXME: include the \n", + " if int(conditional_capacity/QUANTIZATION) > 0:\n", + " unit_cost = int(max_cap/conditional_capacity)\n", + " for i in range(n):\n", + " #arc format is src, dest, capacity, unit_cost\n", + " # THIS IS THE IMPORTANT LINE OF CODE WHERE THE MAGIC HAPPENS\n", + " used_arcs.append((src,dest,int(conditional_capacity/(N*QUANTIZATION)),(i+1)*unit_cost +mu* ppm))\n", + " return used_arcs\n", + " \n", + " ##############################################################\n", + " #\n", + " # needed for FOAF liquidity sharing (BOLT 14 proposal) \n", + " #\n", + " ##############################################################\n", + "\n", + " def entropy(self):\n", + " return sum(arc.entropy() for _,arc in self.__arcs.items())\n", + " \n", + " \n", + " def activate_network_wide_uncertainty_reduction(self,n):\n", + " for arc in self.__arcs.values():\n", + " arc.learn_n_bits(n)\n", + " \n", + " def activate_foaf_uncertainty_reduction(self,src,dest):\n", + " ego_netwok=set()\n", + " foaf_network = set()\n", + "\n", + " out_set = set()\n", + " edges = self.__channel_graph.out_edges(self.__node_key_to_id[src])\n", + " for edge in edges:\n", + " ego_netwok.add(\"{}x{}\".format(edge[0],edge[1]))\n", + " out_set.add(edge[1])\n", + " \n", + " for node in out_set:\n", + " edges = self.__channel_graph.out_edges(node)\n", + " for edge in edges:\n", + " foaf_network.add(\"{}x{}\".format(edge[0],edge[1]))\n", + "\n", + " in_set = set()\n", + " edges = self.__channel_graph.in_edges(self.__node_key_to_id[dest])\n", + " for edge in edges:\n", + " ego_netwok.add(\"{}x{}\".format(edge[0],edge[1]))\n", + " in_set.add(edge[0])\n", + " \n", + " for node in in_set:\n", + " edges = self.__channel_graph.out_edges(node)\n", + " for edge in edges:\n", + " foaf_network.add(\"{}x{}\".format(edge[0],edge[1]))\n", + " \n", + " \n", + " #print(len(ego_netwok))\n", + " for k,arc in self.__arcs.items():\n", + " #print(k)\n", + " vals = k.split(\"x\")\n", + " key = \"{}x{}\".format(vals[0],vals[1])\n", + " if key in ego_netwok:\n", + " l = arc.get_actual_liquidity()\n", + " arc.update_knowledge(l-1)\n", + " arc.update_knowledge(l+1)\n", + " #print(key,arc.entropy())\n", + " \n", + " if key in foaf_network:\n", + " arc.learn_n_bits(2)\n", + " l = arc.get_actual_liquidity()\n", + " arc.update_knowledge(l-1)\n", + " arc.update_knowledge(l+1)\n", + " #print(key, arc.entropy())\n", + " print(\"channels with full knowlege: \", len(ego_netwok))\n", + " print(\"channels with 2 Bits of less entropy: \", len(foaf_network))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Define some helper functions to prepare experiments" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "def prepare_mcf_solver(src, dest,amt, mu=0, base=0):\n", + " \"\"\"\n", + " computes the uncertainty network given our prior belief and prepares the min cost flow solver\n", + " \n", + " This function can define a value for \\mu to control how heavily we combine the uncertainty cost and fees\n", + " Also the function supports only taking channels into account that don't charge a base_fee higher or equal to `base`\n", + "\n", + " returns the instantiated min_cost_flow object from the google OR-lib that contains the piecewise linearized problem\n", + " \"\"\"\n", + " used_arcs = oracle.get_uncertainty_network(src,mu,base)\n", + " oracle.arcs_to_networkx(base)\n", + " min_cost_flow = pywrapgraph.SimpleMinCostFlow()\n", + "\n", + " # Add each of the prepared arcs from import_channels().\n", + " node_ids = set()\n", + " for arc in used_arcs:\n", + " node_ids.add(arc[0])\n", + " node_ids.add(arc[1])\n", + " min_cost_flow.AddArcWithCapacityAndUnitCost(arc[0], arc[1], arc[2],\n", + " arc[3])\n", + "\n", + " # Add node supply to 0 for all nodes\n", + " for i in node_ids:\n", + " min_cost_flow.SetNodeSupply(i, 0)\n", + "\n", + " #add amount to sending node\n", + " min_cost_flow.SetNodeSupply(oracle.look_up_id(src),int(amt/QUANTIZATION))\n", + "\n", + " #add -amount to recipient nods\n", + " min_cost_flow.SetNodeSupply(oracle.look_up_id(dest),-int(amt/QUANTIZATION))\n", + " return min_cost_flow\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "def disect_flow_to_paths(min_cost_flow,s,d):\n", + " \"\"\"\n", + " A standard algorithm to disect a flow into several paths.\n", + " \n", + " FIXME: Note that this disection while accurate is probably not optimal in practise. \n", + " As noted in our Probabilistic payment delivery paper the payment process is a bernoulli trial \n", + " and I assume it makes sense to disect the flow into paths of similar likelihood to make most\n", + " progress but this is a mere conjecture at this point. I expect quite a bit of research will be\n", + " necessary to resolve this issue.\n", + " \"\"\"\n", + " total_flow = {}\n", + "\n", + " #first collect all linearized edges which are assigned a non zero flow\n", + " for i in range(min_cost_flow.NumArcs()):\n", + " if min_cost_flow.Flow(i) == 0:\n", + " continue\n", + " src = min_cost_flow.Tail(i)\n", + " dest = min_cost_flow.Head(i)\n", + " flow = min_cost_flow.Flow(i)*QUANTIZATION\n", + "\n", + " key = str(src)+\":\"+str(dest)\n", + " if key in total_flow:\n", + " total_flow[key]=(src,dest,total_flow[key][2]+flow)\n", + " else:\n", + " total_flow[key]=(src,dest,flow)\n", + " \n", + " \n", + " G = nx.DiGraph()\n", + " for key, val in total_flow.items():\n", + " src, dest, flow = val\n", + " G.add_edge(src,dest,weight=flow)\n", + "\n", + " m = 1\n", + " paths = []\n", + " while m>0:\n", + " try: \n", + " path = nx.shortest_path(G,s,d)\n", + " m = min(G[src][dest][\"weight\"] for src, dest in next_hop(path))\n", + " #t+=m\n", + " #print(\"{} sats along {}\".format(m*10000,path_str(path)))\n", + " paths.append((path,m))\n", + " for src,dest in next_hop(path):\n", + " G[src][dest][\"weight\"]-=m\n", + " if G[src][dest][\"weight\"]==0:\n", + " G.remove_edge(src,dest)\n", + " except: \n", + " break\n", + " return paths\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [ + "def make_attempt(src, dest, amt,mu,base):\n", + " \"\"\"\n", + " computes the optimal payment split to deliver `amt` from `src` to `dest` and updates our belief about the liquidity\n", + " \n", + " This is one step within the payment loop.\n", + " \n", + " Retuns the residual amount of the `amt` that could ne be delivered and the paid fees\n", + " (on a per channel base not including fees for downstream fees) for the delivered amount\n", + " \n", + " the function also prints some results an statistics about the paths of the flow to stdout.\n", + " \"\"\"\n", + " start = time.time()\n", + "\n", + " mcf = prepare_mcf_solver(src,dest,amt,mu,base) \n", + "\n", + " status = mcf.Solve()\n", + "\n", + "\n", + " if status != mcf.OPTIMAL:\n", + " print('There was an issue with the min cost flow input.')\n", + " print(f'Status: {status}')\n", + " exit(1)\n", + "\n", + " paths = disect_flow_to_paths(mcf,oracle.look_up_id(src),oracle.look_up_id(dest))\n", + " #print(paths) \n", + "\n", + " end = time.time()\n", + " print(\"\\\\mu: {} \\nRuntime of flow computation: {:4.2f} sec \".format(mu, end-start))\n", + "\n", + " total_fees = 0\n", + " paid_fees = 0\n", + " residual_amt = 0\n", + " number_failed_paths = 0\n", + " for path in paths:\n", + " success, fee, probability = oracle.test_path(path[0],path[1])\n", + " fee /= 1000.\n", + " total_fees += fee\n", + " print(\"Success: {} \\t fee: {:8.3f}msat \\t p = {:5.2f}% amt: {:7}sats path hops: {}\".\n", + " format(success, fee, probability*100, path[1], len(path[0])))\n", + " if success == False:\n", + " number_failed_paths += 1\n", + " residual_amt += path[1]\n", + " else:\n", + " paid_fees += fee\n", + "\n", + " print(\"total_fee: {:8.3f} msat \\t paid fees: {:8.3f} msat\".format(total_fees, paid_fees))\n", + " return residual_amt, paid_fees, len(paths), number_failed_paths\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "def run_pickhardt_payments_experiment(oracle,src,dest,amt,mu=1,base=0):\n", + " \"\"\"\n", + " conduct one experiment! might need to call oracle.reset_uncertainty_network() first\n", + " I could not put it here as some experiments require sharing of liqudity information\n", + "\n", + " \"\"\"\n", + " entropy_start=oracle.entropy()\n", + " start = time.time()\n", + " full_amt = amt\n", + " cnt = 0\n", + " total_fees = 0\n", + " number_number_of_onions = 0\n", + " total_number_failed_paths = 0\n", + " while amt > 0 and cnt < 10:\n", + " print(\"\\nTry: \", amt, \" sats. Round number: \", cnt+1)\n", + " amt, paid_fees, num_paths, number_failed_paths = make_attempt(src,dest,amt,mu,base)\n", + " number_number_of_onions += num_paths\n", + " total_number_failed_paths+=number_failed_paths\n", + " total_fees += paid_fees\n", + " cnt+=1\n", + " end = time.time()\n", + " entropy_end = oracle.entropy()\n", + " print(\"\\nSUMMARY:\")\n", + " print(\"Rounds of mcf-computations: \", cnt)\n", + " print(\"Number of onions sent: \", number_number_of_onions)\n", + " print(\"Number of failed onions: \", total_number_failed_paths, \" failure rate: {:4.2f}% \".format(total_number_failed_paths*100./number_number_of_onions))\n", + " print(\"total runtime (including inefficient memory managment): {:4.3f} sec\".format(end-start))\n", + " print(\"Learnt entropy: {:5.2f} bits\".format(entropy_start-entropy_end))\n", + " print(\"Fees for successfull delivery: {:8.3f} sat --> {} ppm\".format(total_fees,int(total_fees*1000*1000/full_amt)))\n", + " \n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Conducting experiments\n", + "\n", + "We now use our sequential simulation of the uncertainty network to coduct a few experiments. In all cases we try to deliver Payments from Rene's node to Carsten Otto (who is working on an alternative implementation) on a recent snapshot of the channel graph.\n", + "\n", + "In the experiments we first want to study a few things: \n", + "\n", + "1. What happens if we mainly optimize for high success probability\n", + "2. What happens if we optimize for both success probability and fees\n", + "3. what happens if we optimize mainly for fees\n", + "4. How much better is the delivery of payments if we globaly would know 2 bits of information on alle channels\n", + "5. What is the effect of the BOLT 14 proposal to reliability where nodes would share liquidity information of their direct peers\n", + "6. MISSING: How is the difference in paid fee and payment attempts with different focus on various features (selection of \\mu)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "#Rene Pickhardt's public node_key\n", + "RENE = \"03efccf2c383d7bf340da9a3f02e2c23104a0e4fe8ac1a880c8e2dc92fbdacd9df\"\n", + "#Carsten Otto's public node key\n", + "C_OTTO = \"027ce055380348d7812d2ae7745701c9f93e70c1adeb2657f053f91df4f2843c71\"\n", + "\n", + "AMT = 50*1000*1000\n", + "N = 5\n", + "QUANTIZATION=10000" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "channels with full knowlege: 215\n", + "channels with 2 Bits of less entropy: 8750\n" + ] + } + ], + "source": [ + "oracle = Oracle()\n", + "oracle.import_channels(\"listchannels20211028.json\")\n", + "\n", + "#we only conduct the computation on the channels that have a basefee of 0\n", + "oracle.arcs_to_networkx(0)\n", + "oracle.activate_foaf_uncertainty_reduction(RENE,C_OTTO)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "OPTIMIZE FOR soly for RELIABILITY\n", + "\n", + "Try: 50000000 sats. Round number: 1\n", + "\\mu: 0 \n", + "Runtime of flow computation: 1.40 sec \n", + "Success: True \t fee: 6153.950msat \t p = 64.05% amt: 3350000sats path hops: 3\n", + "Success: False \t fee: 2674.000msat \t p = 16.00% amt: 2000000sats path hops: 3\n", + "Success: True \t fee: 2737.130msat \t p = 21.70% amt: 1490000sats path hops: 3\n", + "Success: False \t fee: 7651.530msat \t p = 66.79% amt: 4590000sats path hops: 3\n", + "Success: True \t fee: 312.290msat \t p = 34.50% amt: 170000sats path hops: 4\n", + "Success: True \t fee: 3067.200msat \t p = 46.11% amt: 1350000sats path hops: 4\n", + "Success: True \t fee: 31.640msat \t p = 99.04% amt: 20000sats path hops: 4\n", + "Success: True \t fee: 512.460msat \t p = 70.66% amt: 270000sats path hops: 4\n", + "Success: True \t fee: 799.600msat \t p = 77.45% amt: 400000sats path hops: 4\n", + "Success: False \t fee: 23663.640msat \t p = 22.06% amt: 10920000sats path hops: 4\n", + "Success: False \t fee: 17043.030msat \t p = 68.14% amt: 4090000sats path hops: 4\n", + "Success: True \t fee: 48676.170msat \t p = 17.81% amt: 11910000sats path hops: 5\n", + "Success: True \t fee: 348.460msat \t p = 83.20% amt: 140000sats path hops: 5\n", + "Success: True \t fee: 3176.000msat \t p = 25.09% amt: 2000000sats path hops: 5\n", + "Success: True \t fee: 983.430msat \t p = 24.83% amt: 490000sats path hops: 5\n", + "Success: True \t fee: 650.670msat \t p = 80.56% amt: 410000sats path hops: 5\n", + "Success: False \t fee: 3951.480msat \t p = 75.66% amt: 2040000sats path hops: 5\n", + "Success: True \t fee: 682.860msat \t p = 90.19% amt: 380000sats path hops: 5\n", + "Success: False \t fee: 4769.570msat \t p = 53.50% amt: 2470000sats path hops: 5\n", + "Success: True \t fee: 3519.810msat \t p = 74.24% amt: 1510000sats path hops: 6\n", + "total_fee: 131404.920 msat \t paid fees: 71651.670 msat\n", + "\n", + "Try: 26110000 sats. Round number: 2\n", + "\\mu: 0 \n", + "Runtime of flow computation: 0.80 sec \n", + "Success: True \t fee: 6153.950msat \t p = 64.05% amt: 3350000sats path hops: 3\n", + "Success: True \t fee: 2737.130msat \t p = 21.70% amt: 1490000sats path hops: 3\n", + "Success: True \t fee: 2583.850msat \t p = 88.29% amt: 1550000sats path hops: 3\n", + "Success: True \t fee: 312.290msat \t p = 34.50% amt: 170000sats path hops: 4\n", + "Success: True \t fee: 3067.200msat \t p = 46.11% amt: 1350000sats path hops: 4\n", + "Success: True \t fee: 31.640msat \t p = 99.04% amt: 20000sats path hops: 4\n", + "Success: True \t fee: 799.600msat \t p = 77.45% amt: 400000sats path hops: 4\n", + "Success: False \t fee: 9274.760msat \t p = 63.00% amt: 4280000sats path hops: 4\n", + "Success: True \t fee: 512.460msat \t p = 70.66% amt: 270000sats path hops: 4\n", + "Success: True \t fee: 13252.450msat \t p = 44.36% amt: 6350000sats path hops: 5\n", + "Success: True \t fee: 20353.260msat \t p = 58.02% amt: 4980000sats path hops: 5\n", + "Success: True \t fee: 650.670msat \t p = 80.56% amt: 410000sats path hops: 5\n", + "Success: True \t fee: 3473.190msat \t p = 74.54% amt: 1490000sats path hops: 6\n", + "total_fee: 63202.450 msat \t paid fees: 53927.690 msat\n", + "\n", + "Try: 4280000 sats. Round number: 3\n", + "\\mu: 0 \n", + "Runtime of flow computation: 0.90 sec \n", + "Success: True \t fee: 767.600msat \t p = 77.07% amt: 400000sats path hops: 5\n", + "Success: True \t fee: 15857.560msat \t p = 66.27% amt: 3880000sats path hops: 5\n", + "total_fee: 16625.160 msat \t paid fees: 16625.160 msat\n", + "\n", + "SUMMARY:\n", + "Rounds of mcf-computations: 3\n", + "Number of onions sent: 35\n", + "Number of failed onions: 7 failure rate: 20.00% \n", + "total runtime (including inefficient memory managment): 3.101 sec\n", + "Learnt entropy: 149.18 bits\n", + "Fees for successfull delivery: 142204.520 sat --> 2844 ppm\n" + ] + } + ], + "source": [ + "\n", + "print(\"OPTIMIZE FOR soly for RELIABILITY\")\n", + "oracle.reset_uncertainty_network()\n", + "run_pickhardt_payments_experiment(oracle,RENE,C_OTTO,AMT,mu=0,base=0)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "OTPTIMIZE RELIABILITY AND FEES\n", + "\n", + "Try: 50000000 sats. Round number: 1\n", + "\\mu: 1 \n", + "Runtime of flow computation: 0.93 sec \n", + "Success: False \t fee: 14652.900msat \t p = 16.08% amt: 10050000sats path hops: 3\n", + "Success: True \t fee: 9313.590msat \t p = 48.69% amt: 5070000sats path hops: 3\n", + "Success: True \t fee: 601.600msat \t p = 74.39% amt: 400000sats path hops: 3\n", + "Success: True \t fee: 1537.000msat \t p = 64.00% amt: 1000000sats path hops: 3\n", + "Success: True \t fee: 195.720msat \t p = 81.89% amt: 140000sats path hops: 3\n", + "Success: False \t fee: 3222.170msat \t p = 2.73% amt: 2410000sats path hops: 3\n", + "Success: False \t fee: 3374.000msat \t p = 69.33% amt: 2000000sats path hops: 3\n", + "Success: True \t fee: 1153.600msat \t p = 60.00% amt: 800000sats path hops: 3\n", + "Success: True \t fee: 2737.130msat \t p = 21.70% amt: 1490000sats path hops: 3\n", + "Success: True \t fee: 4297.800msat \t p = 69.70% amt: 2600000sats path hops: 4\n", + "Success: True \t fee: 312.290msat \t p = 34.50% amt: 170000sats path hops: 4\n", + "Success: False \t fee: 16933.290msat \t p = 25.58% amt: 10670000sats path hops: 4\n", + "Success: True \t fee: 625.860msat \t p = 89.96% amt: 380000sats path hops: 4\n", + "Success: True \t fee: 294.660msat \t p = 92.60% amt: 180000sats path hops: 4\n", + "Success: False \t fee: 2127.420msat \t p = 33.24% amt: 1590000sats path hops: 4\n", + "Success: True \t fee: 5028.350msat \t p = 49.75% amt: 3350000sats path hops: 4\n", + "Success: True \t fee: 1072.000msat \t p = 35.34% amt: 800000sats path hops: 4\n", + "Success: True \t fee: 1617.000msat \t p = 50.67% amt: 1000000sats path hops: 4\n", + "Success: True \t fee: 1502.900msat \t p = 58.90% amt: 950000sats path hops: 4\n", + "Success: True \t fee: 3236.000msat \t p = 56.47% amt: 2000000sats path hops: 4\n", + "Success: False \t fee: 1518.000msat \t p = 70.81% amt: 1000000sats path hops: 4\n", + "Success: True \t fee: 1234.440msat \t p = 47.30% amt: 810000sats path hops: 4\n", + "Success: True \t fee: 1098.900msat \t p = 19.62% amt: 740000sats path hops: 4\n", + "Success: True \t fee: 547.600msat \t p = 77.99% amt: 400000sats path hops: 5\n", + "total_fee: 78234.220 msat \t paid fees: 36406.440 msat\n", + "\n", + "Try: 27720000 sats. Round number: 2\n", + "\\mu: 1 \n", + "Runtime of flow computation: 0.99 sec \n", + "Success: True \t fee: 5861.160msat \t p = 57.82% amt: 4020000sats path hops: 3\n", + "Success: True \t fee: 601.600msat \t p = 74.39% amt: 400000sats path hops: 3\n", + "Success: True \t fee: 1537.000msat \t p = 64.00% amt: 1000000sats path hops: 3\n", + "Success: True \t fee: 195.720msat \t p = 81.89% amt: 140000sats path hops: 3\n", + "Success: True \t fee: 1153.600msat \t p = 60.00% amt: 800000sats path hops: 3\n", + "Success: True \t fee: 9256.800msat \t p = 42.61% amt: 5600000sats path hops: 4\n", + "Success: True \t fee: 2459.850msat \t p = 86.58% amt: 1550000sats path hops: 4\n", + "Success: True \t fee: 625.860msat \t p = 89.96% amt: 380000sats path hops: 4\n", + "Success: True \t fee: 294.660msat \t p = 92.60% amt: 180000sats path hops: 4\n", + "Success: True \t fee: 5028.350msat \t p = 49.75% amt: 3350000sats path hops: 4\n", + "Success: True \t fee: 1072.000msat \t p = 35.34% amt: 800000sats path hops: 4\n", + "Success: False \t fee: 2048.670msat \t p = 29.51% amt: 1530000sats path hops: 4\n", + "Success: True \t fee: 1617.000msat \t p = 50.67% amt: 1000000sats path hops: 4\n", + "Success: True \t fee: 1502.900msat \t p = 58.90% amt: 950000sats path hops: 4\n", + "Success: True \t fee: 3236.000msat \t p = 56.47% amt: 2000000sats path hops: 4\n", + "Success: True \t fee: 1203.840msat \t p = 56.04% amt: 880000sats path hops: 4\n", + "Success: True \t fee: 1234.440msat \t p = 47.30% amt: 810000sats path hops: 4\n", + "Success: True \t fee: 1098.900msat \t p = 19.62% amt: 740000sats path hops: 4\n", + "Success: True \t fee: 1971.360msat \t p = 34.87% amt: 1440000sats path hops: 5\n", + "Success: True \t fee: 207.900msat \t p = 90.79% amt: 150000sats path hops: 5\n", + "total_fee: 42207.610 msat \t paid fees: 40158.940 msat\n", + "\n", + "Try: 1530000 sats. Round number: 3\n", + "\\mu: 1 \n", + "Runtime of flow computation: 1.82 sec \n", + "Success: True \t fee: 1072.000msat \t p = 35.34% amt: 800000sats path hops: 4\n", + "Success: True \t fee: 998.640msat \t p = 62.81% amt: 730000sats path hops: 4\n", + "total_fee: 2070.640 msat \t paid fees: 2070.640 msat\n", + "\n", + "SUMMARY:\n", + "Rounds of mcf-computations: 3\n", + "Number of onions sent: 46\n", + "Number of failed onions: 7 failure rate: 15.22% \n", + "total runtime (including inefficient memory managment): 3.753 sec\n", + "Learnt entropy: 151.30 bits\n", + "Fees for successfull delivery: 78636.020 sat --> 1572 ppm\n" + ] + } + ], + "source": [ + "print(\"\\n\\nOTPTIMIZE RELIABILITY AND FEES\")\n", + "oracle.reset_uncertainty_network()\n", + "run_pickhardt_payments_experiment(oracle,RENE,C_OTTO,AMT,mu=1,base=0)\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "OTPTIMIZE MAINLY FOR FEES\n", + "\n", + "Try: 50000000 sats. Round number: 1\n", + "\\mu: 100 \n", + "Runtime of flow computation: 1.23 sec \n", + "Success: False \t fee: 8383.500msat \t p = 43.20% amt: 5750000sats path hops: 3\n", + "Success: True \t fee: 601.600msat \t p = 74.39% amt: 400000sats path hops: 3\n", + "Success: True \t fee: 1089.600msat \t p = 44.00% amt: 800000sats path hops: 3\n", + "Success: False \t fee: 1127.970msat \t p = 8.49% amt: 830000sats path hops: 3\n", + "Success: False \t fee: 3222.170msat \t p = 2.73% amt: 2410000sats path hops: 3\n", + "Success: False \t fee: 4095.280msat \t p = 3.26% amt: 2840000sats path hops: 3\n", + "Success: False \t fee: 86.820msat \t p = 83.86% amt: 60000sats path hops: 4\n", + "Success: False \t fee: 230.080msat \t p = 51.83% amt: 160000sats path hops: 4\n", + "Success: True \t fee: 701.190msat \t p = 12.68% amt: 490000sats path hops: 4\n", + "Success: False \t fee: 783.000msat \t p = 38.00% amt: 580000sats path hops: 4\n", + "Success: True \t fee: 405.810msat \t p = 90.76% amt: 270000sats path hops: 4\n", + "Success: True \t fee: 409.200msat \t p = 66.46% amt: 300000sats path hops: 4\n", + "Success: True \t fee: 539.200msat \t p = 38.40% amt: 400000sats path hops: 4\n", + "Success: False \t fee: 1078.400msat \t p = 40.48% amt: 800000sats path hops: 4\n", + "Success: False \t fee: 3933.720msat \t p = 1.00% amt: 2940000sats path hops: 4\n", + "Success: True \t fee: 66.900msat \t p = 78.60% amt: 50000sats path hops: 4\n", + "Success: False \t fee: 1144.570msat \t p = 10.26% amt: 830000sats path hops: 4\n", + "Success: True \t fee: 229.330msat \t p = 26.26% amt: 170000sats path hops: 4\n", + "Success: False \t fee: 477.750msat \t p = 71.17% amt: 350000sats path hops: 4\n", + "Success: True \t fee: 1969.800msat \t p = 1.14% amt: 1470000sats path hops: 4\n", + "Success: False \t fee: 576.000msat \t p = 40.49% amt: 400000sats path hops: 5\n", + "Success: True \t fee: 57.960msat \t p = 91.15% amt: 40000sats path hops: 5\n", + "Success: False \t fee: 407.100msat \t p = 56.07% amt: 300000sats path hops: 5\n", + "Success: False \t fee: 950.600msat \t p = 30.12% amt: 700000sats path hops: 5\n", + "Success: False \t fee: 5668.000msat \t p = 0.00% amt: 4000000sats path hops: 5\n", + "Success: True \t fee: 567.600msat \t p = 55.65% amt: 400000sats path hops: 5\n", + "Success: True \t fee: 855.000msat \t p = 52.92% amt: 600000sats path hops: 5\n", + "Success: False \t fee: 818.400msat \t p = 18.28% amt: 600000sats path hops: 5\n", + "Success: True \t fee: 348.660msat \t p = 14.24% amt: 260000sats path hops: 5\n", + "Success: False \t fee: 1281.600msat \t p = 12.52% amt: 900000sats path hops: 5\n", + "Success: False \t fee: 2637.200msat \t p = 25.22% amt: 1900000sats path hops: 5\n", + "Success: False \t fee: 278.000msat \t p = 74.26% amt: 200000sats path hops: 5\n", + "Success: True \t fee: 293.600msat \t p = 59.68% amt: 200000sats path hops: 5\n", + "Success: False \t fee: 81.660msat \t p = 65.60% amt: 60000sats path hops: 6\n", + "Success: False \t fee: 831.000msat \t p = 13.20% amt: 600000sats path hops: 6\n", + "Success: True \t fee: 271.600msat \t p = 63.79% amt: 200000sats path hops: 6\n", + "Success: False \t fee: 5399.800msat \t p = 2.76% amt: 3800000sats path hops: 6\n", + "Success: True \t fee: 136.200msat \t p = 80.46% amt: 100000sats path hops: 6\n", + "Success: True \t fee: 97.300msat \t p = 90.28% amt: 70000sats path hops: 6\n", + "Success: True \t fee: 41.700msat \t p = 98.02% amt: 30000sats path hops: 6\n", + "Success: False \t fee: 176.930msat \t p = 45.23% amt: 130000sats path hops: 6\n", + "Success: False \t fee: 4410.000msat \t p = 7.36% amt: 3000000sats path hops: 6\n", + "Success: True \t fee: 689.500msat \t p = 43.05% amt: 500000sats path hops: 6\n", + "Success: True \t fee: 272.000msat \t p = 47.11% amt: 200000sats path hops: 6\n", + "Success: True \t fee: 13.410msat \t p = 93.65% amt: 10000sats path hops: 6\n", + "Success: False \t fee: 166.800msat \t p = 33.26% amt: 120000sats path hops: 6\n", + "Success: False \t fee: 147.620msat \t p = 42.26% amt: 110000sats path hops: 7\n", + "Success: True \t fee: 362.070msat \t p = 41.25% amt: 270000sats path hops: 7\n", + "Success: False \t fee: 682.560msat \t p = 60.01% amt: 480000sats path hops: 7\n", + "Success: True \t fee: 69.100msat \t p = 37.10% amt: 50000sats path hops: 7\n", + "Success: True \t fee: 110.640msat \t p = 67.35% amt: 80000sats path hops: 7\n", + "Success: True \t fee: 135.900msat \t p = 78.69% amt: 100000sats path hops: 7\n", + "Success: True \t fee: 588.400msat \t p = 46.70% amt: 400000sats path hops: 7\n", + "Success: False \t fee: 2583.540msat \t p = 17.34% amt: 1860000sats path hops: 7\n", + "Success: True \t fee: 1799.590msat \t p = 32.64% amt: 1270000sats path hops: 7\n", + "Success: True \t fee: 228.140msat \t p = 71.01% amt: 170000sats path hops: 7\n", + "Success: False \t fee: 515.660msat \t p = 40.36% amt: 380000sats path hops: 7\n", + "Success: True \t fee: 27.100msat \t p = 94.72% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 558.600msat \t p = 60.08% amt: 380000sats path hops: 7\n", + "Success: False \t fee: 26.840msat \t p = 73.70% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 135.200msat \t p = 67.64% amt: 100000sats path hops: 8\n", + "Success: False \t fee: 1854.720msat \t p = 31.31% amt: 1260000sats path hops: 8\n", + "Success: False \t fee: 536.800msat \t p = 23.29% amt: 400000sats path hops: 9\n", + "Success: False \t fee: 1069.380msat \t p = 14.13% amt: 780000sats path hops: 10\n", + "Success: True \t fee: 124.110msat \t p = 83.41% amt: 90000sats path hops: 10\n", + "Success: False \t fee: 493.920msat \t p = 50.28% amt: 360000sats path hops: 10\n", + "Success: False \t fee: 110.160msat \t p = 57.68% amt: 80000sats path hops: 10\n", + "Success: True \t fee: 27.540msat \t p = 87.44% amt: 20000sats path hops: 10\n", + "Success: True \t fee: 140.300msat \t p = 53.87% amt: 100000sats path hops: 11\n", + "total_fee: 70231.400 msat \t paid fees: 13963.850 msat\n", + "\n", + "Try: 39990000 sats. Round number: 2\n", + "\\mu: 100 \n", + "Runtime of flow computation: 1.44 sec \n", + "Success: False \t fee: 8383.500msat \t p = 43.20% amt: 5750000sats path hops: 3\n", + "Success: True \t fee: 300.800msat \t p = 86.84% amt: 200000sats path hops: 3\n", + "Success: True \t fee: 1552.680msat \t p = 26.66% amt: 1140000sats path hops: 3\n", + "Success: False \t fee: 964.890msat \t p = 17.34% amt: 710000sats path hops: 3\n", + "Success: True \t fee: 267.400msat \t p = 90.16% amt: 200000sats path hops: 3\n", + "Success: False \t fee: 3691.520msat \t p = 7.20% amt: 2560000sats path hops: 3\n", + "Success: True \t fee: 701.190msat \t p = 12.68% amt: 490000sats path hops: 4\n", + "Success: True \t fee: 148.500msat \t p = 85.34% amt: 110000sats path hops: 4\n", + "Success: True \t fee: 1212.300msat \t p = 36.74% amt: 900000sats path hops: 4\n", + "Success: True \t fee: 736.560msat \t p = 45.21% amt: 540000sats path hops: 4\n", + "Success: True \t fee: 727.920msat \t p = 24.51% amt: 540000sats path hops: 4\n", + "Success: True \t fee: 136.000msat \t p = 68.08% amt: 100000sats path hops: 4\n", + "Success: True \t fee: 482.040msat \t p = 59.03% amt: 360000sats path hops: 4\n", + "Success: True \t fee: 175.110msat \t p = 86.95% amt: 130000sats path hops: 4\n", + "Success: False \t fee: 979.090msat \t p = 18.99% amt: 710000sats path hops: 4\n", + "Success: True \t fee: 229.330msat \t p = 26.26% amt: 170000sats path hops: 4\n", + "Success: True \t fee: 1969.800msat \t p = 1.14% amt: 1470000sats path hops: 4\n", + "Success: True \t fee: 1097.980msat \t p = 58.32% amt: 820000sats path hops: 4\n", + "Success: True \t fee: 268.600msat \t p = 57.76% amt: 200000sats path hops: 5\n", + "Success: False \t fee: 5384.600msat \t p = 0.72% amt: 3800000sats path hops: 5\n", + "Success: False \t fee: 682.000msat \t p = 27.32% amt: 500000sats path hops: 5\n", + "Success: True \t fee: 115.920msat \t p = 82.85% amt: 80000sats path hops: 5\n", + "Success: False \t fee: 1211.250msat \t p = 38.71% amt: 850000sats path hops: 5\n", + "Success: True \t fee: 348.660msat \t p = 14.24% amt: 260000sats path hops: 5\n", + "Success: True \t fee: 908.160msat \t p = 31.88% amt: 640000sats path hops: 5\n", + "Success: True \t fee: 1404.000msat \t p = 26.15% amt: 1040000sats path hops: 5\n", + "Success: False \t fee: 3939.600msat \t p = 0.80% amt: 2940000sats path hops: 5\n", + "Success: True \t fee: 67.000msat \t p = 78.34% amt: 50000sats path hops: 5\n", + "Success: True \t fee: 440.400msat \t p = 44.09% amt: 300000sats path hops: 5\n", + "Success: False \t fee: 304.260msat \t p = 56.14% amt: 220000sats path hops: 6\n", + "Success: True \t fee: 144.800msat \t p = 72.59% amt: 100000sats path hops: 6\n", + "Success: True \t fee: 488.880msat \t p = 42.04% amt: 360000sats path hops: 6\n", + "Success: True \t fee: 246.240msat \t p = 62.40% amt: 180000sats path hops: 6\n", + "Success: False \t fee: 673.980msat \t p = 41.97% amt: 470000sats path hops: 6\n", + "Success: True \t fee: 3438.820msat \t p = 15.85% amt: 2420000sats path hops: 6\n", + "Success: False \t fee: 584.400msat \t p = 46.94% amt: 400000sats path hops: 6\n", + "Success: False \t fee: 755.780msat \t p = 34.75% amt: 530000sats path hops: 6\n", + "Success: False \t fee: 1028.600msat \t p = 59.17% amt: 740000sats path hops: 6\n", + "Success: True \t fee: 13.610msat \t p = 95.08% amt: 10000sats path hops: 6\n", + "Success: True \t fee: 543.900msat \t p = 78.76% amt: 370000sats path hops: 6\n", + "Success: True \t fee: 748.680msat \t p = 52.31% amt: 510000sats path hops: 6\n", + "Success: True \t fee: 702.270msat \t p = 30.82% amt: 510000sats path hops: 6\n", + "Success: True \t fee: 228.820msat \t p = 73.30% amt: 170000sats path hops: 6\n", + "Success: True \t fee: 124.380msat \t p = 5.58% amt: 90000sats path hops: 7\n", + "Success: True \t fee: 122.580msat \t p = 58.86% amt: 90000sats path hops: 7\n", + "Success: False \t fee: 1074.060msat \t p = 21.09% amt: 780000sats path hops: 7\n", + "Success: True \t fee: 289.590msat \t p = 70.32% amt: 210000sats path hops: 7\n", + "Success: True \t fee: 242.640msat \t p = 45.49% amt: 180000sats path hops: 7\n", + "Success: True \t fee: 83.640msat \t p = 86.52% amt: 60000sats path hops: 7\n", + "Success: False \t fee: 107.360msat \t p = 55.03% amt: 80000sats path hops: 7\n", + "Success: True \t fee: 174.330msat \t p = 66.75% amt: 130000sats path hops: 7\n", + "Success: True \t fee: 110.640msat \t p = 66.78% amt: 80000sats path hops: 8\n", + "Success: True \t fee: 135.900msat \t p = 77.87% amt: 100000sats path hops: 8\n", + "Success: True \t fee: 27.140msat \t p = 95.54% amt: 20000sats path hops: 8\n", + "Success: True \t fee: 57.000msat \t p = 92.08% amt: 40000sats path hops: 8\n", + "Success: True \t fee: 14.450msat \t p = 98.67% amt: 10000sats path hops: 8\n", + "Success: True \t fee: 588.400msat \t p = 44.73% amt: 400000sats path hops: 8\n", + "Success: False \t fee: 1111.200msat \t p = 46.91% amt: 800000sats path hops: 8\n", + "Success: True \t fee: 559.360msat \t p = 72.25% amt: 380000sats path hops: 8\n", + "Success: False \t fee: 124.110msat \t p = 79.82% amt: 90000sats path hops: 9\n", + "Success: True \t fee: 107.360msat \t p = 78.00% amt: 80000sats path hops: 9\n", + "Success: True \t fee: 14.230msat \t p = 97.88% amt: 10000sats path hops: 9\n", + "Success: True \t fee: 142.000msat \t p = 68.25% amt: 100000sats path hops: 9\n", + "Success: True \t fee: 417.600msat \t p = 57.44% amt: 290000sats path hops: 9\n", + "Success: True \t fee: 216.000msat \t p = 73.64% amt: 150000sats path hops: 10\n", + "Success: True \t fee: 345.600msat \t p = 57.68% amt: 240000sats path hops: 10\n", + "Success: True \t fee: 82.260msat \t p = 86.57% amt: 60000sats path hops: 10\n", + "Success: True \t fee: 109.760msat \t p = 86.39% amt: 80000sats path hops: 10\n", + "Success: True \t fee: 55.080msat \t p = 76.70% amt: 40000sats path hops: 10\n", + "Success: True \t fee: 28.060msat \t p = 89.39% amt: 20000sats path hops: 11\n", + "Success: True \t fee: 140.300msat \t p = 54.95% amt: 100000sats path hops: 11\n", + "Success: True \t fee: 187.330msat \t p = 77.99% amt: 130000sats path hops: 11\n", + "Success: True \t fee: 475.530msat \t p = 56.62% amt: 330000sats path hops: 11\n", + "Success: True \t fee: 245.140msat \t p = 73.24% amt: 170000sats path hops: 11\n", + "Success: True \t fee: 144.100msat \t p = 82.91% amt: 100000sats path hops: 11\n", + "total_fee: 56086.970 msat \t paid fees: 25086.770 msat\n", + "\n", + "Try: 21930000 sats. Round number: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\\mu: 100 \n", + "Runtime of flow computation: 1.30 sec \n", + "Success: True \t fee: 1552.680msat \t p = 26.66% amt: 1140000sats path hops: 3\n", + "Success: False \t fee: 570.780msat \t p = 44.83% amt: 420000sats path hops: 3\n", + "Success: True \t fee: 267.400msat \t p = 90.16% amt: 200000sats path hops: 3\n", + "Success: True \t fee: 173.040msat \t p = 93.36% amt: 120000sats path hops: 3\n", + "Success: True \t fee: 701.190msat \t p = 12.68% amt: 490000sats path hops: 4\n", + "Success: True \t fee: 148.500msat \t p = 85.34% amt: 110000sats path hops: 4\n", + "Success: True \t fee: 1212.300msat \t p = 36.74% amt: 900000sats path hops: 4\n", + "Success: True \t fee: 736.560msat \t p = 45.21% amt: 540000sats path hops: 4\n", + "Success: True \t fee: 485.280msat \t p = 43.03% amt: 360000sats path hops: 4\n", + "Success: True \t fee: 136.000msat \t p = 68.08% amt: 100000sats path hops: 4\n", + "Success: True \t fee: 482.040msat \t p = 59.03% amt: 360000sats path hops: 4\n", + "Success: False \t fee: 482.650msat \t p = 53.40% amt: 350000sats path hops: 4\n", + "Success: True \t fee: 229.330msat \t p = 26.26% amt: 170000sats path hops: 4\n", + "Success: True \t fee: 1969.800msat \t p = 1.14% amt: 1470000sats path hops: 4\n", + "Success: True \t fee: 1272.050msat \t p = 52.56% amt: 950000sats path hops: 4\n", + "Success: True \t fee: 268.600msat \t p = 57.76% amt: 200000sats path hops: 5\n", + "Success: False \t fee: 4080.960msat \t p = 8.15% amt: 2880000sats path hops: 5\n", + "Success: False \t fee: 286.440msat \t p = 63.26% amt: 210000sats path hops: 5\n", + "Success: True \t fee: 855.000msat \t p = 52.92% amt: 600000sats path hops: 5\n", + "Success: True \t fee: 348.660msat \t p = 14.24% amt: 260000sats path hops: 5\n", + "Success: True \t fee: 908.160msat \t p = 31.88% amt: 640000sats path hops: 5\n", + "Success: True \t fee: 432.000msat \t p = 71.09% amt: 320000sats path hops: 5\n", + "Success: True \t fee: 687.480msat \t p = 41.37% amt: 510000sats path hops: 5\n", + "Success: True \t fee: 246.240msat \t p = 62.40% amt: 180000sats path hops: 6\n", + "Success: True \t fee: 13.410msat \t p = 93.65% amt: 10000sats path hops: 6\n", + "Success: True \t fee: 283.500msat \t p = 78.57% amt: 210000sats path hops: 6\n", + "Success: True \t fee: 3792.200msat \t p = 1.62% amt: 2830000sats path hops: 6\n", + "Success: True \t fee: 147.510msat \t p = 91.04% amt: 110000sats path hops: 6\n", + "Success: True \t fee: 67.050msat \t p = 77.39% amt: 50000sats path hops: 6\n", + "Success: True \t fee: 488.880msat \t p = 42.04% amt: 360000sats path hops: 6\n", + "Success: True \t fee: 2969.890msat \t p = 21.65% amt: 2090000sats path hops: 6\n", + "Success: True \t fee: 444.180msat \t p = 52.37% amt: 330000sats path hops: 6\n", + "Success: True \t fee: 124.380msat \t p = 5.58% amt: 90000sats path hops: 7\n", + "Success: True \t fee: 97.370msat \t p = 93.80% amt: 70000sats path hops: 7\n", + "Success: True \t fee: 136.200msat \t p = 54.97% amt: 100000sats path hops: 7\n", + "Success: False \t fee: 703.800msat \t p = 37.05% amt: 510000sats path hops: 7\n", + "Success: False \t fee: 93.940msat \t p = 59.75% amt: 70000sats path hops: 7\n", + "Success: True \t fee: 134.100msat \t p = 73.51% amt: 100000sats path hops: 7\n", + "Success: True \t fee: 142.500msat \t p = 81.02% amt: 100000sats path hops: 8\n", + "Success: True \t fee: 110.720msat \t p = 66.04% amt: 80000sats path hops: 8\n", + "Success: True \t fee: 136.000msat \t p = 76.79% amt: 100000sats path hops: 8\n", + "Success: True \t fee: 291.900msat \t p = 80.40% amt: 210000sats path hops: 8\n", + "Success: True \t fee: 236.130msat \t p = 83.03% amt: 170000sats path hops: 8\n", + "Success: True \t fee: 27.140msat \t p = 95.17% amt: 20000sats path hops: 8\n", + "Success: True \t fee: 142.100msat \t p = 70.95% amt: 100000sats path hops: 9\n", + "Success: True \t fee: 142.300msat \t p = 80.23% amt: 100000sats path hops: 9\n", + "Success: True \t fee: 201.600msat \t p = 49.07% amt: 150000sats path hops: 9\n", + "Success: True \t fee: 40.290msat \t p = 86.77% amt: 30000sats path hops: 9\n", + "Success: True \t fee: 107.280msat \t p = 74.44% amt: 80000sats path hops: 9\n", + "Success: False \t fee: 138.500msat \t p = 57.06% amt: 100000sats path hops: 10\n", + "Success: True \t fee: 178.230msat \t p = 72.89% amt: 130000sats path hops: 10\n", + "Success: True \t fee: 13.710msat \t p = 97.85% amt: 10000sats path hops: 10\n", + "Success: True \t fee: 55.040msat \t p = 75.58% amt: 40000sats path hops: 10\n", + "Success: True \t fee: 112.160msat \t p = 60.64% amt: 80000sats path hops: 11\n", + "Success: True \t fee: 28.040msat \t p = 88.74% amt: 20000sats path hops: 11\n", + "total_fee: 30133.190 msat \t paid fees: 23776.120 msat\n", + "\n", + "Try: 4540000 sats. Round number: 4\n", + "\\mu: 100 \n", + "Runtime of flow computation: 1.36 sec \n", + "Success: True \t fee: 267.400msat \t p = 90.16% amt: 200000sats path hops: 3\n", + "Success: True \t fee: 482.040msat \t p = 59.03% amt: 360000sats path hops: 4\n", + "Success: True \t fee: 1700.530msat \t p = 39.32% amt: 1270000sats path hops: 4\n", + "Success: True \t fee: 681.870msat \t p = 53.25% amt: 510000sats path hops: 4\n", + "Success: True \t fee: 93.660msat \t p = 91.56% amt: 70000sats path hops: 5\n", + "Success: True \t fee: 227.630msat \t p = 79.97% amt: 170000sats path hops: 6\n", + "Success: True \t fee: 2197.600msat \t p = 23.21% amt: 1640000sats path hops: 6\n", + "Success: True \t fee: 267.600msat \t p = 85.68% amt: 200000sats path hops: 6\n", + "Success: True \t fee: 160.920msat \t p = 74.44% amt: 120000sats path hops: 8\n", + "total_fee: 6079.250 msat \t paid fees: 6079.250 msat\n", + "\n", + "SUMMARY:\n", + "Rounds of mcf-computations: 4\n", + "Number of onions sent: 208\n", + "Number of failed onions: 59 failure rate: 28.37% \n", + "total runtime (including inefficient memory managment): 5.363 sec\n", + "Learnt entropy: 269.17 bits\n", + "Fees for successfull delivery: 68905.990 sat --> 1378 ppm\n" + ] + } + ], + "source": [ + " \n", + "print(\"\\n\\nOTPTIMIZE MAINLY FOR FEES\")\n", + "oracle.reset_uncertainty_network()\n", + "run_pickhardt_payments_experiment(oracle,RENE,C_OTTO,AMT,mu=100,base=0)\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "OTPTIMIZE MAINLY FOR FEES use global uncertainty reduction\n", + "\n", + "Try: 50000000 sats. Round number: 1\n", + "\\mu: 100 \n", + "Runtime of flow computation: 1.94 sec \n", + "Success: False \t fee: 10949.580msat \t p = 30.51% amt: 7510000sats path hops: 3\n", + "Success: False \t fee: 616.640msat \t p = 73.78% amt: 410000sats path hops: 3\n", + "Success: True \t fee: 1813.660msat \t p = 58.37% amt: 1180000sats path hops: 3\n", + "Success: True \t fee: 1362.000msat \t p = 33.33% amt: 1000000sats path hops: 3\n", + "Success: False \t fee: 557.190msat \t p = 45.93% amt: 410000sats path hops: 3\n", + "Success: False \t fee: 3248.910msat \t p = 2.12% amt: 2430000sats path hops: 3\n", + "Success: False \t fee: 3137.820msat \t p = 71.31% amt: 1860000sats path hops: 3\n", + "Success: False \t fee: 2206.260msat \t p = 32.23% amt: 1530000sats path hops: 3\n", + "Success: True \t fee: 57.520msat \t p = 86.79% amt: 40000sats path hops: 4\n", + "Success: True \t fee: 357.750msat \t p = 48.82% amt: 250000sats path hops: 4\n", + "Success: False \t fee: 3201.390msat \t p = 36.81% amt: 2130000sats path hops: 4\n", + "Success: True \t fee: 340.000msat \t p = 32.36% amt: 250000sats path hops: 4\n", + "Success: True \t fee: 94.360msat \t p = 93.59% amt: 70000sats path hops: 4\n", + "Success: False \t fee: 592.970msat \t p = 44.63% amt: 430000sats path hops: 4\n", + "Success: True \t fee: 229.330msat \t p = 26.26% amt: 170000sats path hops: 4\n", + "Success: True \t fee: 1969.800msat \t p = 1.14% amt: 1470000sats path hops: 4\n", + "Success: True \t fee: 449.790msat \t p = 61.78% amt: 330000sats path hops: 5\n", + "Success: True \t fee: 1941.940msat \t p = 5.57% amt: 1430000sats path hops: 5\n", + "Success: False \t fee: 246.330msat \t p = 66.13% amt: 170000sats path hops: 5\n", + "Success: True \t fee: 13.690msat \t p = 70.77% amt: 10000sats path hops: 5\n", + "Success: True \t fee: 94.360msat \t p = 93.39% amt: 70000sats path hops: 5\n", + "Success: True \t fee: 268.000msat \t p = 75.05% amt: 200000sats path hops: 5\n", + "Success: True \t fee: 802.800msat \t p = 46.32% amt: 600000sats path hops: 5\n", + "Success: True \t fee: 13.630msat \t p = 98.08% amt: 10000sats path hops: 5\n", + "Success: True \t fee: 1983.800msat \t p = 39.32% amt: 1400000sats path hops: 5\n", + "Success: True \t fee: 1064.250msat \t p = 21.67% amt: 750000sats path hops: 5\n", + "Success: False \t fee: 926.250msat \t p = 49.85% amt: 650000sats path hops: 5\n", + "Success: False \t fee: 204.600msat \t p = 72.75% amt: 150000sats path hops: 5\n", + "Success: False \t fee: 375.480msat \t p = 10.37% amt: 280000sats path hops: 5\n", + "Success: False \t fee: 239.700msat \t p = 77.36% amt: 150000sats path hops: 5\n", + "Success: False \t fee: 392.500msat \t p = 56.85% amt: 250000sats path hops: 5\n", + "Success: True \t fee: 383.500msat \t p = 47.90% amt: 250000sats path hops: 5\n", + "Success: True \t fee: 931.240msat \t p = 75.31% amt: 620000sats path hops: 5\n", + "Success: True \t fee: 95.900msat \t p = 28.70% amt: 70000sats path hops: 5\n", + "Success: False \t fee: 572.520msat \t p = 32.40% amt: 390000sats path hops: 5\n", + "Success: True \t fee: 26.920msat \t p = 91.12% amt: 20000sats path hops: 5\n", + "Success: True \t fee: 468.300msat \t p = 75.93% amt: 350000sats path hops: 6\n", + "Success: True \t fee: 173.760msat \t p = 67.60% amt: 120000sats path hops: 6\n", + "Success: True \t fee: 205.050msat \t p = 51.50% amt: 150000sats path hops: 6\n", + "Success: True \t fee: 740.500msat \t p = 44.20% amt: 500000sats path hops: 6\n", + "Success: True \t fee: 14.200msat \t p = 42.13% amt: 10000sats path hops: 6\n", + "Success: True \t fee: 13.810msat \t p = 84.41% amt: 10000sats path hops: 6\n", + "Success: True \t fee: 1511.730msat \t p = 40.61% amt: 990000sats path hops: 6\n", + "Success: True \t fee: 13.830msat \t p = 47.52% amt: 10000sats path hops: 6\n", + "Success: True \t fee: 343.390msat \t p = 66.75% amt: 230000sats path hops: 6\n", + "Success: True \t fee: 247.680msat \t p = 45.97% amt: 180000sats path hops: 6\n", + "Success: False \t fee: 94.640msat \t p = 43.60% amt: 70000sats path hops: 6\n", + "Success: False \t fee: 53.720msat \t p = 75.89% amt: 40000sats path hops: 6\n", + "Success: True \t fee: 27.260msat \t p = 35.13% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 67.600msat \t p = 23.50% amt: 50000sats path hops: 6\n", + "Success: True \t fee: 109.040msat \t p = 63.66% amt: 80000sats path hops: 6\n", + "Success: True \t fee: 27.820msat \t p = 35.13% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 72.100msat \t p = 23.50% amt: 50000sats path hops: 6\n", + "Success: True \t fee: 603.900msat \t p = 20.42% amt: 450000sats path hops: 6\n", + "Success: True \t fee: 53.600msat \t p = 43.01% amt: 40000sats path hops: 6\n", + "Success: False \t fee: 70.950msat \t p = 66.87% amt: 50000sats path hops: 6\n", + "Success: True \t fee: 457.300msat \t p = 45.86% amt: 340000sats path hops: 6\n", + "Success: True \t fee: 1648.200msat \t p = 36.16% amt: 1230000sats path hops: 6\n", + "Success: True \t fee: 294.800msat \t p = 19.35% amt: 220000sats path hops: 6\n", + "Success: True \t fee: 1119.000msat \t p = 37.09% amt: 750000sats path hops: 6\n", + "Success: True \t fee: 26.880msat \t p = 76.37% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 597.520msat \t p = 33.23% amt: 440000sats path hops: 6\n", + "Success: True \t fee: 422.530msat \t p = 49.03% amt: 310000sats path hops: 6\n", + "Success: True \t fee: 2600.430msat \t p = 27.19% amt: 1830000sats path hops: 6\n", + "Success: True \t fee: 1202.850msat \t p = 49.53% amt: 810000sats path hops: 6\n", + "Success: True \t fee: 149.380msat \t p = 65.77% amt: 110000sats path hops: 7\n", + "Success: False \t fee: 86.460msat \t p = 58.86% amt: 60000sats path hops: 7\n", + "Success: True \t fee: 27.640msat \t p = 71.44% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 299.460msat \t p = 67.23% amt: 210000sats path hops: 7\n", + "Success: True \t fee: 702.180msat \t p = 38.29% amt: 470000sats path hops: 7\n", + "Success: True \t fee: 29.860msat \t p = 75.88% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 364.750msat \t p = 40.23% amt: 250000sats path hops: 7\n", + "Success: True \t fee: 1837.500msat \t p = 36.16% amt: 1250000sats path hops: 7\n", + "Success: True \t fee: 468.860msat \t p = 55.60% amt: 340000sats path hops: 7\n", + "Success: True \t fee: 358.540msat \t p = 61.05% amt: 260000sats path hops: 7\n", + "Success: False \t fee: 14.430msat \t p = 63.13% amt: 10000sats path hops: 7\n", + "Success: True \t fee: 80.400msat \t p = 66.96% amt: 60000sats path hops: 7\n", + "Success: True \t fee: 95.340msat \t p = 5.19% amt: 70000sats path hops: 8\n", + "Success: True \t fee: 318.090msat \t p = 25.39% amt: 230000sats path hops: 8\n", + "Success: True \t fee: 28.480msat \t p = 78.42% amt: 20000sats path hops: 8\n", + "Success: True \t fee: 648.900msat \t p = 40.62% amt: 450000sats path hops: 8\n", + "Success: True \t fee: 552.630msat \t p = 33.04% amt: 390000sats path hops: 8\n", + "Success: True \t fee: 1572.870msat \t p = 25.98% amt: 1110000sats path hops: 8\n", + "Success: True \t fee: 724.000msat \t p = 15.16% amt: 500000sats path hops: 8\n", + "Success: True \t fee: 372.840msat \t p = 33.59% amt: 260000sats path hops: 8\n", + "Success: False \t fee: 1250.100msat \t p = 34.59% amt: 900000sats path hops: 8\n", + "Success: True \t fee: 166.800msat \t p = 67.91% amt: 120000sats path hops: 8\n", + "Success: True \t fee: 55.760msat \t p = 88.34% amt: 40000sats path hops: 8\n", + "Success: True \t fee: 194.740msat \t p = 82.00% amt: 130000sats path hops: 8\n", + "Success: True \t fee: 264.960msat \t p = 72.16% amt: 180000sats path hops: 8\n", + "Success: True \t fee: 14.600msat \t p = 92.86% amt: 10000sats path hops: 8\n", + "Success: True \t fee: 26.940msat \t p = 80.10% amt: 20000sats path hops: 8\n", + "Success: True \t fee: 254.980msat \t p = 46.45% amt: 190000sats path hops: 8\n", + "Success: True \t fee: 94.010msat \t p = 19.38% amt: 70000sats path hops: 8\n", + "Success: True \t fee: 14.620msat \t p = 42.99% amt: 10000sats path hops: 9\n", + "Success: True \t fee: 29.200msat \t p = 52.54% amt: 20000sats path hops: 9\n", + "Success: True \t fee: 380.120msat \t p = 25.51% amt: 260000sats path hops: 9\n", + "Success: True \t fee: 101.010msat \t p = 26.42% amt: 70000sats path hops: 9\n", + "Success: True \t fee: 111.360msat \t p = 41.46% amt: 80000sats path hops: 9\n", + "Success: True \t fee: 70.600msat \t p = 40.53% amt: 50000sats path hops: 9\n", + "Success: True \t fee: 88.020msat \t p = 81.02% amt: 60000sats path hops: 9\n", + "Success: True \t fee: 331.200msat \t p = 64.82% amt: 230000sats path hops: 9\n", + "Success: True \t fee: 207.200msat \t p = 30.26% amt: 140000sats path hops: 10\n", + "Success: True \t fee: 102.340msat \t p = 19.20% amt: 70000sats path hops: 10\n", + "Success: True \t fee: 357.250msat \t p = 49.18% amt: 250000sats path hops: 10\n", + "Success: True \t fee: 114.160msat \t p = 41.70% amt: 80000sats path hops: 10\n", + "Success: True \t fee: 28.560msat \t p = 77.37% amt: 20000sats path hops: 10\n", + "Success: False \t fee: 413.100msat \t p = 46.18% amt: 300000sats path hops: 10\n", + "Success: True \t fee: 13.820msat \t p = 93.15% amt: 10000sats path hops: 10\n", + "Success: True \t fee: 356.000msat \t p = 33.25% amt: 250000sats path hops: 10\n", + "Success: False \t fee: 288.360msat \t p = 46.31% amt: 180000sats path hops: 11\n", + "Success: True \t fee: 56.320msat \t p = 77.62% amt: 40000sats path hops: 11\n", + "Success: True \t fee: 43.140msat \t p = 78.52% amt: 30000sats path hops: 11\n", + "Success: True \t fee: 171.840msat \t p = 29.09% amt: 120000sats path hops: 11\n", + "Success: False \t fee: 142.600msat \t p = 30.33% amt: 100000sats path hops: 11\n", + "Success: True \t fee: 14.950msat \t p = 81.82% amt: 10000sats path hops: 11\n", + "Success: True \t fee: 44.880msat \t p = 43.46% amt: 30000sats path hops: 11\n", + "Success: True \t fee: 27.180msat \t p = 58.79% amt: 20000sats path hops: 12\n", + "Success: True \t fee: 45.090msat \t p = 91.21% amt: 30000sats path hops: 12\n", + "Success: True \t fee: 104.580msat \t p = 61.90% amt: 70000sats path hops: 12\n", + "Success: True \t fee: 273.240msat \t p = 21.36% amt: 180000sats path hops: 12\n", + "Success: True \t fee: 27.500msat \t p = 55.94% amt: 20000sats path hops: 12\n", + "Success: True \t fee: 30.360msat \t p = 71.90% amt: 20000sats path hops: 12\n", + "Success: True \t fee: 216.900msat \t p = 38.08% amt: 150000sats path hops: 12\n", + "Success: True \t fee: 44.040msat \t p = 82.76% amt: 30000sats path hops: 13\n", + "Success: True \t fee: 132.480msat \t p = 57.96% amt: 90000sats path hops: 13\n", + "Success: True \t fee: 30.060msat \t p = 63.81% amt: 20000sats path hops: 13\n", + "Success: True \t fee: 232.480msat \t p = 41.17% amt: 160000sats path hops: 14\n", + "Success: True \t fee: 531.650msat \t p = 5.68% amt: 350000sats path hops: 14\n", + "Success: True \t fee: 75.950msat \t p = 79.00% amt: 50000sats path hops: 14\n", + "Success: True \t fee: 14.650msat \t p = 90.79% amt: 10000sats path hops: 15\n", + "Success: True \t fee: 263.700msat \t p = 23.59% amt: 180000sats path hops: 15\n", + "Success: True \t fee: 57.800msat \t p = 74.08% amt: 40000sats path hops: 15\n", + "Success: True \t fee: 72.500msat \t p = 72.07% amt: 50000sats path hops: 17\n", + "Success: True \t fee: 87.720msat \t p = 60.62% amt: 60000sats path hops: 19\n", + "total_fee: 71848.800 msat \t paid fees: 41966.300 msat\n", + "\n", + "Try: 20460000 sats. Round number: 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\\mu: 100 \n", + "Runtime of flow computation: 1.22 sec \n", + "Success: True \t fee: 475.650msat \t p = 52.76% amt: 350000sats path hops: 3\n", + "Success: True \t fee: 735.350msat \t p = 73.71% amt: 550000sats path hops: 3\n", + "Success: True \t fee: 100.170msat \t p = 84.19% amt: 70000sats path hops: 4\n", + "Success: True \t fee: 749.840msat \t p = 42.06% amt: 560000sats path hops: 4\n", + "Success: True \t fee: 229.330msat \t p = 26.26% amt: 170000sats path hops: 4\n", + "Success: True \t fee: 1969.800msat \t p = 1.14% amt: 1470000sats path hops: 4\n", + "Success: True \t fee: 802.200msat \t p = 46.82% amt: 600000sats path hops: 4\n", + "Success: True \t fee: 107.440msat \t p = 81.32% amt: 80000sats path hops: 5\n", + "Success: True \t fee: 1870.440msat \t p = 41.86% amt: 1320000sats path hops: 5\n", + "Success: True \t fee: 26.920msat \t p = 91.12% amt: 20000sats path hops: 5\n", + "Success: True \t fee: 348.660msat \t p = 14.24% amt: 260000sats path hops: 5\n", + "Success: True \t fee: 1064.250msat \t p = 21.67% amt: 750000sats path hops: 5\n", + "Success: True \t fee: 937.300msat \t p = 59.09% amt: 700000sats path hops: 5\n", + "Success: True \t fee: 41.100msat \t p = 92.49% amt: 30000sats path hops: 5\n", + "Success: True \t fee: 95.900msat \t p = 28.70% amt: 70000sats path hops: 5\n", + "Success: True \t fee: 54.000msat \t p = 65.68% amt: 40000sats path hops: 6\n", + "Success: True \t fee: 13.610msat \t p = 93.65% amt: 10000sats path hops: 6\n", + "Success: True \t fee: 14.000msat \t p = 47.45% amt: 10000sats path hops: 6\n", + "Success: True \t fee: 27.220msat \t p = 35.18% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 67.500msat \t p = 23.58% amt: 50000sats path hops: 6\n", + "Success: True \t fee: 136.100msat \t p = 56.18% amt: 100000sats path hops: 6\n", + "Success: True \t fee: 27.820msat \t p = 35.13% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 933.570msat \t p = 18.15% amt: 690000sats path hops: 6\n", + "Success: True \t fee: 2025.000msat \t p = 8.02% amt: 1500000sats path hops: 6\n", + "Success: True \t fee: 247.320msat \t p = 60.88% amt: 180000sats path hops: 6\n", + "Success: True \t fee: 993.080msat \t p = 3.52% amt: 740000sats path hops: 6\n", + "Success: True \t fee: 1742.000msat \t p = 33.70% amt: 1300000sats path hops: 6\n", + "Success: True \t fee: 2197.600msat \t p = 15.24% amt: 1640000sats path hops: 6\n", + "Success: True \t fee: 312.340msat \t p = 59.26% amt: 230000sats path hops: 6\n", + "Success: True \t fee: 613.350msat \t p = 33.03% amt: 450000sats path hops: 6\n", + "Success: False \t fee: 70.950msat \t p = 66.87% amt: 50000sats path hops: 6\n", + "Success: True \t fee: 294.800msat \t p = 18.51% amt: 220000sats path hops: 6\n", + "Success: True \t fee: 190.680msat \t p = 73.37% amt: 140000sats path hops: 6\n", + "Success: True \t fee: 2600.430msat \t p = 27.19% amt: 1830000sats path hops: 6\n", + "Success: True \t fee: 27.280msat \t p = 59.33% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 27.240msat \t p = 43.72% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 27.240msat \t p = 47.60% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 27.700msat \t p = 71.16% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 679.500msat \t p = 19.19% amt: 500000sats path hops: 7\n", + "Success: True \t fee: 26.840msat \t p = 76.33% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 827.400msat \t p = 29.14% amt: 600000sats path hops: 7\n", + "Success: True \t fee: 13.620msat \t p = 69.56% amt: 10000sats path hops: 8\n", + "Success: True \t fee: 55.320msat \t p = 81.55% amt: 40000sats path hops: 8\n", + "Success: True \t fee: 166.080msat \t p = 40.46% amt: 120000sats path hops: 8\n", + "Success: True \t fee: 55.320msat \t p = 76.66% amt: 40000sats path hops: 8\n", + "Success: True \t fee: 85.380msat \t p = 87.35% amt: 60000sats path hops: 8\n", + "Success: True \t fee: 722.670msat \t p = 18.21% amt: 510000sats path hops: 8\n", + "Success: True \t fee: 708.000msat \t p = 45.26% amt: 500000sats path hops: 8\n", + "Success: True \t fee: 69.700msat \t p = 59.65% amt: 50000sats path hops: 8\n", + "Success: True \t fee: 41.550msat \t p = 69.38% amt: 30000sats path hops: 9\n", + "Success: True \t fee: 27.000msat \t p = 56.01% amt: 20000sats path hops: 9\n", + "Success: True \t fee: 28.440msat \t p = 78.38% amt: 20000sats path hops: 9\n", + "Success: True \t fee: 254.880msat \t p = 55.15% amt: 180000sats path hops: 9\n", + "Success: True \t fee: 85.020msat \t p = 81.54% amt: 60000sats path hops: 9\n", + "Success: True \t fee: 458.370msat \t p = 28.20% amt: 330000sats path hops: 9\n", + "Success: True \t fee: 41.790msat \t p = 59.88% amt: 30000sats path hops: 9\n", + "Success: True \t fee: 70.650msat \t p = 28.30% amt: 50000sats path hops: 9\n", + "Success: True \t fee: 14.250msat \t p = 86.22% amt: 10000sats path hops: 10\n", + "Success: True \t fee: 114.000msat \t p = 55.56% amt: 80000sats path hops: 10\n", + "Success: True \t fee: 356.000msat \t p = 33.25% amt: 250000sats path hops: 10\n", + "Success: True \t fee: 124.920msat \t p = 69.39% amt: 90000sats path hops: 10\n", + "Success: True \t fee: 83.400msat \t p = 61.44% amt: 60000sats path hops: 10\n", + "Success: True \t fee: 134.100msat \t p = 24.63% amt: 100000sats path hops: 10\n", + "Success: True \t fee: 93.940msat \t p = 17.60% amt: 70000sats path hops: 10\n", + "Success: True \t fee: 81.780msat \t p = 23.44% amt: 60000sats path hops: 11\n", + "Success: True \t fee: 82.440msat \t p = 84.97% amt: 60000sats path hops: 12\n", + "Success: True \t fee: 188.300msat \t p = 45.34% amt: 140000sats path hops: 12\n", + "Success: True \t fee: 13.490msat \t p = 84.28% amt: 10000sats path hops: 13\n", + "Success: True \t fee: 42.270msat \t p = 55.23% amt: 30000sats path hops: 14\n", + "Success: True \t fee: 14.090msat \t p = 83.26% amt: 10000sats path hops: 14\n", + "Success: True \t fee: 27.160msat \t p = 34.91% amt: 20000sats path hops: 16\n", + "total_fee: 28012.850 msat \t paid fees: 27941.900 msat\n", + "\n", + "Try: 50000 sats. Round number: 3\n", + "\\mu: 100 \n", + "Runtime of flow computation: 1.82 sec \n", + "Success: True \t fee: 66.850msat \t p = 96.43% amt: 50000sats path hops: 5\n", + "total_fee: 66.850 msat \t paid fees: 66.850 msat\n", + "\n", + "SUMMARY:\n", + "Rounds of mcf-computations: 3\n", + "Number of onions sent: 207\n", + "Number of failed onions: 25 failure rate: 12.08% \n", + "total runtime (including inefficient memory managment): 4.992 sec\n", + "Learnt entropy: 194.36 bits\n", + "Fees for successfull delivery: 69975.050 sat --> 1399 ppm\n" + ] + } + ], + "source": [ + " \n", + "print(\"\\n\\nOTPTIMIZE MAINLY FOR FEES use global uncertainty reduction\")\n", + "oracle.reset_uncertainty_network()\n", + "oracle.activate_network_wide_uncertainty_reduction(2)\n", + "run_pickhardt_payments_experiment(oracle,RENE,C_OTTO,AMT,mu=100,base=0)\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "OTPTIMIZE MAINLY FOR FEES use foaf uncertainty reduction\n", + "channels with full knowlege: 215\n", + "channels with 2 Bits of less entropy: 8750\n", + "\n", + "Try: 50000000 sats. Round number: 1\n", + "\\mu: 1 \n", + "Runtime of flow computation: 1.04 sec \n", + "Success: True \t fee: 7567.020msat \t p = 47.70% amt: 5190000sats path hops: 3\n", + "Success: True \t fee: 9203.370msat \t p = 49.19% amt: 5010000sats path hops: 3\n", + "Success: True \t fee: 601.600msat \t p = 74.39% amt: 400000sats path hops: 3\n", + "Success: True \t fee: 1813.660msat \t p = 58.37% amt: 1180000sats path hops: 3\n", + "Success: True \t fee: 1620.780msat \t p = 24.44% amt: 1190000sats path hops: 3\n", + "Success: True \t fee: 475.650msat \t p = 52.76% amt: 350000sats path hops: 3\n", + "Success: True \t fee: 828.940msat \t p = 70.54% amt: 620000sats path hops: 3\n", + "Success: True \t fee: 944.720msat \t p = 90.88% amt: 560000sats path hops: 3\n", + "Success: True \t fee: 2191.840msat \t p = 32.55% amt: 1520000sats path hops: 3\n", + "Success: True \t fee: 380.500msat \t p = 72.73% amt: 250000sats path hops: 4\n", + "Success: True \t fee: 295.290msat \t p = 32.64% amt: 170000sats path hops: 4\n", + "Success: True \t fee: 1965.590msat \t p = 62.34% amt: 1070000sats path hops: 4\n", + "Success: True \t fee: 28.760msat \t p = 74.64% amt: 20000sats path hops: 4\n", + "Success: True \t fee: 57.880msat \t p = 89.08% amt: 40000sats path hops: 4\n", + "Success: True \t fee: 143.800msat \t p = 68.43% amt: 100000sats path hops: 4\n", + "Success: True \t fee: 701.190msat \t p = 12.68% amt: 490000sats path hops: 4\n", + "Success: True \t fee: 270.000msat \t p = 74.42% amt: 200000sats path hops: 4\n", + "Success: True \t fee: 977.350msat \t p = 57.52% amt: 550000sats path hops: 4\n", + "Success: True \t fee: 3510.160msat \t p = 35.47% amt: 2320000sats path hops: 4\n", + "Success: True \t fee: 2411.130msat \t p = 7.35% amt: 1790000sats path hops: 4\n", + "Success: True \t fee: 2612.750msat \t p = 32.16% amt: 1750000sats path hops: 4\n", + "Success: True \t fee: 754.880msat \t p = 22.81% amt: 560000sats path hops: 4\n", + "Success: True \t fee: 770.640msat \t p = 34.42% amt: 520000sats path hops: 4\n", + "Success: True \t fee: 312.800msat \t p = 36.34% amt: 230000sats path hops: 4\n", + "Success: True \t fee: 404.570msat \t p = 38.55% amt: 230000sats path hops: 4\n", + "Success: True \t fee: 371.070msat \t p = 58.35% amt: 210000sats path hops: 4\n", + "Success: True \t fee: 372.330msat \t p = 62.84% amt: 270000sats path hops: 4\n", + "Success: True \t fee: 17.590msat \t p = 96.96% amt: 10000sats path hops: 4\n", + "Success: True \t fee: 229.330msat \t p = 26.26% amt: 170000sats path hops: 4\n", + "Success: True \t fee: 115.120msat \t p = 76.87% amt: 80000sats path hops: 4\n", + "Success: True \t fee: 7715.140msat \t p = 31.63% amt: 5140000sats path hops: 4\n", + "Success: True \t fee: 574.260msat \t p = 93.35% amt: 340000sats path hops: 4\n", + "Success: True \t fee: 79.450msat \t p = 96.69% amt: 50000sats path hops: 4\n", + "Success: True \t fee: 1969.800msat \t p = 1.14% amt: 1470000sats path hops: 4\n", + "Success: True \t fee: 1234.440msat \t p = 47.30% amt: 810000sats path hops: 4\n", + "Success: True \t fee: 69.520msat \t p = 42.23% amt: 40000sats path hops: 5\n", + "Success: True \t fee: 194.920msat \t p = 54.09% amt: 110000sats path hops: 5\n", + "Success: True \t fee: 177.320msat \t p = 81.89% amt: 110000sats path hops: 5\n", + "Success: True \t fee: 223.720msat \t p = 78.74% amt: 140000sats path hops: 5\n", + "Success: True \t fee: 121.320msat \t p = 91.56% amt: 90000sats path hops: 5\n", + "Success: True \t fee: 656.600msat \t p = 47.08% amt: 490000sats path hops: 5\n", + "Success: True \t fee: 579.640msat \t p = 60.58% amt: 430000sats path hops: 5\n", + "Success: True \t fee: 624.840msat \t p = 56.43% amt: 410000sats path hops: 5\n", + "Success: True \t fee: 1889.400msat \t p = 35.43% amt: 1410000sats path hops: 5\n", + "Success: True \t fee: 1611.360msat \t p = 48.70% amt: 1080000sats path hops: 5\n", + "Success: True \t fee: 2328.100msat \t p = 46.26% amt: 1550000sats path hops: 5\n", + "Success: True \t fee: 1199.440msat \t p = 21.04% amt: 880000sats path hops: 5\n", + "Success: True \t fee: 719.040msat \t p = 53.74% amt: 420000sats path hops: 5\n", + "Success: True \t fee: 192.360msat \t p = 72.57% amt: 140000sats path hops: 5\n", + "Success: True \t fee: 695.760msat \t p = 51.96% amt: 520000sats path hops: 5\n", + "Success: True \t fee: 70.280msat \t p = 85.90% amt: 40000sats path hops: 5\n", + "Success: True \t fee: 374.640msat \t p = 3.83% amt: 280000sats path hops: 5\n", + "Success: True \t fee: 32.240msat \t p = 95.97% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 2580.630msat \t p = 17.61% amt: 1690000sats path hops: 6\n", + "Success: True \t fee: 463.200msat \t p = 44.60% amt: 300000sats path hops: 6\n", + "Success: True \t fee: 142.400msat \t p = 79.66% amt: 100000sats path hops: 6\n", + "Success: True \t fee: 544.950msat \t p = 45.76% amt: 350000sats path hops: 7\n", + "Success: True \t fee: 581.020msat \t p = 33.75% amt: 380000sats path hops: 7\n", + "Success: False \t fee: 85.260msat \t p = 68.86% amt: 60000sats path hops: 7\n", + "Success: True \t fee: 72.050msat \t p = 73.63% amt: 50000sats path hops: 7\n", + "Success: True \t fee: 14.950msat \t p = 95.03% amt: 10000sats path hops: 7\n", + "Success: True \t fee: 14.800msat \t p = 47.83% amt: 10000sats path hops: 7\n", + "Success: True \t fee: 28.820msat \t p = 35.74% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 100.100msat \t p = 8.77% amt: 70000sats path hops: 7\n", + "Success: False \t fee: 144.100msat \t p = 61.04% amt: 100000sats path hops: 7\n", + "Success: True \t fee: 76.000msat \t p = 24.55% amt: 50000sats path hops: 7\n", + "Success: True \t fee: 29.380msat \t p = 35.74% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 285.200msat \t p = 65.89% amt: 200000sats path hops: 7\n", + "Success: True \t fee: 17.800msat \t p = 64.71% amt: 10000sats path hops: 7\n", + "Success: True \t fee: 656.040msat \t p = 68.54% amt: 440000sats path hops: 7\n", + "Success: True \t fee: 28.540msat \t p = 92.27% amt: 20000sats path hops: 8\n", + "Success: True \t fee: 527.820msat \t p = 65.43% amt: 380000sats path hops: 8\n", + "Success: True \t fee: 1817.930msat \t p = 16.34% amt: 1070000sats path hops: 8\n", + "Success: True \t fee: 131.580msat \t p = 6.03% amt: 90000sats path hops: 8\n", + "Success: False \t fee: 331.200msat \t p = 51.20% amt: 230000sats path hops: 8\n", + "Success: True \t fee: 246.000msat \t p = 62.11% amt: 150000sats path hops: 8\n", + "Success: True \t fee: 295.020msat \t p = 84.27% amt: 180000sats path hops: 8\n", + "Success: True \t fee: 1085.040msat \t p = 35.96% amt: 660000sats path hops: 8\n", + "Success: True \t fee: 112.160msat \t p = 18.21% amt: 80000sats path hops: 8\n", + "Success: True \t fee: 259.920msat \t p = 64.29% amt: 180000sats path hops: 8\n", + "Success: True \t fee: 121.760msat \t p = 13.35% amt: 80000sats path hops: 10\n", + "total_fee: 76077.570 msat \t paid fees: 75517.010 msat\n", + "\n", + "Try: 390000 sats. Round number: 2\n", + "\\mu: 1 \n", + "Runtime of flow computation: 0.81 sec \n", + "Success: True \t fee: 53.480msat \t p = 98.01% amt: 40000sats path hops: 3\n", + "Success: True \t fee: 467.950msat \t p = 65.98% amt: 350000sats path hops: 4\n", + "total_fee: 521.430 msat \t paid fees: 521.430 msat\n", + "\n", + "SUMMARY:\n", + "Rounds of mcf-computations: 2\n", + "Number of onions sent: 83\n", + "Number of failed onions: 3 failure rate: 3.61% \n", + "total runtime (including inefficient memory managment): 1.853 sec\n", + "Learnt entropy: 67.87 bits\n", + "Fees for successfull delivery: 76038.440 sat --> 1520 ppm\n" + ] + } + ], + "source": [ + "print(\"\\n\\nOTPTIMIZE MAINLY FOR FEES use foaf uncertainty reduction\")\n", + "oracle.reset_uncertainty_network()\n", + "oracle.arcs_to_networkx(0)\n", + "oracle.activate_foaf_uncertainty_reduction(RENE,C_OTTO)\n", + "run_pickhardt_payments_experiment(oracle,RENE,C_OTTO,AMT,mu=1,base=0)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} From de44263bc470017bdbf86bd96e3b54361b7e31bb Mon Sep 17 00:00:00 2001 From: Rene Pickhardt Date: Mon, 28 Mar 2022 19:43:52 +0200 Subject: [PATCH 2/3] added output of one sample run which seemed to have been missing --- Pickhardt-Payments-Simulation.ipynb | 1245 +++++++++++++-------------- 1 file changed, 622 insertions(+), 623 deletions(-) diff --git a/Pickhardt-Payments-Simulation.ipynb b/Pickhardt-Payments-Simulation.ipynb index b846540..ce11498 100644 --- a/Pickhardt-Payments-Simulation.ipynb +++ b/Pickhardt-Payments-Simulation.ipynb @@ -959,61 +959,59 @@ "\n", "Try: 50000000 sats. Round number: 1\n", "\\mu: 0 \n", - "Runtime of flow computation: 1.40 sec \n", + "Runtime of flow computation: 1.43 sec \n", "Success: True \t fee: 6153.950msat \t p = 64.05% amt: 3350000sats path hops: 3\n", - "Success: False \t fee: 2674.000msat \t p = 16.00% amt: 2000000sats path hops: 3\n", - "Success: True \t fee: 2737.130msat \t p = 21.70% amt: 1490000sats path hops: 3\n", - "Success: False \t fee: 7651.530msat \t p = 66.79% amt: 4590000sats path hops: 3\n", - "Success: True \t fee: 312.290msat \t p = 34.50% amt: 170000sats path hops: 4\n", - "Success: True \t fee: 3067.200msat \t p = 46.11% amt: 1350000sats path hops: 4\n", - "Success: True \t fee: 31.640msat \t p = 99.04% amt: 20000sats path hops: 4\n", - "Success: True \t fee: 512.460msat \t p = 70.66% amt: 270000sats path hops: 4\n", - "Success: True \t fee: 799.600msat \t p = 77.45% amt: 400000sats path hops: 4\n", - "Success: False \t fee: 23663.640msat \t p = 22.06% amt: 10920000sats path hops: 4\n", - "Success: False \t fee: 17043.030msat \t p = 68.14% amt: 4090000sats path hops: 4\n", - "Success: True \t fee: 48676.170msat \t p = 17.81% amt: 11910000sats path hops: 5\n", - "Success: True \t fee: 348.460msat \t p = 83.20% amt: 140000sats path hops: 5\n", - "Success: True \t fee: 3176.000msat \t p = 25.09% amt: 2000000sats path hops: 5\n", - "Success: True \t fee: 983.430msat \t p = 24.83% amt: 490000sats path hops: 5\n", - "Success: True \t fee: 650.670msat \t p = 80.56% amt: 410000sats path hops: 5\n", - "Success: False \t fee: 3951.480msat \t p = 75.66% amt: 2040000sats path hops: 5\n", - "Success: True \t fee: 682.860msat \t p = 90.19% amt: 380000sats path hops: 5\n", - "Success: False \t fee: 4769.570msat \t p = 53.50% amt: 2470000sats path hops: 5\n", - "Success: True \t fee: 3519.810msat \t p = 74.24% amt: 1510000sats path hops: 6\n", - "total_fee: 131404.920 msat \t paid fees: 71651.670 msat\n", + "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", + "Success: True \t fee: 3374.000msat \t p = 69.33% amt: 2000000sats path hops: 3\n", + "Success: True \t fee: 312.290msat \t p = 89.94% amt: 170000sats path hops: 3\n", + "Success: False \t fee: 12752.550msat \t p = 47.10% amt: 7650000sats path hops: 3\n", + "Success: True \t fee: 18.370msat \t p = 96.10% amt: 10000sats path hops: 4\n", + "Success: True \t fee: 3248.960msat \t p = 43.40% amt: 1430000sats path hops: 4\n", + "Success: True \t fee: 949.000msat \t p = 87.99% amt: 500000sats path hops: 4\n", + "Success: True \t fee: 1423.500msat \t p = 22.80% amt: 750000sats path hops: 4\n", + "Success: True \t fee: 2738.630msat \t p = 28.11% amt: 1370000sats path hops: 4\n", + "Success: True \t fee: 4052.290msat \t p = 82.72% amt: 1870000sats path hops: 4\n", + "Success: False \t fee: 37961.370msat \t p = 35.89% amt: 9110000sats path hops: 4\n", + "Success: True \t fee: 21620.230msat \t p = 55.79% amt: 5290000sats path hops: 5\n", + "Success: True \t fee: 1617.850msat \t p = 25.35% amt: 650000sats path hops: 5\n", + "Success: True \t fee: 1937.360msat \t p = 50.20% amt: 1220000sats path hops: 5\n", + "Success: True \t fee: 260.910msat \t p = 79.14% amt: 130000sats path hops: 5\n", + "Success: False \t fee: 13636.480msat \t p = 32.44% amt: 7040000sats path hops: 5\n", + "Success: True \t fee: 2300.160msat \t p = 68.51% amt: 1280000sats path hops: 5\n", + "Success: True \t fee: 6468.850msat \t p = 41.34% amt: 3350000sats path hops: 5\n", + "Success: True \t fee: 1515.150msat \t p = 88.25% amt: 650000sats path hops: 6\n", + "Success: True \t fee: 2757.090msat \t p = 90.46% amt: 570000sats path hops: 7\n", + "total_fee: 127251.560 msat \t paid fees: 62901.160 msat\n", "\n", - "Try: 26110000 sats. Round number: 2\n", + "Try: 23800000 sats. Round number: 2\n", "\\mu: 0 \n", - "Runtime of flow computation: 0.80 sec \n", + "Runtime of flow computation: 0.79 sec \n", "Success: True \t fee: 6153.950msat \t p = 64.05% amt: 3350000sats path hops: 3\n", - "Success: True \t fee: 2737.130msat \t p = 21.70% amt: 1490000sats path hops: 3\n", - "Success: True \t fee: 2583.850msat \t p = 88.29% amt: 1550000sats path hops: 3\n", - "Success: True \t fee: 312.290msat \t p = 34.50% amt: 170000sats path hops: 4\n", - "Success: True \t fee: 3067.200msat \t p = 46.11% amt: 1350000sats path hops: 4\n", - "Success: True \t fee: 31.640msat \t p = 99.04% amt: 20000sats path hops: 4\n", - "Success: True \t fee: 799.600msat \t p = 77.45% amt: 400000sats path hops: 4\n", - "Success: False \t fee: 9274.760msat \t p = 63.00% amt: 4280000sats path hops: 4\n", - "Success: True \t fee: 512.460msat \t p = 70.66% amt: 270000sats path hops: 4\n", - "Success: True \t fee: 13252.450msat \t p = 44.36% amt: 6350000sats path hops: 5\n", - "Success: True \t fee: 20353.260msat \t p = 58.02% amt: 4980000sats path hops: 5\n", - "Success: True \t fee: 650.670msat \t p = 80.56% amt: 410000sats path hops: 5\n", - "Success: True \t fee: 3473.190msat \t p = 74.54% amt: 1490000sats path hops: 6\n", - "total_fee: 63202.450 msat \t paid fees: 53927.690 msat\n", - "\n", - "Try: 4280000 sats. Round number: 3\n", - "\\mu: 0 \n", - "Runtime of flow computation: 0.90 sec \n", - "Success: True \t fee: 767.600msat \t p = 77.07% amt: 400000sats path hops: 5\n", - "Success: True \t fee: 15857.560msat \t p = 66.27% amt: 3880000sats path hops: 5\n", - "total_fee: 16625.160 msat \t paid fees: 16625.160 msat\n", + "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", + "Success: True \t fee: 3374.000msat \t p = 69.33% amt: 2000000sats path hops: 3\n", + "Success: True \t fee: 312.290msat \t p = 89.94% amt: 170000sats path hops: 3\n", + "Success: True \t fee: 4284.190msat \t p = 80.86% amt: 2570000sats path hops: 3\n", + "Success: True \t fee: 18.370msat \t p = 96.10% amt: 10000sats path hops: 4\n", + "Success: True \t fee: 3248.960msat \t p = 43.40% amt: 1430000sats path hops: 4\n", + "Success: True \t fee: 2738.630msat \t p = 28.11% amt: 1370000sats path hops: 4\n", + "Success: True \t fee: 4052.290msat \t p = 82.72% amt: 1870000sats path hops: 4\n", + "Success: True \t fee: 166.680msat \t p = 99.66% amt: 40000sats path hops: 4\n", + "Success: True \t fee: 759.200msat \t p = 90.32% amt: 400000sats path hops: 4\n", + "Success: True \t fee: 664.300msat \t p = 62.30% amt: 350000sats path hops: 4\n", + "Success: True \t fee: 15121.900msat \t p = 67.67% amt: 3700000sats path hops: 5\n", + "Success: True \t fee: 1617.850msat \t p = 25.35% amt: 650000sats path hops: 5\n", + "Success: True \t fee: 260.910msat \t p = 79.14% amt: 130000sats path hops: 5\n", + "Success: True \t fee: 1437.600msat \t p = 79.81% amt: 800000sats path hops: 5\n", + "Success: True \t fee: 6468.850msat \t p = 41.34% amt: 3350000sats path hops: 5\n", + "total_fee: 52832.540 msat \t paid fees: 52832.540 msat\n", "\n", "SUMMARY:\n", - "Rounds of mcf-computations: 3\n", - "Number of onions sent: 35\n", - "Number of failed onions: 7 failure rate: 20.00% \n", - "total runtime (including inefficient memory managment): 3.101 sec\n", - "Learnt entropy: 149.18 bits\n", - "Fees for successfull delivery: 142204.520 sat --> 2844 ppm\n" + "Rounds of mcf-computations: 2\n", + "Number of onions sent: 38\n", + "Number of failed onions: 3 failure rate: 7.89% \n", + "total runtime (including inefficient memory managment): 2.223 sec\n", + "Learnt entropy: 157.24 bits\n", + "Fees for successfull delivery: 115733.700 sat --> 2314 ppm\n" ] } ], @@ -1041,72 +1039,62 @@ "\n", "Try: 50000000 sats. Round number: 1\n", "\\mu: 1 \n", - "Runtime of flow computation: 0.93 sec \n", + "Runtime of flow computation: 1.23 sec \n", "Success: False \t fee: 14652.900msat \t p = 16.08% amt: 10050000sats path hops: 3\n", - "Success: True \t fee: 9313.590msat \t p = 48.69% amt: 5070000sats path hops: 3\n", - "Success: True \t fee: 601.600msat \t p = 74.39% amt: 400000sats path hops: 3\n", + "Success: True \t fee: 6631.570msat \t p = 61.60% amt: 3610000sats path hops: 3\n", + "Success: True \t fee: 2060.480msat \t p = 23.93% amt: 1370000sats path hops: 3\n", "Success: True \t fee: 1537.000msat \t p = 64.00% amt: 1000000sats path hops: 3\n", - "Success: True \t fee: 195.720msat \t p = 81.89% amt: 140000sats path hops: 3\n", - "Success: False \t fee: 3222.170msat \t p = 2.73% amt: 2410000sats path hops: 3\n", - "Success: False \t fee: 3374.000msat \t p = 69.33% amt: 2000000sats path hops: 3\n", + "Success: True \t fee: 908.700msat \t p = 23.40% amt: 650000sats path hops: 3\n", + "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", + "Success: True \t fee: 6748.000msat \t p = 44.00% amt: 4000000sats path hops: 3\n", "Success: True \t fee: 1153.600msat \t p = 60.00% amt: 800000sats path hops: 3\n", - "Success: True \t fee: 2737.130msat \t p = 21.70% amt: 1490000sats path hops: 3\n", - "Success: True \t fee: 4297.800msat \t p = 69.70% amt: 2600000sats path hops: 4\n", - "Success: True \t fee: 312.290msat \t p = 34.50% amt: 170000sats path hops: 4\n", - "Success: False \t fee: 16933.290msat \t p = 25.58% amt: 10670000sats path hops: 4\n", - "Success: True \t fee: 625.860msat \t p = 89.96% amt: 380000sats path hops: 4\n", - "Success: True \t fee: 294.660msat \t p = 92.60% amt: 180000sats path hops: 4\n", - "Success: False \t fee: 2127.420msat \t p = 33.24% amt: 1590000sats path hops: 4\n", - "Success: True \t fee: 5028.350msat \t p = 49.75% amt: 3350000sats path hops: 4\n", - "Success: True \t fee: 1072.000msat \t p = 35.34% amt: 800000sats path hops: 4\n", + "Success: True \t fee: 312.290msat \t p = 89.94% amt: 170000sats path hops: 3\n", + "Success: True \t fee: 3454.770msat \t p = 75.12% amt: 2090000sats path hops: 4\n", + "Success: True \t fee: 18.370msat \t p = 96.10% amt: 10000sats path hops: 4\n", + "Success: False \t fee: 15743.040msat \t p = 29.51% amt: 9920000sats path hops: 4\n", + "Success: True \t fee: 2108.160msat \t p = 67.86% amt: 1280000sats path hops: 4\n", + "Success: True \t fee: 900.350msat \t p = 78.34% amt: 550000sats path hops: 4\n", + "Success: True \t fee: 1993.620msat \t p = 36.45% amt: 1490000sats path hops: 4\n", + "Success: False \t fee: 3392.260msat \t p = 63.59% amt: 2260000sats path hops: 4\n", + "Success: True \t fee: 5067.000msat \t p = 51.20% amt: 3000000sats path hops: 4\n", + "Success: False \t fee: 991.600msat \t p = 39.26% amt: 740000sats path hops: 4\n", "Success: True \t fee: 1617.000msat \t p = 50.67% amt: 1000000sats path hops: 4\n", - "Success: True \t fee: 1502.900msat \t p = 58.90% amt: 950000sats path hops: 4\n", "Success: True \t fee: 3236.000msat \t p = 56.47% amt: 2000000sats path hops: 4\n", - "Success: False \t fee: 1518.000msat \t p = 70.81% amt: 1000000sats path hops: 4\n", - "Success: True \t fee: 1234.440msat \t p = 47.30% amt: 810000sats path hops: 4\n", - "Success: True \t fee: 1098.900msat \t p = 19.62% amt: 740000sats path hops: 4\n", - "Success: True \t fee: 547.600msat \t p = 77.99% amt: 400000sats path hops: 5\n", - "total_fee: 78234.220 msat \t paid fees: 36406.440 msat\n", + "Success: True \t fee: 407.680msat \t p = 69.08% amt: 260000sats path hops: 4\n", + "Success: True \t fee: 1518.000msat \t p = 70.81% amt: 1000000sats path hops: 4\n", + "Success: False \t fee: 1524.000msat \t p = 37.50% amt: 1000000sats path hops: 4\n", + "Success: True \t fee: 191.660msat \t p = 91.92% amt: 140000sats path hops: 5\n", + "total_fee: 78320.620 msat \t paid fees: 42016.820 msat\n", "\n", - "Try: 27720000 sats. Round number: 2\n", + "Try: 23970000 sats. Round number: 2\n", "\\mu: 1 \n", - "Runtime of flow computation: 0.99 sec \n", - "Success: True \t fee: 5861.160msat \t p = 57.82% amt: 4020000sats path hops: 3\n", - "Success: True \t fee: 601.600msat \t p = 74.39% amt: 400000sats path hops: 3\n", + "Runtime of flow computation: 1.37 sec \n", + "Success: True \t fee: 2930.580msat \t p = 77.47% amt: 2010000sats path hops: 3\n", + "Success: True \t fee: 2060.480msat \t p = 23.93% amt: 1370000sats path hops: 3\n", "Success: True \t fee: 1537.000msat \t p = 64.00% amt: 1000000sats path hops: 3\n", - "Success: True \t fee: 195.720msat \t p = 81.89% amt: 140000sats path hops: 3\n", + "Success: True \t fee: 908.700msat \t p = 23.40% amt: 650000sats path hops: 3\n", + "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", + "Success: True \t fee: 4622.380msat \t p = 59.34% amt: 2740000sats path hops: 3\n", "Success: True \t fee: 1153.600msat \t p = 60.00% amt: 800000sats path hops: 3\n", - "Success: True \t fee: 9256.800msat \t p = 42.61% amt: 5600000sats path hops: 4\n", - "Success: True \t fee: 2459.850msat \t p = 86.58% amt: 1550000sats path hops: 4\n", - "Success: True \t fee: 625.860msat \t p = 89.96% amt: 380000sats path hops: 4\n", - "Success: True \t fee: 294.660msat \t p = 92.60% amt: 180000sats path hops: 4\n", - "Success: True \t fee: 5028.350msat \t p = 49.75% amt: 3350000sats path hops: 4\n", - "Success: True \t fee: 1072.000msat \t p = 35.34% amt: 800000sats path hops: 4\n", - "Success: False \t fee: 2048.670msat \t p = 29.51% amt: 1530000sats path hops: 4\n", + "Success: True \t fee: 3454.770msat \t p = 75.12% amt: 2090000sats path hops: 4\n", + "Success: True \t fee: 8538.060msat \t p = 57.36% amt: 5380000sats path hops: 4\n", + "Success: True \t fee: 2108.160msat \t p = 67.86% amt: 1280000sats path hops: 4\n", + "Success: True \t fee: 900.350msat \t p = 78.34% amt: 550000sats path hops: 4\n", "Success: True \t fee: 1617.000msat \t p = 50.67% amt: 1000000sats path hops: 4\n", - "Success: True \t fee: 1502.900msat \t p = 58.90% amt: 950000sats path hops: 4\n", - "Success: True \t fee: 3236.000msat \t p = 56.47% amt: 2000000sats path hops: 4\n", - "Success: True \t fee: 1203.840msat \t p = 56.04% amt: 880000sats path hops: 4\n", - "Success: True \t fee: 1234.440msat \t p = 47.30% amt: 810000sats path hops: 4\n", - "Success: True \t fee: 1098.900msat \t p = 19.62% amt: 740000sats path hops: 4\n", - "Success: True \t fee: 1971.360msat \t p = 34.87% amt: 1440000sats path hops: 5\n", - "Success: True \t fee: 207.900msat \t p = 90.79% amt: 150000sats path hops: 5\n", - "total_fee: 42207.610 msat \t paid fees: 40158.940 msat\n", - "\n", - "Try: 1530000 sats. Round number: 3\n", - "\\mu: 1 \n", - "Runtime of flow computation: 1.82 sec \n", - "Success: True \t fee: 1072.000msat \t p = 35.34% amt: 800000sats path hops: 4\n", - "Success: True \t fee: 998.640msat \t p = 62.81% amt: 730000sats path hops: 4\n", - "total_fee: 2070.640 msat \t paid fees: 2070.640 msat\n", + "Success: True \t fee: 970.800msat \t p = 85.24% amt: 600000sats path hops: 4\n", + "Success: True \t fee: 407.680msat \t p = 69.08% amt: 260000sats path hops: 4\n", + "Success: True \t fee: 1518.000msat \t p = 70.81% amt: 1000000sats path hops: 4\n", + "Success: True \t fee: 1996.600msat \t p = 32.83% amt: 1490000sats path hops: 5\n", + "Success: True \t fee: 191.660msat \t p = 91.92% amt: 140000sats path hops: 5\n", + "total_fee: 37068.390 msat \t paid fees: 37068.390 msat\n", "\n", "SUMMARY:\n", - "Rounds of mcf-computations: 3\n", - "Number of onions sent: 46\n", - "Number of failed onions: 7 failure rate: 15.22% \n", - "total runtime (including inefficient memory managment): 3.753 sec\n", - "Learnt entropy: 151.30 bits\n", - "Fees for successfull delivery: 78636.020 sat --> 1572 ppm\n" + "Rounds of mcf-computations: 2\n", + "Number of onions sent: 41\n", + "Number of failed onions: 5 failure rate: 12.20% \n", + "total runtime (including inefficient memory managment): 2.609 sec\n", + "Learnt entropy: 166.14 bits\n", + "Fees for successfull delivery: 79085.210 sat --> 1581 ppm\n" ] } ], @@ -1135,159 +1123,143 @@ "\n", "Try: 50000000 sats. Round number: 1\n", "\\mu: 100 \n", - "Runtime of flow computation: 1.23 sec \n", - "Success: False \t fee: 8383.500msat \t p = 43.20% amt: 5750000sats path hops: 3\n", - "Success: True \t fee: 601.600msat \t p = 74.39% amt: 400000sats path hops: 3\n", + "Runtime of flow computation: 1.28 sec \n", + "Success: True \t fee: 8354.340msat \t p = 43.36% amt: 5730000sats path hops: 3\n", + "Success: True \t fee: 1338.560msat \t p = 46.83% amt: 890000sats path hops: 3\n", "Success: True \t fee: 1089.600msat \t p = 44.00% amt: 800000sats path hops: 3\n", - "Success: False \t fee: 1127.970msat \t p = 8.49% amt: 830000sats path hops: 3\n", - "Success: False \t fee: 3222.170msat \t p = 2.73% amt: 2410000sats path hops: 3\n", - "Success: False \t fee: 4095.280msat \t p = 3.26% amt: 2840000sats path hops: 3\n", - "Success: False \t fee: 86.820msat \t p = 83.86% amt: 60000sats path hops: 4\n", + "Success: False \t fee: 1087.200msat \t p = 10.57% amt: 800000sats path hops: 3\n", + "Success: False \t fee: 3061.730msat \t p = 6.48% amt: 2290000sats path hops: 3\n", + "Success: False \t fee: 4037.600msat \t p = 3.75% amt: 2800000sats path hops: 3\n", + "Success: True \t fee: 318.340msat \t p = 47.75% amt: 220000sats path hops: 4\n", "Success: False \t fee: 230.080msat \t p = 51.83% amt: 160000sats path hops: 4\n", - "Success: True \t fee: 701.190msat \t p = 12.68% amt: 490000sats path hops: 4\n", - "Success: False \t fee: 783.000msat \t p = 38.00% amt: 580000sats path hops: 4\n", - "Success: True \t fee: 405.810msat \t p = 90.76% amt: 270000sats path hops: 4\n", + "Success: False \t fee: 386.370msat \t p = 45.34% amt: 270000sats path hops: 4\n", + "Success: False \t fee: 675.000msat \t p = 44.44% amt: 500000sats path hops: 4\n", "Success: True \t fee: 409.200msat \t p = 66.46% amt: 300000sats path hops: 4\n", - "Success: True \t fee: 539.200msat \t p = 38.40% amt: 400000sats path hops: 4\n", + "Success: False \t fee: 539.200msat \t p = 38.40% amt: 400000sats path hops: 4\n", "Success: False \t fee: 1078.400msat \t p = 40.48% amt: 800000sats path hops: 4\n", - "Success: False \t fee: 3933.720msat \t p = 1.00% amt: 2940000sats path hops: 4\n", + "Success: False \t fee: 3625.980msat \t p = 5.14% amt: 2710000sats path hops: 4\n", "Success: True \t fee: 66.900msat \t p = 78.60% amt: 50000sats path hops: 4\n", "Success: False \t fee: 1144.570msat \t p = 10.26% amt: 830000sats path hops: 4\n", - "Success: True \t fee: 229.330msat \t p = 26.26% amt: 170000sats path hops: 4\n", - "Success: False \t fee: 477.750msat \t p = 71.17% amt: 350000sats path hops: 4\n", - "Success: True \t fee: 1969.800msat \t p = 1.14% amt: 1470000sats path hops: 4\n", - "Success: False \t fee: 576.000msat \t p = 40.49% amt: 400000sats path hops: 5\n", - "Success: True \t fee: 57.960msat \t p = 91.15% amt: 40000sats path hops: 5\n", - "Success: False \t fee: 407.100msat \t p = 56.07% amt: 300000sats path hops: 5\n", - "Success: False \t fee: 950.600msat \t p = 30.12% amt: 700000sats path hops: 5\n", + "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", + "Success: True \t fee: 354.900msat \t p = 78.08% amt: 260000sats path hops: 4\n", + "Success: False \t fee: 1795.600msat \t p = 6.46% amt: 1340000sats path hops: 4\n", + "Success: True \t fee: 576.000msat \t p = 40.49% amt: 400000sats path hops: 5\n", + "Success: True \t fee: 492.660msat \t p = 41.10% amt: 340000sats path hops: 5\n", + "Success: True \t fee: 407.100msat \t p = 56.07% amt: 300000sats path hops: 5\n", + "Success: False \t fee: 896.280msat \t p = 32.70% amt: 660000sats path hops: 5\n", "Success: False \t fee: 5668.000msat \t p = 0.00% amt: 4000000sats path hops: 5\n", - "Success: True \t fee: 567.600msat \t p = 55.65% amt: 400000sats path hops: 5\n", - "Success: True \t fee: 855.000msat \t p = 52.92% amt: 600000sats path hops: 5\n", - "Success: False \t fee: 818.400msat \t p = 18.28% amt: 600000sats path hops: 5\n", - "Success: True \t fee: 348.660msat \t p = 14.24% amt: 260000sats path hops: 5\n", - "Success: False \t fee: 1281.600msat \t p = 12.52% amt: 900000sats path hops: 5\n", - "Success: False \t fee: 2637.200msat \t p = 25.22% amt: 1900000sats path hops: 5\n", - "Success: False \t fee: 278.000msat \t p = 74.26% amt: 200000sats path hops: 5\n", + "Success: False \t fee: 567.600msat \t p = 55.65% amt: 400000sats path hops: 5\n", + "Success: False \t fee: 769.500msat \t p = 56.77% amt: 540000sats path hops: 5\n", + "Success: True \t fee: 818.400msat \t p = 18.28% amt: 600000sats path hops: 5\n", + "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", + "Success: False \t fee: 1537.920msat \t p = 5.94% amt: 1080000sats path hops: 5\n", + "Success: False \t fee: 2831.520msat \t p = 22.21% amt: 2040000sats path hops: 5\n", + "Success: True \t fee: 278.000msat \t p = 74.26% amt: 200000sats path hops: 5\n", + "Success: True \t fee: 102.760msat \t p = 96.14% amt: 70000sats path hops: 5\n", "Success: True \t fee: 293.600msat \t p = 59.68% amt: 200000sats path hops: 5\n", "Success: False \t fee: 81.660msat \t p = 65.60% amt: 60000sats path hops: 6\n", - "Success: False \t fee: 831.000msat \t p = 13.20% amt: 600000sats path hops: 6\n", + "Success: True \t fee: 1011.050msat \t p = 5.76% amt: 730000sats path hops: 6\n", "Success: True \t fee: 271.600msat \t p = 63.79% amt: 200000sats path hops: 6\n", "Success: False \t fee: 5399.800msat \t p = 2.76% amt: 3800000sats path hops: 6\n", - "Success: True \t fee: 136.200msat \t p = 80.46% amt: 100000sats path hops: 6\n", - "Success: True \t fee: 97.300msat \t p = 90.28% amt: 70000sats path hops: 6\n", - "Success: True \t fee: 41.700msat \t p = 98.02% amt: 30000sats path hops: 6\n", - "Success: False \t fee: 176.930msat \t p = 45.23% amt: 130000sats path hops: 6\n", - "Success: False \t fee: 4410.000msat \t p = 7.36% amt: 3000000sats path hops: 6\n", - "Success: True \t fee: 689.500msat \t p = 43.05% amt: 500000sats path hops: 6\n", - "Success: True \t fee: 272.000msat \t p = 47.11% amt: 200000sats path hops: 6\n", - "Success: True \t fee: 13.410msat \t p = 93.65% amt: 10000sats path hops: 6\n", + "Success: True \t fee: 177.060msat \t p = 75.11% amt: 130000sats path hops: 6\n", + "Success: True \t fee: 190.540msat \t p = 41.79% amt: 140000sats path hops: 6\n", + "Success: True \t fee: 54.520msat \t p = 80.83% amt: 40000sats path hops: 6\n", + "Success: False \t fee: 4307.100msat \t p = 8.05% amt: 2930000sats path hops: 6\n", + "Success: True \t fee: 744.660msat \t p = 39.85% amt: 540000sats path hops: 6\n", + "Success: False \t fee: 272.000msat \t p = 47.11% amt: 200000sats path hops: 6\n", "Success: False \t fee: 166.800msat \t p = 33.26% amt: 120000sats path hops: 6\n", - "Success: False \t fee: 147.620msat \t p = 42.26% amt: 110000sats path hops: 7\n", - "Success: True \t fee: 362.070msat \t p = 41.25% amt: 270000sats path hops: 7\n", + "Success: True \t fee: 40.530msat \t p = 73.18% amt: 30000sats path hops: 7\n", + "Success: False \t fee: 348.920msat \t p = 4.37% amt: 260000sats path hops: 7\n", + "Success: True \t fee: 122.580msat \t p = 58.86% amt: 90000sats path hops: 7\n", "Success: False \t fee: 682.560msat \t p = 60.01% amt: 480000sats path hops: 7\n", "Success: True \t fee: 69.100msat \t p = 37.10% amt: 50000sats path hops: 7\n", - "Success: True \t fee: 110.640msat \t p = 67.35% amt: 80000sats path hops: 7\n", - "Success: True \t fee: 135.900msat \t p = 78.69% amt: 100000sats path hops: 7\n", - "Success: True \t fee: 588.400msat \t p = 46.70% amt: 400000sats path hops: 7\n", - "Success: False \t fee: 2583.540msat \t p = 17.34% amt: 1860000sats path hops: 7\n", + "Success: True \t fee: 138.300msat \t p = 60.54% amt: 100000sats path hops: 7\n", + "Success: False \t fee: 135.900msat \t p = 78.69% amt: 100000sats path hops: 7\n", + "Success: False \t fee: 588.400msat \t p = 46.70% amt: 400000sats path hops: 7\n", + "Success: False \t fee: 2778.000msat \t p = 14.66% amt: 2000000sats path hops: 7\n", + "Success: True \t fee: 85.260msat \t p = 94.30% amt: 60000sats path hops: 7\n", "Success: True \t fee: 1799.590msat \t p = 32.64% amt: 1270000sats path hops: 7\n", - "Success: True \t fee: 228.140msat \t p = 71.01% amt: 170000sats path hops: 7\n", - "Success: False \t fee: 515.660msat \t p = 40.36% amt: 380000sats path hops: 7\n", - "Success: True \t fee: 27.100msat \t p = 94.72% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 558.600msat \t p = 60.08% amt: 380000sats path hops: 7\n", - "Success: False \t fee: 26.840msat \t p = 73.70% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 135.200msat \t p = 67.64% amt: 100000sats path hops: 8\n", - "Success: False \t fee: 1854.720msat \t p = 31.31% amt: 1260000sats path hops: 8\n", + "Success: True \t fee: 254.980msat \t p = 68.01% amt: 190000sats path hops: 7\n", + "Success: True \t fee: 26.840msat \t p = 73.70% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 308.200msat \t p = 54.63% amt: 230000sats path hops: 7\n", + "Success: True \t fee: 230.350msat \t p = 61.96% amt: 170000sats path hops: 7\n", + "Success: True \t fee: 312.110msat \t p = 57.58% amt: 230000sats path hops: 8\n", + "Success: False \t fee: 135.200msat \t p = 67.64% amt: 100000sats path hops: 8\n", + "Success: False \t fee: 1472.000msat \t p = 40.64% amt: 1000000sats path hops: 8\n", "Success: False \t fee: 536.800msat \t p = 23.29% amt: 400000sats path hops: 9\n", - "Success: False \t fee: 1069.380msat \t p = 14.13% amt: 780000sats path hops: 10\n", - "Success: True \t fee: 124.110msat \t p = 83.41% amt: 90000sats path hops: 10\n", - "Success: False \t fee: 493.920msat \t p = 50.28% amt: 360000sats path hops: 10\n", - "Success: False \t fee: 110.160msat \t p = 57.68% amt: 80000sats path hops: 10\n", - "Success: True \t fee: 27.540msat \t p = 87.44% amt: 20000sats path hops: 10\n", - "Success: True \t fee: 140.300msat \t p = 53.87% amt: 100000sats path hops: 11\n", - "total_fee: 70231.400 msat \t paid fees: 13963.850 msat\n", + "Success: True \t fee: 138.500msat \t p = 57.06% amt: 100000sats path hops: 10\n", + "Success: True \t fee: 425.320msat \t p = 55.58% amt: 310000sats path hops: 10\n", + "Success: False \t fee: 712.920msat \t p = 29.03% amt: 520000sats path hops: 10\n", + "Success: False \t fee: 537.810msat \t p = 43.65% amt: 390000sats path hops: 10\n", + "Success: True \t fee: 138.400msat \t p = 48.69% amt: 100000sats path hops: 10\n", + "Success: True \t fee: 84.600msat \t p = 69.93% amt: 60000sats path hops: 11\n", + "Success: True \t fee: 42.240msat \t p = 84.00% amt: 30000sats path hops: 12\n", + "total_fee: 70246.670 msat \t paid fees: 22158.250 msat\n", "\n", - "Try: 39990000 sats. Round number: 2\n", + "Try: 34380000 sats. Round number: 2\n", "\\mu: 100 \n", - "Runtime of flow computation: 1.44 sec \n", - "Success: False \t fee: 8383.500msat \t p = 43.20% amt: 5750000sats path hops: 3\n", - "Success: True \t fee: 300.800msat \t p = 86.84% amt: 200000sats path hops: 3\n", - "Success: True \t fee: 1552.680msat \t p = 26.66% amt: 1140000sats path hops: 3\n", - "Success: False \t fee: 964.890msat \t p = 17.34% amt: 710000sats path hops: 3\n", - "Success: True \t fee: 267.400msat \t p = 90.16% amt: 200000sats path hops: 3\n", - "Success: False \t fee: 3691.520msat \t p = 7.20% amt: 2560000sats path hops: 3\n", - "Success: True \t fee: 701.190msat \t p = 12.68% amt: 490000sats path hops: 4\n", - "Success: True \t fee: 148.500msat \t p = 85.34% amt: 110000sats path hops: 4\n", - "Success: True \t fee: 1212.300msat \t p = 36.74% amt: 900000sats path hops: 4\n", - "Success: True \t fee: 736.560msat \t p = 45.21% amt: 540000sats path hops: 4\n", - "Success: True \t fee: 727.920msat \t p = 24.51% amt: 540000sats path hops: 4\n", - "Success: True \t fee: 136.000msat \t p = 68.08% amt: 100000sats path hops: 4\n", - "Success: True \t fee: 482.040msat \t p = 59.03% amt: 360000sats path hops: 4\n", - "Success: True \t fee: 175.110msat \t p = 86.95% amt: 130000sats path hops: 4\n", - "Success: False \t fee: 979.090msat \t p = 18.99% amt: 710000sats path hops: 4\n", - "Success: True \t fee: 229.330msat \t p = 26.26% amt: 170000sats path hops: 4\n", - "Success: True \t fee: 1969.800msat \t p = 1.14% amt: 1470000sats path hops: 4\n", - "Success: True \t fee: 1097.980msat \t p = 58.32% amt: 820000sats path hops: 4\n", - "Success: True \t fee: 268.600msat \t p = 57.76% amt: 200000sats path hops: 5\n", - "Success: False \t fee: 5384.600msat \t p = 0.72% amt: 3800000sats path hops: 5\n", - "Success: False \t fee: 682.000msat \t p = 27.32% amt: 500000sats path hops: 5\n", - "Success: True \t fee: 115.920msat \t p = 82.85% amt: 80000sats path hops: 5\n", - "Success: False \t fee: 1211.250msat \t p = 38.71% amt: 850000sats path hops: 5\n", - "Success: True \t fee: 348.660msat \t p = 14.24% amt: 260000sats path hops: 5\n", - "Success: True \t fee: 908.160msat \t p = 31.88% amt: 640000sats path hops: 5\n", - "Success: True \t fee: 1404.000msat \t p = 26.15% amt: 1040000sats path hops: 5\n", - "Success: False \t fee: 3939.600msat \t p = 0.80% amt: 2940000sats path hops: 5\n", - "Success: True \t fee: 67.000msat \t p = 78.34% amt: 50000sats path hops: 5\n", - "Success: True \t fee: 440.400msat \t p = 44.09% amt: 300000sats path hops: 5\n", - "Success: False \t fee: 304.260msat \t p = 56.14% amt: 220000sats path hops: 6\n", - "Success: True \t fee: 144.800msat \t p = 72.59% amt: 100000sats path hops: 6\n", - "Success: True \t fee: 488.880msat \t p = 42.04% amt: 360000sats path hops: 6\n", - "Success: True \t fee: 246.240msat \t p = 62.40% amt: 180000sats path hops: 6\n", - "Success: False \t fee: 673.980msat \t p = 41.97% amt: 470000sats path hops: 6\n", - "Success: True \t fee: 3438.820msat \t p = 15.85% amt: 2420000sats path hops: 6\n", - "Success: False \t fee: 584.400msat \t p = 46.94% amt: 400000sats path hops: 6\n", - "Success: False \t fee: 755.780msat \t p = 34.75% amt: 530000sats path hops: 6\n", - "Success: False \t fee: 1028.600msat \t p = 59.17% amt: 740000sats path hops: 6\n", - "Success: True \t fee: 13.610msat \t p = 95.08% amt: 10000sats path hops: 6\n", - "Success: True \t fee: 543.900msat \t p = 78.76% amt: 370000sats path hops: 6\n", - "Success: True \t fee: 748.680msat \t p = 52.31% amt: 510000sats path hops: 6\n", - "Success: True \t fee: 702.270msat \t p = 30.82% amt: 510000sats path hops: 6\n", - "Success: True \t fee: 228.820msat \t p = 73.30% amt: 170000sats path hops: 6\n", - "Success: True \t fee: 124.380msat \t p = 5.58% amt: 90000sats path hops: 7\n", - "Success: True \t fee: 122.580msat \t p = 58.86% amt: 90000sats path hops: 7\n", - "Success: False \t fee: 1074.060msat \t p = 21.09% amt: 780000sats path hops: 7\n", - "Success: True \t fee: 289.590msat \t p = 70.32% amt: 210000sats path hops: 7\n", - "Success: True \t fee: 242.640msat \t p = 45.49% amt: 180000sats path hops: 7\n", - "Success: True \t fee: 83.640msat \t p = 86.52% amt: 60000sats path hops: 7\n", - "Success: False \t fee: 107.360msat \t p = 55.03% amt: 80000sats path hops: 7\n", - "Success: True \t fee: 174.330msat \t p = 66.75% amt: 130000sats path hops: 7\n", - "Success: True \t fee: 110.640msat \t p = 66.78% amt: 80000sats path hops: 8\n", - "Success: True \t fee: 135.900msat \t p = 77.87% amt: 100000sats path hops: 8\n", - "Success: True \t fee: 27.140msat \t p = 95.54% amt: 20000sats path hops: 8\n", - "Success: True \t fee: 57.000msat \t p = 92.08% amt: 40000sats path hops: 8\n", - "Success: True \t fee: 14.450msat \t p = 98.67% amt: 10000sats path hops: 8\n", - "Success: True \t fee: 588.400msat \t p = 44.73% amt: 400000sats path hops: 8\n", - "Success: False \t fee: 1111.200msat \t p = 46.91% amt: 800000sats path hops: 8\n", - "Success: True \t fee: 559.360msat \t p = 72.25% amt: 380000sats path hops: 8\n", - "Success: False \t fee: 124.110msat \t p = 79.82% amt: 90000sats path hops: 9\n", - "Success: True \t fee: 107.360msat \t p = 78.00% amt: 80000sats path hops: 9\n", - "Success: True \t fee: 14.230msat \t p = 97.88% amt: 10000sats path hops: 9\n", - "Success: True \t fee: 142.000msat \t p = 68.25% amt: 100000sats path hops: 9\n", - "Success: True \t fee: 417.600msat \t p = 57.44% amt: 290000sats path hops: 9\n", - "Success: True \t fee: 216.000msat \t p = 73.64% amt: 150000sats path hops: 10\n", - "Success: True \t fee: 345.600msat \t p = 57.68% amt: 240000sats path hops: 10\n", - "Success: True \t fee: 82.260msat \t p = 86.57% amt: 60000sats path hops: 10\n", - "Success: True \t fee: 109.760msat \t p = 86.39% amt: 80000sats path hops: 10\n", - "Success: True \t fee: 55.080msat \t p = 76.70% amt: 40000sats path hops: 10\n", - "Success: True \t fee: 28.060msat \t p = 89.39% amt: 20000sats path hops: 11\n", - "Success: True \t fee: 140.300msat \t p = 54.95% amt: 100000sats path hops: 11\n", - "Success: True \t fee: 187.330msat \t p = 77.99% amt: 130000sats path hops: 11\n", - "Success: True \t fee: 475.530msat \t p = 56.62% amt: 330000sats path hops: 11\n", - "Success: True \t fee: 245.140msat \t p = 73.24% amt: 170000sats path hops: 11\n", - "Success: True \t fee: 144.100msat \t p = 82.91% amt: 100000sats path hops: 11\n", - "total_fee: 56086.970 msat \t paid fees: 25086.770 msat\n", + "Runtime of flow computation: 1.22 sec \n", + "Success: True \t fee: 9360.360msat \t p = 38.11% amt: 6420000sats path hops: 3\n", + "Success: True \t fee: 1416.480msat \t p = 31.36% amt: 1040000sats path hops: 3\n", + "Success: False \t fee: 706.680msat \t p = 34.37% amt: 520000sats path hops: 3\n", + "Success: False \t fee: 2847.810msat \t p = 11.65% amt: 2130000sats path hops: 3\n", + "Success: False \t fee: 3662.680msat \t p = 7.53% amt: 2540000sats path hops: 3\n", + "Success: True \t fee: 318.340msat \t p = 47.75% amt: 220000sats path hops: 4\n", + "Success: True \t fee: 100.170msat \t p = 84.19% amt: 70000sats path hops: 4\n", + "Success: True \t fee: 135.000msat \t p = 86.61% amt: 100000sats path hops: 4\n", + "Success: True \t fee: 409.200msat \t p = 66.46% amt: 300000sats path hops: 4\n", + "Success: False \t fee: 215.680msat \t p = 85.70% amt: 160000sats path hops: 4\n", + "Success: False \t fee: 3304.860msat \t p = 10.02% amt: 2470000sats path hops: 4\n", + "Success: True \t fee: 66.900msat \t p = 78.60% amt: 50000sats path hops: 4\n", + "Success: False \t fee: 1034.250msat \t p = 15.94% amt: 750000sats path hops: 4\n", + "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", + "Success: False \t fee: 1119.300msat \t p = 40.53% amt: 820000sats path hops: 4\n", + "Success: False \t fee: 1581.200msat \t p = 13.86% amt: 1180000sats path hops: 4\n", + "Success: True \t fee: 576.000msat \t p = 40.49% amt: 400000sats path hops: 5\n", + "Success: True \t fee: 492.660msat \t p = 41.10% amt: 340000sats path hops: 5\n", + "Success: True \t fee: 203.550msat \t p = 75.85% amt: 150000sats path hops: 5\n", + "Success: False \t fee: 3953.430msat \t p = 9.29% amt: 2790000sats path hops: 5\n", + "Success: False \t fee: 113.520msat \t p = 90.64% amt: 80000sats path hops: 5\n", + "Success: True \t fee: 818.400msat \t p = 18.28% amt: 600000sats path hops: 5\n", + "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", + "Success: False \t fee: 854.400msat \t p = 30.42% amt: 600000sats path hops: 5\n", + "Success: True \t fee: 777.280msat \t p = 70.27% amt: 560000sats path hops: 5\n", + "Success: True \t fee: 278.000msat \t p = 74.26% amt: 200000sats path hops: 5\n", + "Success: False \t fee: 1542.240msat \t p = 10.77% amt: 1120000sats path hops: 5\n", + "Success: True \t fee: 138.100msat \t p = 60.94% amt: 100000sats path hops: 6\n", + "Success: True \t fee: 998.640msat \t p = 57.85% amt: 720000sats path hops: 6\n", + "Success: True \t fee: 40.500msat \t p = 73.70% amt: 30000sats path hops: 6\n", + "Success: False \t fee: 214.560msat \t p = 26.04% amt: 160000sats path hops: 6\n", + "Success: True \t fee: 1011.050msat \t p = 5.76% amt: 730000sats path hops: 6\n", + "Success: True \t fee: 163.320msat \t p = 48.77% amt: 120000sats path hops: 6\n", + "Success: True \t fee: 108.640msat \t p = 84.20% amt: 80000sats path hops: 6\n", + "Success: True \t fee: 54.520msat \t p = 80.83% amt: 40000sats path hops: 6\n", + "Success: True \t fee: 122.580msat \t p = 82.30% amt: 90000sats path hops: 6\n", + "Success: True \t fee: 1989.400msat \t p = 38.52% amt: 1400000sats path hops: 6\n", + "Success: False \t fee: 149.820msat \t p = 51.19% amt: 110000sats path hops: 7\n", + "Success: False \t fee: 1716.990msat \t p = 42.37% amt: 1210000sats path hops: 7\n", + "Success: True \t fee: 54.120msat \t p = 92.57% amt: 40000sats path hops: 7\n", + "Success: True \t fee: 69.100msat \t p = 37.10% amt: 50000sats path hops: 7\n", + "Success: True \t fee: 111.120msat \t p = 93.94% amt: 80000sats path hops: 7\n", + "Success: True \t fee: 85.260msat \t p = 94.30% amt: 60000sats path hops: 7\n", + "Success: True \t fee: 2564.770msat \t p = 18.47% amt: 1810000sats path hops: 7\n", + "Success: True \t fee: 268.400msat \t p = 66.54% amt: 200000sats path hops: 7\n", + "Success: True \t fee: 312.110msat \t p = 59.01% amt: 230000sats path hops: 7\n", + "Success: True \t fee: 26.840msat \t p = 73.70% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 67.450msat \t p = 89.50% amt: 50000sats path hops: 8\n", + "Success: True \t fee: 13.470msat \t p = 97.94% amt: 10000sats path hops: 8\n", + "Success: True \t fee: 271.000msat \t p = 74.22% amt: 200000sats path hops: 8\n", + "Success: True \t fee: 26.840msat \t p = 94.31% amt: 20000sats path hops: 8\n", + "Success: True \t fee: 138.500msat \t p = 57.06% amt: 100000sats path hops: 10\n", + "Success: True \t fee: 285.000msat \t p = 70.23% amt: 200000sats path hops: 10\n", + "Success: True \t fee: 275.400msat \t p = 67.89% amt: 200000sats path hops: 10\n", + "Success: True \t fee: 151.250msat \t p = 76.32% amt: 110000sats path hops: 10\n", + "Success: True \t fee: 138.000msat \t p = 46.62% amt: 100000sats path hops: 10\n", + "Success: True \t fee: 28.120msat \t p = 88.34% amt: 20000sats path hops: 11\n", + "Success: True \t fee: 56.320msat \t p = 79.11% amt: 40000sats path hops: 12\n", + "total_fee: 48131.140 msat \t paid fees: 25113.720 msat\n", "\n", - "Try: 21930000 sats. Round number: 3\n" + "Try: 16640000 sats. Round number: 3\n" ] }, { @@ -1295,85 +1267,90 @@ "output_type": "stream", "text": [ "\\mu: 100 \n", - "Runtime of flow computation: 1.30 sec \n", - "Success: True \t fee: 1552.680msat \t p = 26.66% amt: 1140000sats path hops: 3\n", - "Success: False \t fee: 570.780msat \t p = 44.83% amt: 420000sats path hops: 3\n", - "Success: True \t fee: 267.400msat \t p = 90.16% amt: 200000sats path hops: 3\n", - "Success: True \t fee: 173.040msat \t p = 93.36% amt: 120000sats path hops: 3\n", - "Success: True \t fee: 701.190msat \t p = 12.68% amt: 490000sats path hops: 4\n", - "Success: True \t fee: 148.500msat \t p = 85.34% amt: 110000sats path hops: 4\n", - "Success: True \t fee: 1212.300msat \t p = 36.74% amt: 900000sats path hops: 4\n", - "Success: True \t fee: 736.560msat \t p = 45.21% amt: 540000sats path hops: 4\n", - "Success: True \t fee: 485.280msat \t p = 43.03% amt: 360000sats path hops: 4\n", - "Success: True \t fee: 136.000msat \t p = 68.08% amt: 100000sats path hops: 4\n", - "Success: True \t fee: 482.040msat \t p = 59.03% amt: 360000sats path hops: 4\n", - "Success: False \t fee: 482.650msat \t p = 53.40% amt: 350000sats path hops: 4\n", - "Success: True \t fee: 229.330msat \t p = 26.26% amt: 170000sats path hops: 4\n", - "Success: True \t fee: 1969.800msat \t p = 1.14% amt: 1470000sats path hops: 4\n", - "Success: True \t fee: 1272.050msat \t p = 52.56% amt: 950000sats path hops: 4\n", - "Success: True \t fee: 268.600msat \t p = 57.76% amt: 200000sats path hops: 5\n", - "Success: False \t fee: 4080.960msat \t p = 8.15% amt: 2880000sats path hops: 5\n", - "Success: False \t fee: 286.440msat \t p = 63.26% amt: 210000sats path hops: 5\n", - "Success: True \t fee: 855.000msat \t p = 52.92% amt: 600000sats path hops: 5\n", - "Success: True \t fee: 348.660msat \t p = 14.24% amt: 260000sats path hops: 5\n", - "Success: True \t fee: 908.160msat \t p = 31.88% amt: 640000sats path hops: 5\n", - "Success: True \t fee: 432.000msat \t p = 71.09% amt: 320000sats path hops: 5\n", - "Success: True \t fee: 687.480msat \t p = 41.37% amt: 510000sats path hops: 5\n", - "Success: True \t fee: 246.240msat \t p = 62.40% amt: 180000sats path hops: 6\n", - "Success: True \t fee: 13.410msat \t p = 93.65% amt: 10000sats path hops: 6\n", - "Success: True \t fee: 283.500msat \t p = 78.57% amt: 210000sats path hops: 6\n", - "Success: True \t fee: 3792.200msat \t p = 1.62% amt: 2830000sats path hops: 6\n", - "Success: True \t fee: 147.510msat \t p = 91.04% amt: 110000sats path hops: 6\n", - "Success: True \t fee: 67.050msat \t p = 77.39% amt: 50000sats path hops: 6\n", - "Success: True \t fee: 488.880msat \t p = 42.04% amt: 360000sats path hops: 6\n", - "Success: True \t fee: 2969.890msat \t p = 21.65% amt: 2090000sats path hops: 6\n", - "Success: True \t fee: 444.180msat \t p = 52.37% amt: 330000sats path hops: 6\n", - "Success: True \t fee: 124.380msat \t p = 5.58% amt: 90000sats path hops: 7\n", - "Success: True \t fee: 97.370msat \t p = 93.80% amt: 70000sats path hops: 7\n", - "Success: True \t fee: 136.200msat \t p = 54.97% amt: 100000sats path hops: 7\n", - "Success: False \t fee: 703.800msat \t p = 37.05% amt: 510000sats path hops: 7\n", - "Success: False \t fee: 93.940msat \t p = 59.75% amt: 70000sats path hops: 7\n", - "Success: True \t fee: 134.100msat \t p = 73.51% amt: 100000sats path hops: 7\n", - "Success: True \t fee: 142.500msat \t p = 81.02% amt: 100000sats path hops: 8\n", - "Success: True \t fee: 110.720msat \t p = 66.04% amt: 80000sats path hops: 8\n", - "Success: True \t fee: 136.000msat \t p = 76.79% amt: 100000sats path hops: 8\n", - "Success: True \t fee: 291.900msat \t p = 80.40% amt: 210000sats path hops: 8\n", - "Success: True \t fee: 236.130msat \t p = 83.03% amt: 170000sats path hops: 8\n", - "Success: True \t fee: 27.140msat \t p = 95.17% amt: 20000sats path hops: 8\n", - "Success: True \t fee: 142.100msat \t p = 70.95% amt: 100000sats path hops: 9\n", - "Success: True \t fee: 142.300msat \t p = 80.23% amt: 100000sats path hops: 9\n", - "Success: True \t fee: 201.600msat \t p = 49.07% amt: 150000sats path hops: 9\n", - "Success: True \t fee: 40.290msat \t p = 86.77% amt: 30000sats path hops: 9\n", - "Success: True \t fee: 107.280msat \t p = 74.44% amt: 80000sats path hops: 9\n", - "Success: False \t fee: 138.500msat \t p = 57.06% amt: 100000sats path hops: 10\n", - "Success: True \t fee: 178.230msat \t p = 72.89% amt: 130000sats path hops: 10\n", - "Success: True \t fee: 13.710msat \t p = 97.85% amt: 10000sats path hops: 10\n", - "Success: True \t fee: 55.040msat \t p = 75.58% amt: 40000sats path hops: 10\n", - "Success: True \t fee: 112.160msat \t p = 60.64% amt: 80000sats path hops: 11\n", - "Success: True \t fee: 28.040msat \t p = 88.74% amt: 20000sats path hops: 11\n", - "total_fee: 30133.190 msat \t paid fees: 23776.120 msat\n", + "Runtime of flow computation: 1.27 sec \n", + "Success: True \t fee: 1934.040msat \t p = 15.27% amt: 1420000sats path hops: 3\n", + "Success: False \t fee: 312.570msat \t p = 67.54% amt: 230000sats path hops: 3\n", + "Success: False \t fee: 2553.670msat \t p = 19.09% amt: 1910000sats path hops: 3\n", + "Success: True \t fee: 243.000msat \t p = 76.76% amt: 180000sats path hops: 4\n", + "Success: False \t fee: 3037.260msat \t p = 14.54% amt: 2270000sats path hops: 4\n", + "Success: True \t fee: 66.900msat \t p = 78.60% amt: 50000sats path hops: 4\n", + "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", + "Success: True \t fee: 382.200msat \t p = 76.52% amt: 280000sats path hops: 4\n", + "Success: False \t fee: 1206.000msat \t p = 29.14% amt: 900000sats path hops: 4\n", + "Success: False \t fee: 82.200msat \t p = 85.37% amt: 60000sats path hops: 5\n", + "Success: True \t fee: 203.550msat \t p = 75.85% amt: 150000sats path hops: 5\n", + "Success: True \t fee: 818.400msat \t p = 18.28% amt: 600000sats path hops: 5\n", + "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", + "Success: True \t fee: 694.000msat \t p = 73.10% amt: 500000sats path hops: 5\n", + "Success: True \t fee: 950.130msat \t p = 30.76% amt: 690000sats path hops: 5\n", + "Success: True \t fee: 278.000msat \t p = 74.26% amt: 200000sats path hops: 5\n", + "Success: True \t fee: 1009.590msat \t p = 5.52% amt: 730000sats path hops: 6\n", + "Success: True \t fee: 372.330msat \t p = 56.27% amt: 270000sats path hops: 6\n", + "Success: True \t fee: 138.100msat \t p = 60.94% amt: 100000sats path hops: 6\n", + "Success: True \t fee: 832.200msat \t p = 63.73% amt: 600000sats path hops: 6\n", + "Success: True \t fee: 40.500msat \t p = 73.70% amt: 30000sats path hops: 6\n", + "Success: False \t fee: 147.510msat \t p = 43.27% amt: 110000sats path hops: 6\n", + "Success: False \t fee: 53.720msat \t p = 75.89% amt: 40000sats path hops: 6\n", + "Success: True \t fee: 455.730msat \t p = 49.46% amt: 330000sats path hops: 6\n", + "Success: True \t fee: 68.100msat \t p = 89.90% amt: 50000sats path hops: 6\n", + "Success: True \t fee: 108.640msat \t p = 84.20% amt: 80000sats path hops: 6\n", + "Success: False \t fee: 123.660msat \t p = 78.83% amt: 90000sats path hops: 6\n", + "Success: True \t fee: 1577.310msat \t p = 47.90% amt: 1110000sats path hops: 6\n", + "Success: False \t fee: 13.420msat \t p = 93.43% amt: 10000sats path hops: 7\n", + "Success: True \t fee: 108.960msat \t p = 62.89% amt: 80000sats path hops: 7\n", + "Success: True \t fee: 108.240msat \t p = 85.57% amt: 80000sats path hops: 7\n", + "Success: True \t fee: 69.100msat \t p = 37.10% amt: 50000sats path hops: 7\n", + "Success: True \t fee: 166.680msat \t p = 91.02% amt: 120000sats path hops: 7\n", + "Success: True \t fee: 1261.130msat \t p = 46.91% amt: 890000sats path hops: 7\n", + "Success: True \t fee: 348.920msat \t p = 58.14% amt: 260000sats path hops: 7\n", + "Success: True \t fee: 312.110msat \t p = 59.01% amt: 230000sats path hops: 7\n", + "Success: True \t fee: 26.840msat \t p = 73.70% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 948.500msat \t p = 30.05% amt: 700000sats path hops: 8\n", + "Success: True \t fee: 26.840msat \t p = 94.31% amt: 20000sats path hops: 8\n", + "Success: True \t fee: 41.160msat \t p = 95.00% amt: 30000sats path hops: 9\n", + "Success: True \t fee: 315.100msat \t p = 58.50% amt: 230000sats path hops: 9\n", + "Success: True \t fee: 138.500msat \t p = 57.06% amt: 100000sats path hops: 10\n", + "Success: True \t fee: 68.600msat \t p = 91.30% amt: 50000sats path hops: 10\n", + "Success: True \t fee: 137.700msat \t p = 49.60% amt: 100000sats path hops: 10\n", + "Success: True \t fee: 84.180msat \t p = 70.70% amt: 60000sats path hops: 11\n", + "Success: True \t fee: 259.350msat \t p = 26.56% amt: 190000sats path hops: 11\n", + "total_fee: 22716.200 msat \t paid fees: 15186.190 msat\n", "\n", - "Try: 4540000 sats. Round number: 4\n", + "Try: 5620000 sats. Round number: 4\n", "\\mu: 100 \n", - "Runtime of flow computation: 1.36 sec \n", - "Success: True \t fee: 267.400msat \t p = 90.16% amt: 200000sats path hops: 3\n", - "Success: True \t fee: 482.040msat \t p = 59.03% amt: 360000sats path hops: 4\n", - "Success: True \t fee: 1700.530msat \t p = 39.32% amt: 1270000sats path hops: 4\n", - "Success: True \t fee: 681.870msat \t p = 53.25% amt: 510000sats path hops: 4\n", - "Success: True \t fee: 93.660msat \t p = 91.56% amt: 70000sats path hops: 5\n", - "Success: True \t fee: 227.630msat \t p = 79.97% amt: 170000sats path hops: 6\n", - "Success: True \t fee: 2197.600msat \t p = 23.21% amt: 1640000sats path hops: 6\n", - "Success: True \t fee: 267.600msat \t p = 85.68% amt: 200000sats path hops: 6\n", - "Success: True \t fee: 160.920msat \t p = 74.44% amt: 120000sats path hops: 8\n", - "total_fee: 6079.250 msat \t paid fees: 6079.250 msat\n", + "Runtime of flow computation: 1.43 sec \n", + "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", + "Success: True \t fee: 243.000msat \t p = 76.76% amt: 180000sats path hops: 4\n", + "Success: True \t fee: 1391.520msat \t p = 52.45% amt: 1040000sats path hops: 4\n", + "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", + "Success: False \t fee: 991.600msat \t p = 39.26% amt: 740000sats path hops: 4\n", + "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", + "Success: True \t fee: 696.800msat \t p = 71.72% amt: 520000sats path hops: 5\n", + "Success: True \t fee: 93.660msat \t p = 92.28% amt: 70000sats path hops: 5\n", + "Success: True \t fee: 66.900msat \t p = 76.25% amt: 50000sats path hops: 5\n", + "Success: True \t fee: 40.500msat \t p = 73.70% amt: 30000sats path hops: 6\n", + "Success: True \t fee: 108.240msat \t p = 85.57% amt: 80000sats path hops: 7\n", + "Success: True \t fee: 147.400msat \t p = 75.79% amt: 110000sats path hops: 7\n", + "Success: True \t fee: 26.840msat \t p = 73.70% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 201.000msat \t p = 72.36% amt: 150000sats path hops: 8\n", + "Success: True \t fee: 757.680msat \t p = 36.37% amt: 560000sats path hops: 9\n", + "Success: True \t fee: 26.800msat \t p = 94.02% amt: 20000sats path hops: 9\n", + "total_fee: 7536.070 msat \t paid fees: 6544.470 msat\n", + "\n", + "Try: 740000 sats. Round number: 5\n", + "\\mu: 100 \n", + "Runtime of flow computation: 0.90 sec \n", + "Success: True \t fee: 280.770msat \t p = 89.68% amt: 210000sats path hops: 3\n", + "Success: True \t fee: 708.610msat \t p = 65.98% amt: 530000sats path hops: 5\n", + "total_fee: 989.380 msat \t paid fees: 989.380 msat\n", "\n", "SUMMARY:\n", - "Rounds of mcf-computations: 4\n", - "Number of onions sent: 208\n", - "Number of failed onions: 59 failure rate: 28.37% \n", - "total runtime (including inefficient memory managment): 5.363 sec\n", - "Learnt entropy: 269.17 bits\n", - "Fees for successfull delivery: 68905.990 sat --> 1378 ppm\n" + "Rounds of mcf-computations: 5\n", + "Number of onions sent: 192\n", + "Number of failed onions: 57 failure rate: 29.69% \n", + "total runtime (including inefficient memory managment): 6.112 sec\n", + "Learnt entropy: 268.16 bits\n", + "Fees for successfull delivery: 69992.010 sat --> 1399 ppm\n" ] } ], @@ -1402,145 +1379,137 @@ "\n", "Try: 50000000 sats. Round number: 1\n", "\\mu: 100 \n", - "Runtime of flow computation: 1.94 sec \n", - "Success: False \t fee: 10949.580msat \t p = 30.51% amt: 7510000sats path hops: 3\n", - "Success: False \t fee: 616.640msat \t p = 73.78% amt: 410000sats path hops: 3\n", - "Success: True \t fee: 1813.660msat \t p = 58.37% amt: 1180000sats path hops: 3\n", - "Success: True \t fee: 1362.000msat \t p = 33.33% amt: 1000000sats path hops: 3\n", - "Success: False \t fee: 557.190msat \t p = 45.93% amt: 410000sats path hops: 3\n", - "Success: False \t fee: 3248.910msat \t p = 2.12% amt: 2430000sats path hops: 3\n", - "Success: False \t fee: 3137.820msat \t p = 71.31% amt: 1860000sats path hops: 3\n", - "Success: False \t fee: 2206.260msat \t p = 32.23% amt: 1530000sats path hops: 3\n", - "Success: True \t fee: 57.520msat \t p = 86.79% amt: 40000sats path hops: 4\n", - "Success: True \t fee: 357.750msat \t p = 48.82% amt: 250000sats path hops: 4\n", - "Success: False \t fee: 3201.390msat \t p = 36.81% amt: 2130000sats path hops: 4\n", - "Success: True \t fee: 340.000msat \t p = 32.36% amt: 250000sats path hops: 4\n", - "Success: True \t fee: 94.360msat \t p = 93.59% amt: 70000sats path hops: 4\n", - "Success: False \t fee: 592.970msat \t p = 44.63% amt: 430000sats path hops: 4\n", - "Success: True \t fee: 229.330msat \t p = 26.26% amt: 170000sats path hops: 4\n", - "Success: True \t fee: 1969.800msat \t p = 1.14% amt: 1470000sats path hops: 4\n", - "Success: True \t fee: 449.790msat \t p = 61.78% amt: 330000sats path hops: 5\n", - "Success: True \t fee: 1941.940msat \t p = 5.57% amt: 1430000sats path hops: 5\n", - "Success: False \t fee: 246.330msat \t p = 66.13% amt: 170000sats path hops: 5\n", - "Success: True \t fee: 13.690msat \t p = 70.77% amt: 10000sats path hops: 5\n", - "Success: True \t fee: 94.360msat \t p = 93.39% amt: 70000sats path hops: 5\n", - "Success: True \t fee: 268.000msat \t p = 75.05% amt: 200000sats path hops: 5\n", - "Success: True \t fee: 802.800msat \t p = 46.32% amt: 600000sats path hops: 5\n", - "Success: True \t fee: 13.630msat \t p = 98.08% amt: 10000sats path hops: 5\n", - "Success: True \t fee: 1983.800msat \t p = 39.32% amt: 1400000sats path hops: 5\n", - "Success: True \t fee: 1064.250msat \t p = 21.67% amt: 750000sats path hops: 5\n", - "Success: False \t fee: 926.250msat \t p = 49.85% amt: 650000sats path hops: 5\n", - "Success: False \t fee: 204.600msat \t p = 72.75% amt: 150000sats path hops: 5\n", - "Success: False \t fee: 375.480msat \t p = 10.37% amt: 280000sats path hops: 5\n", - "Success: False \t fee: 239.700msat \t p = 77.36% amt: 150000sats path hops: 5\n", - "Success: False \t fee: 392.500msat \t p = 56.85% amt: 250000sats path hops: 5\n", - "Success: True \t fee: 383.500msat \t p = 47.90% amt: 250000sats path hops: 5\n", - "Success: True \t fee: 931.240msat \t p = 75.31% amt: 620000sats path hops: 5\n", - "Success: True \t fee: 95.900msat \t p = 28.70% amt: 70000sats path hops: 5\n", - "Success: False \t fee: 572.520msat \t p = 32.40% amt: 390000sats path hops: 5\n", - "Success: True \t fee: 26.920msat \t p = 91.12% amt: 20000sats path hops: 5\n", - "Success: True \t fee: 468.300msat \t p = 75.93% amt: 350000sats path hops: 6\n", + "Runtime of flow computation: 1.69 sec \n", + "Success: False \t fee: 15848.460msat \t p = 12.40% amt: 10870000sats path hops: 3\n", + "Success: True \t fee: 2060.480msat \t p = 23.93% amt: 1370000sats path hops: 3\n", + "Success: True \t fee: 1921.250msat \t p = 56.25% amt: 1250000sats path hops: 3\n", + "Success: True \t fee: 1484.580msat \t p = 28.97% amt: 1090000sats path hops: 3\n", + "Success: False \t fee: 231.030msat \t p = 75.48% amt: 170000sats path hops: 3\n", + "Success: False \t fee: 2353.120msat \t p = 24.39% amt: 1760000sats path hops: 3\n", + "Success: False \t fee: 1442.000msat \t p = 51.56% amt: 1000000sats path hops: 3\n", + "Success: True \t fee: 100.660msat \t p = 22.97% amt: 70000sats path hops: 4\n", + "Success: True \t fee: 499.500msat \t p = 56.27% amt: 370000sats path hops: 4\n", + "Success: True \t fee: 4674.330msat \t p = 14.77% amt: 3110000sats path hops: 4\n", + "Success: False \t fee: 512.240msat \t p = 40.68% amt: 380000sats path hops: 4\n", + "Success: False \t fee: 176.800msat \t p = 59.82% amt: 130000sats path hops: 4\n", + "Success: False \t fee: 2823.180msat \t p = 18.47% amt: 2110000sats path hops: 4\n", + "Success: True \t fee: 902.850msat \t p = 15.53% amt: 650000sats path hops: 4\n", + "Success: True \t fee: 344.750msat \t p = 65.31% amt: 250000sats path hops: 4\n", + "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", + "Success: True \t fee: 172.680msat \t p = 66.35% amt: 120000sats path hops: 4\n", + "Success: False \t fee: 991.600msat \t p = 39.26% amt: 740000sats path hops: 4\n", + "Success: False \t fee: 2277.000msat \t p = 58.12% amt: 1500000sats path hops: 4\n", + "Success: True \t fee: 890.940msat \t p = 9.35% amt: 620000sats path hops: 5\n", + "Success: True \t fee: 162.840msat \t p = 80.32% amt: 120000sats path hops: 5\n", + "Success: True \t fee: 354.250msat \t p = 86.43% amt: 250000sats path hops: 5\n", + "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", + "Success: True \t fee: 172.080msat \t p = 39.68% amt: 120000sats path hops: 5\n", + "Success: True \t fee: 726.240msat \t p = 37.74% amt: 510000sats path hops: 5\n", + "Success: True \t fee: 14.190msat \t p = 47.28% amt: 10000sats path hops: 5\n", + "Success: True \t fee: 333.600msat \t p = 69.49% amt: 240000sats path hops: 5\n", + "Success: True \t fee: 372.600msat \t p = 5.46% amt: 270000sats path hops: 5\n", + "Success: True \t fee: 539.090msat \t p = 19.96% amt: 370000sats path hops: 5\n", + "Success: False \t fee: 1101.000msat \t p = 63.84% amt: 750000sats path hops: 5\n", + "Success: True \t fee: 28.480msat \t p = 79.65% amt: 20000sats path hops: 5\n", + "Success: True \t fee: 249.560msat \t p = 64.93% amt: 170000sats path hops: 5\n", + "Success: False \t fee: 1541.400msat \t p = 32.09% amt: 1050000sats path hops: 5\n", + "Success: True \t fee: 1032.750msat \t p = 27.10% amt: 750000sats path hops: 5\n", + "Success: True \t fee: 13.800msat \t p = 63.04% amt: 10000sats path hops: 5\n", + "Success: False \t fee: 27.200msat \t p = 86.93% amt: 20000sats path hops: 5\n", + "Success: True \t fee: 95.830msat \t p = 42.71% amt: 70000sats path hops: 5\n", + "Success: True \t fee: 67.300msat \t p = 78.71% amt: 50000sats path hops: 5\n", + "Success: True \t fee: 28.180msat \t p = 67.55% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 13.690msat \t p = 64.06% amt: 10000sats path hops: 6\n", + "Success: True \t fee: 27.280msat \t p = 75.81% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 13.590msat \t p = 87.95% amt: 10000sats path hops: 6\n", + "Success: True \t fee: 968.100msat \t p = 6.90% amt: 700000sats path hops: 6\n", "Success: True \t fee: 173.760msat \t p = 67.60% amt: 120000sats path hops: 6\n", - "Success: True \t fee: 205.050msat \t p = 51.50% amt: 150000sats path hops: 6\n", - "Success: True \t fee: 740.500msat \t p = 44.20% amt: 500000sats path hops: 6\n", - "Success: True \t fee: 14.200msat \t p = 42.13% amt: 10000sats path hops: 6\n", - "Success: True \t fee: 13.810msat \t p = 84.41% amt: 10000sats path hops: 6\n", - "Success: True \t fee: 1511.730msat \t p = 40.61% amt: 990000sats path hops: 6\n", - "Success: True \t fee: 13.830msat \t p = 47.52% amt: 10000sats path hops: 6\n", - "Success: True \t fee: 343.390msat \t p = 66.75% amt: 230000sats path hops: 6\n", - "Success: True \t fee: 247.680msat \t p = 45.97% amt: 180000sats path hops: 6\n", - "Success: False \t fee: 94.640msat \t p = 43.60% amt: 70000sats path hops: 6\n", - "Success: False \t fee: 53.720msat \t p = 75.89% amt: 40000sats path hops: 6\n", - "Success: True \t fee: 27.260msat \t p = 35.13% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 67.600msat \t p = 23.50% amt: 50000sats path hops: 6\n", - "Success: True \t fee: 109.040msat \t p = 63.66% amt: 80000sats path hops: 6\n", - "Success: True \t fee: 27.820msat \t p = 35.13% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 72.100msat \t p = 23.50% amt: 50000sats path hops: 6\n", - "Success: True \t fee: 603.900msat \t p = 20.42% amt: 450000sats path hops: 6\n", - "Success: True \t fee: 53.600msat \t p = 43.01% amt: 40000sats path hops: 6\n", - "Success: False \t fee: 70.950msat \t p = 66.87% amt: 50000sats path hops: 6\n", - "Success: True \t fee: 457.300msat \t p = 45.86% amt: 340000sats path hops: 6\n", - "Success: True \t fee: 1648.200msat \t p = 36.16% amt: 1230000sats path hops: 6\n", - "Success: True \t fee: 294.800msat \t p = 19.35% amt: 220000sats path hops: 6\n", - "Success: True \t fee: 1119.000msat \t p = 37.09% amt: 750000sats path hops: 6\n", - "Success: True \t fee: 26.880msat \t p = 76.37% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 597.520msat \t p = 33.23% amt: 440000sats path hops: 6\n", - "Success: True \t fee: 422.530msat \t p = 49.03% amt: 310000sats path hops: 6\n", - "Success: True \t fee: 2600.430msat \t p = 27.19% amt: 1830000sats path hops: 6\n", - "Success: True \t fee: 1202.850msat \t p = 49.53% amt: 810000sats path hops: 6\n", - "Success: True \t fee: 149.380msat \t p = 65.77% amt: 110000sats path hops: 7\n", - "Success: False \t fee: 86.460msat \t p = 58.86% amt: 60000sats path hops: 7\n", - "Success: True \t fee: 27.640msat \t p = 71.44% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 299.460msat \t p = 67.23% amt: 210000sats path hops: 7\n", - "Success: True \t fee: 702.180msat \t p = 38.29% amt: 470000sats path hops: 7\n", - "Success: True \t fee: 29.860msat \t p = 75.88% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 364.750msat \t p = 40.23% amt: 250000sats path hops: 7\n", - "Success: True \t fee: 1837.500msat \t p = 36.16% amt: 1250000sats path hops: 7\n", - "Success: True \t fee: 468.860msat \t p = 55.60% amt: 340000sats path hops: 7\n", - "Success: True \t fee: 358.540msat \t p = 61.05% amt: 260000sats path hops: 7\n", - "Success: False \t fee: 14.430msat \t p = 63.13% amt: 10000sats path hops: 7\n", - "Success: True \t fee: 80.400msat \t p = 66.96% amt: 60000sats path hops: 7\n", - "Success: True \t fee: 95.340msat \t p = 5.19% amt: 70000sats path hops: 8\n", - "Success: True \t fee: 318.090msat \t p = 25.39% amt: 230000sats path hops: 8\n", - "Success: True \t fee: 28.480msat \t p = 78.42% amt: 20000sats path hops: 8\n", - "Success: True \t fee: 648.900msat \t p = 40.62% amt: 450000sats path hops: 8\n", - "Success: True \t fee: 552.630msat \t p = 33.04% amt: 390000sats path hops: 8\n", - "Success: True \t fee: 1572.870msat \t p = 25.98% amt: 1110000sats path hops: 8\n", - "Success: True \t fee: 724.000msat \t p = 15.16% amt: 500000sats path hops: 8\n", - "Success: True \t fee: 372.840msat \t p = 33.59% amt: 260000sats path hops: 8\n", - "Success: False \t fee: 1250.100msat \t p = 34.59% amt: 900000sats path hops: 8\n", - "Success: True \t fee: 166.800msat \t p = 67.91% amt: 120000sats path hops: 8\n", - "Success: True \t fee: 55.760msat \t p = 88.34% amt: 40000sats path hops: 8\n", - "Success: True \t fee: 194.740msat \t p = 82.00% amt: 130000sats path hops: 8\n", - "Success: True \t fee: 264.960msat \t p = 72.16% amt: 180000sats path hops: 8\n", - "Success: True \t fee: 14.600msat \t p = 92.86% amt: 10000sats path hops: 8\n", - "Success: True \t fee: 26.940msat \t p = 80.10% amt: 20000sats path hops: 8\n", - "Success: True \t fee: 254.980msat \t p = 46.45% amt: 190000sats path hops: 8\n", - "Success: True \t fee: 94.010msat \t p = 19.38% amt: 70000sats path hops: 8\n", - "Success: True \t fee: 14.620msat \t p = 42.99% amt: 10000sats path hops: 9\n", - "Success: True \t fee: 29.200msat \t p = 52.54% amt: 20000sats path hops: 9\n", - "Success: True \t fee: 380.120msat \t p = 25.51% amt: 260000sats path hops: 9\n", - "Success: True \t fee: 101.010msat \t p = 26.42% amt: 70000sats path hops: 9\n", - "Success: True \t fee: 111.360msat \t p = 41.46% amt: 80000sats path hops: 9\n", - "Success: True \t fee: 70.600msat \t p = 40.53% amt: 50000sats path hops: 9\n", - "Success: True \t fee: 88.020msat \t p = 81.02% amt: 60000sats path hops: 9\n", - "Success: True \t fee: 331.200msat \t p = 64.82% amt: 230000sats path hops: 9\n", - "Success: True \t fee: 207.200msat \t p = 30.26% amt: 140000sats path hops: 10\n", - "Success: True \t fee: 102.340msat \t p = 19.20% amt: 70000sats path hops: 10\n", - "Success: True \t fee: 357.250msat \t p = 49.18% amt: 250000sats path hops: 10\n", - "Success: True \t fee: 114.160msat \t p = 41.70% amt: 80000sats path hops: 10\n", - "Success: True \t fee: 28.560msat \t p = 77.37% amt: 20000sats path hops: 10\n", - "Success: False \t fee: 413.100msat \t p = 46.18% amt: 300000sats path hops: 10\n", - "Success: True \t fee: 13.820msat \t p = 93.15% amt: 10000sats path hops: 10\n", - "Success: True \t fee: 356.000msat \t p = 33.25% amt: 250000sats path hops: 10\n", - "Success: False \t fee: 288.360msat \t p = 46.31% amt: 180000sats path hops: 11\n", - "Success: True \t fee: 56.320msat \t p = 77.62% amt: 40000sats path hops: 11\n", - "Success: True \t fee: 43.140msat \t p = 78.52% amt: 30000sats path hops: 11\n", - "Success: True \t fee: 171.840msat \t p = 29.09% amt: 120000sats path hops: 11\n", - "Success: False \t fee: 142.600msat \t p = 30.33% amt: 100000sats path hops: 11\n", - "Success: True \t fee: 14.950msat \t p = 81.82% amt: 10000sats path hops: 11\n", - "Success: True \t fee: 44.880msat \t p = 43.46% amt: 30000sats path hops: 11\n", - "Success: True \t fee: 27.180msat \t p = 58.79% amt: 20000sats path hops: 12\n", - "Success: True \t fee: 45.090msat \t p = 91.21% amt: 30000sats path hops: 12\n", - "Success: True \t fee: 104.580msat \t p = 61.90% amt: 70000sats path hops: 12\n", - "Success: True \t fee: 273.240msat \t p = 21.36% amt: 180000sats path hops: 12\n", - "Success: True \t fee: 27.500msat \t p = 55.94% amt: 20000sats path hops: 12\n", - "Success: True \t fee: 30.360msat \t p = 71.90% amt: 20000sats path hops: 12\n", - "Success: True \t fee: 216.900msat \t p = 38.08% amt: 150000sats path hops: 12\n", - "Success: True \t fee: 44.040msat \t p = 82.76% amt: 30000sats path hops: 13\n", - "Success: True \t fee: 132.480msat \t p = 57.96% amt: 90000sats path hops: 13\n", - "Success: True \t fee: 30.060msat \t p = 63.81% amt: 20000sats path hops: 13\n", - "Success: True \t fee: 232.480msat \t p = 41.17% amt: 160000sats path hops: 14\n", - "Success: True \t fee: 531.650msat \t p = 5.68% amt: 350000sats path hops: 14\n", - "Success: True \t fee: 75.950msat \t p = 79.00% amt: 50000sats path hops: 14\n", - "Success: True \t fee: 14.650msat \t p = 90.79% amt: 10000sats path hops: 15\n", - "Success: True \t fee: 263.700msat \t p = 23.59% amt: 180000sats path hops: 15\n", - "Success: True \t fee: 57.800msat \t p = 74.08% amt: 40000sats path hops: 15\n", - "Success: True \t fee: 72.500msat \t p = 72.07% amt: 50000sats path hops: 17\n", - "Success: True \t fee: 87.720msat \t p = 60.62% amt: 60000sats path hops: 19\n", - "total_fee: 71848.800 msat \t paid fees: 41966.300 msat\n", + "Success: True \t fee: 166.680msat \t p = 53.11% amt: 120000sats path hops: 6\n", + "Success: True \t fee: 97.930msat \t p = 53.46% amt: 70000sats path hops: 6\n", + "Success: True \t fee: 56.760msat \t p = 54.58% amt: 40000sats path hops: 6\n", + "Success: True \t fee: 140.800msat \t p = 66.30% amt: 100000sats path hops: 6\n", + "Success: True \t fee: 258.230msat \t p = 45.01% amt: 170000sats path hops: 6\n", + "Success: True \t fee: 172.800msat \t p = 61.97% amt: 120000sats path hops: 6\n", + "Success: True \t fee: 15.020msat \t p = 73.97% amt: 10000sats path hops: 6\n", + "Success: True \t fee: 209.020msat \t p = 78.91% amt: 140000sats path hops: 6\n", + "Success: True \t fee: 68.000msat \t p = 42.73% amt: 50000sats path hops: 6\n", + "Success: True \t fee: 340.000msat \t p = 20.74% amt: 250000sats path hops: 6\n", + "Success: True \t fee: 339.500msat \t p = 56.36% amt: 250000sats path hops: 6\n", + "Success: True \t fee: 94.080msat \t p = 25.35% amt: 70000sats path hops: 6\n", + "Success: True \t fee: 26.880msat \t p = 73.73% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 373.250msat \t p = 27.69% amt: 250000sats path hops: 6\n", + "Success: True \t fee: 13.690msat \t p = 87.57% amt: 10000sats path hops: 7\n", + "Success: True \t fee: 214.200msat \t p = 38.47% amt: 150000sats path hops: 7\n", + "Success: True \t fee: 1488.900msat \t p = 19.20% amt: 1050000sats path hops: 7\n", + "Success: True \t fee: 1909.500msat \t p = 15.63% amt: 1340000sats path hops: 7\n", + "Success: True \t fee: 301.770msat \t p = 59.62% amt: 210000sats path hops: 7\n", + "Success: True \t fee: 855.000msat \t p = 43.54% amt: 600000sats path hops: 7\n", + "Success: True \t fee: 693.600msat \t p = 56.43% amt: 480000sats path hops: 7\n", + "Success: True \t fee: 1317.810msat \t p = 31.18% amt: 930000sats path hops: 7\n", + "Success: True \t fee: 1361.220msat \t p = 43.46% amt: 980000sats path hops: 7\n", + "Success: True \t fee: 124.830msat \t p = 88.73% amt: 90000sats path hops: 7\n", + "Success: True \t fee: 679.360msat \t p = 36.42% amt: 440000sats path hops: 7\n", + "Success: True \t fee: 75.700msat \t p = 41.73% amt: 50000sats path hops: 7\n", + "Success: True \t fee: 14.940msat \t p = 97.88% amt: 10000sats path hops: 7\n", + "Success: True \t fee: 746.000msat \t p = 36.23% amt: 500000sats path hops: 7\n", + "Success: False \t fee: 73.300msat \t p = 58.07% amt: 50000sats path hops: 7\n", + "Success: True \t fee: 1020.000msat \t p = 34.36% amt: 680000sats path hops: 7\n", + "Success: True \t fee: 13.760msat \t p = 95.38% amt: 10000sats path hops: 7\n", + "Success: True \t fee: 151.360msat \t p = 59.82% amt: 110000sats path hops: 8\n", + "Success: True \t fee: 161.370msat \t p = 72.01% amt: 110000sats path hops: 8\n", + "Success: True \t fee: 93.870msat \t p = 21.86% amt: 70000sats path hops: 8\n", + "Success: True \t fee: 95.270msat \t p = 9.51% amt: 70000sats path hops: 8\n", + "Success: False \t fee: 164.450msat \t p = 76.36% amt: 110000sats path hops: 8\n", + "Success: True \t fee: 179.520msat \t p = 43.82% amt: 120000sats path hops: 8\n", + "Success: True \t fee: 14.950msat \t p = 98.77% amt: 10000sats path hops: 8\n", + "Success: False \t fee: 14.410msat \t p = 63.12% amt: 10000sats path hops: 8\n", + "Success: True \t fee: 14.940msat \t p = 44.42% amt: 10000sats path hops: 9\n", + "Success: True \t fee: 14.080msat \t p = 86.65% amt: 10000sats path hops: 9\n", + "Success: True \t fee: 731.080msat \t p = 71.19% amt: 490000sats path hops: 9\n", + "Success: True \t fee: 269.280msat \t p = 58.32% amt: 180000sats path hops: 9\n", + "Success: True \t fee: 15.030msat \t p = 98.41% amt: 10000sats path hops: 9\n", + "Success: True \t fee: 2121.480msat \t p = 27.28% amt: 1420000sats path hops: 9\n", + "Success: True \t fee: 865.940msat \t p = 46.69% amt: 580000sats path hops: 9\n", + "Success: True \t fee: 179.140msat \t p = 66.57% amt: 130000sats path hops: 9\n", + "Success: True \t fee: 418.600msat \t p = 58.19% amt: 280000sats path hops: 9\n", + "Success: True \t fee: 233.760msat \t p = 55.87% amt: 160000sats path hops: 9\n", + "Success: True \t fee: 326.600msat \t p = 37.16% amt: 230000sats path hops: 9\n", + "Success: True \t fee: 149.930msat \t p = 60.66% amt: 110000sats path hops: 9\n", + "Success: True \t fee: 99.540msat \t p = 27.92% amt: 70000sats path hops: 9\n", + "Success: True \t fee: 28.880msat \t p = 91.35% amt: 20000sats path hops: 9\n", + "Success: True \t fee: 286.600msat \t p = 25.73% amt: 200000sats path hops: 10\n", + "Success: True \t fee: 118.480msat \t p = 55.98% amt: 80000sats path hops: 10\n", + "Success: True \t fee: 249.300msat \t p = 34.12% amt: 180000sats path hops: 10\n", + "Success: True \t fee: 67.900msat \t p = 63.60% amt: 50000sats path hops: 10\n", + "Success: True \t fee: 70.050msat \t p = 40.18% amt: 50000sats path hops: 10\n", + "Success: True \t fee: 29.900msat \t p = 95.17% amt: 20000sats path hops: 10\n", + "Success: True \t fee: 102.340msat \t p = 53.99% amt: 70000sats path hops: 10\n", + "Success: True \t fee: 54.840msat \t p = 91.63% amt: 40000sats path hops: 10\n", + "Success: True \t fee: 181.350msat \t p = 64.18% amt: 130000sats path hops: 10\n", + "Success: True \t fee: 350.000msat \t p = 8.12% amt: 250000sats path hops: 10\n", + "Success: True \t fee: 68.900msat \t p = 35.41% amt: 50000sats path hops: 11\n", + "Success: True \t fee: 332.350msat \t p = 31.39% amt: 230000sats path hops: 11\n", + "Success: True \t fee: 101.150msat \t p = 50.67% amt: 70000sats path hops: 11\n", + "Success: True \t fee: 71.300msat \t p = 58.72% amt: 50000sats path hops: 11\n", + "Success: True \t fee: 513.740msat \t p = 24.29% amt: 340000sats path hops: 11\n", + "Success: True \t fee: 374.920msat \t p = 12.23% amt: 260000sats path hops: 12\n", + "Success: True \t fee: 174.120msat \t p = 46.73% amt: 120000sats path hops: 12\n", + "Success: True \t fee: 76.200msat \t p = 34.17% amt: 50000sats path hops: 14\n", + "Success: True \t fee: 29.940msat \t p = 88.08% amt: 20000sats path hops: 14\n", + "Success: True \t fee: 28.840msat \t p = 93.74% amt: 20000sats path hops: 14\n", + "Success: True \t fee: 72.750msat \t p = 14.02% amt: 50000sats path hops: 15\n", + "Success: True \t fee: 28.860msat \t p = 92.67% amt: 20000sats path hops: 16\n", + "Success: True \t fee: 14.050msat \t p = 90.19% amt: 10000sats path hops: 17\n", + "Success: True \t fee: 14.020msat \t p = 84.74% amt: 10000sats path hops: 17\n", + "Success: True \t fee: 135.900msat \t p = 37.13% amt: 90000sats path hops: 17\n", + "Success: True \t fee: 30.200msat \t p = 66.28% amt: 20000sats path hops: 17\n", + "Success: True \t fee: 70.250msat \t p = 32.81% amt: 50000sats path hops: 17\n", + "Success: True \t fee: 287.470msat \t p = 34.45% amt: 190000sats path hops: 17\n", + "Success: True \t fee: 30.260msat \t p = 57.76% amt: 20000sats path hops: 17\n", + "Success: True \t fee: 71.100msat \t p = 41.04% amt: 50000sats path hops: 18\n", + "total_fee: 71998.910 msat \t paid fees: 42421.720 msat\n", "\n", - "Try: 20460000 sats. Round number: 2\n" + "Try: 20650000 sats. Round number: 2\n" ] }, { @@ -1548,93 +1517,130 @@ "output_type": "stream", "text": [ "\\mu: 100 \n", - "Runtime of flow computation: 1.22 sec \n", - "Success: True \t fee: 475.650msat \t p = 52.76% amt: 350000sats path hops: 3\n", - "Success: True \t fee: 735.350msat \t p = 73.71% amt: 550000sats path hops: 3\n", - "Success: True \t fee: 100.170msat \t p = 84.19% amt: 70000sats path hops: 4\n", - "Success: True \t fee: 749.840msat \t p = 42.06% amt: 560000sats path hops: 4\n", - "Success: True \t fee: 229.330msat \t p = 26.26% amt: 170000sats path hops: 4\n", - "Success: True \t fee: 1969.800msat \t p = 1.14% amt: 1470000sats path hops: 4\n", - "Success: True \t fee: 802.200msat \t p = 46.82% amt: 600000sats path hops: 4\n", - "Success: True \t fee: 107.440msat \t p = 81.32% amt: 80000sats path hops: 5\n", - "Success: True \t fee: 1870.440msat \t p = 41.86% amt: 1320000sats path hops: 5\n", - "Success: True \t fee: 26.920msat \t p = 91.12% amt: 20000sats path hops: 5\n", - "Success: True \t fee: 348.660msat \t p = 14.24% amt: 260000sats path hops: 5\n", - "Success: True \t fee: 1064.250msat \t p = 21.67% amt: 750000sats path hops: 5\n", - "Success: True \t fee: 937.300msat \t p = 59.09% amt: 700000sats path hops: 5\n", - "Success: True \t fee: 41.100msat \t p = 92.49% amt: 30000sats path hops: 5\n", - "Success: True \t fee: 95.900msat \t p = 28.70% amt: 70000sats path hops: 5\n", - "Success: True \t fee: 54.000msat \t p = 65.68% amt: 40000sats path hops: 6\n", - "Success: True \t fee: 13.610msat \t p = 93.65% amt: 10000sats path hops: 6\n", + "Runtime of flow computation: 1.13 sec \n", + "Success: True \t fee: 1484.580msat \t p = 28.97% amt: 1090000sats path hops: 3\n", + "Success: True \t fee: 217.440msat \t p = 76.84% amt: 160000sats path hops: 3\n", + "Success: False \t fee: 2179.310msat \t p = 29.13% amt: 1630000sats path hops: 3\n", + "Success: True \t fee: 100.660msat \t p = 22.97% amt: 70000sats path hops: 4\n", + "Success: True \t fee: 499.500msat \t p = 56.27% amt: 370000sats path hops: 4\n", + "Success: True \t fee: 350.480msat \t p = 56.01% amt: 260000sats path hops: 4\n", + "Success: False \t fee: 2542.200msat \t p = 24.06% amt: 1900000sats path hops: 4\n", + "Success: True \t fee: 93.660msat \t p = 70.58% amt: 70000sats path hops: 4\n", + "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", + "Success: True \t fee: 172.680msat \t p = 66.35% amt: 120000sats path hops: 4\n", + "Success: False \t fee: 938.000msat \t p = 41.95% amt: 700000sats path hops: 4\n", + "Success: True \t fee: 804.720msat \t p = 13.16% amt: 560000sats path hops: 5\n", + "Success: True \t fee: 474.950msat \t p = 50.35% amt: 350000sats path hops: 5\n", + "Success: True \t fee: 566.800msat \t p = 78.90% amt: 400000sats path hops: 5\n", + "Success: True \t fee: 886.600msat \t p = 13.82% amt: 650000sats path hops: 5\n", + "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", + "Success: True \t fee: 28.460msat \t p = 45.04% amt: 20000sats path hops: 5\n", + "Success: True \t fee: 512.640msat \t p = 52.20% amt: 360000sats path hops: 5\n", + "Success: True \t fee: 67.300msat \t p = 78.71% amt: 50000sats path hops: 5\n", + "Success: True \t fee: 27.400msat \t p = 79.00% amt: 20000sats path hops: 5\n", + "Success: True \t fee: 27.680msat \t p = 70.69% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 27.280msat \t p = 75.81% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 54.400msat \t p = 52.94% amt: 40000sats path hops: 6\n", + "Success: True \t fee: 340.000msat \t p = 20.74% amt: 250000sats path hops: 6\n", + "Success: True \t fee: 968.100msat \t p = 6.90% amt: 700000sats path hops: 6\n", + "Success: True \t fee: 173.760msat \t p = 67.60% amt: 120000sats path hops: 6\n", + "Success: True \t fee: 141.500msat \t p = 49.79% amt: 100000sats path hops: 6\n", + "Success: True \t fee: 215.100msat \t p = 72.66% amt: 150000sats path hops: 6\n", "Success: True \t fee: 14.000msat \t p = 47.45% amt: 10000sats path hops: 6\n", - "Success: True \t fee: 27.220msat \t p = 35.18% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 67.500msat \t p = 23.58% amt: 50000sats path hops: 6\n", - "Success: True \t fee: 136.100msat \t p = 56.18% amt: 100000sats path hops: 6\n", - "Success: True \t fee: 27.820msat \t p = 35.13% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 933.570msat \t p = 18.15% amt: 690000sats path hops: 6\n", - "Success: True \t fee: 2025.000msat \t p = 8.02% amt: 1500000sats path hops: 6\n", - "Success: True \t fee: 247.320msat \t p = 60.88% amt: 180000sats path hops: 6\n", - "Success: True \t fee: 993.080msat \t p = 3.52% amt: 740000sats path hops: 6\n", - "Success: True \t fee: 1742.000msat \t p = 33.70% amt: 1300000sats path hops: 6\n", - "Success: True \t fee: 2197.600msat \t p = 15.24% amt: 1640000sats path hops: 6\n", - "Success: True \t fee: 312.340msat \t p = 59.26% amt: 230000sats path hops: 6\n", - "Success: True \t fee: 613.350msat \t p = 33.03% amt: 450000sats path hops: 6\n", - "Success: False \t fee: 70.950msat \t p = 66.87% amt: 50000sats path hops: 6\n", - "Success: True \t fee: 294.800msat \t p = 18.51% amt: 220000sats path hops: 6\n", - "Success: True \t fee: 190.680msat \t p = 73.37% amt: 140000sats path hops: 6\n", - "Success: True \t fee: 2600.430msat \t p = 27.19% amt: 1830000sats path hops: 6\n", - "Success: True \t fee: 27.280msat \t p = 59.33% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 27.240msat \t p = 43.72% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 27.240msat \t p = 47.60% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 27.700msat \t p = 71.16% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 679.500msat \t p = 19.19% amt: 500000sats path hops: 7\n", - "Success: True \t fee: 26.840msat \t p = 76.33% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 827.400msat \t p = 29.14% amt: 600000sats path hops: 7\n", - "Success: True \t fee: 13.620msat \t p = 69.56% amt: 10000sats path hops: 8\n", - "Success: True \t fee: 55.320msat \t p = 81.55% amt: 40000sats path hops: 8\n", - "Success: True \t fee: 166.080msat \t p = 40.46% amt: 120000sats path hops: 8\n", - "Success: True \t fee: 55.320msat \t p = 76.66% amt: 40000sats path hops: 8\n", - "Success: True \t fee: 85.380msat \t p = 87.35% amt: 60000sats path hops: 8\n", - "Success: True \t fee: 722.670msat \t p = 18.21% amt: 510000sats path hops: 8\n", - "Success: True \t fee: 708.000msat \t p = 45.26% amt: 500000sats path hops: 8\n", - "Success: True \t fee: 69.700msat \t p = 59.65% amt: 50000sats path hops: 8\n", - "Success: True \t fee: 41.550msat \t p = 69.38% amt: 30000sats path hops: 9\n", - "Success: True \t fee: 27.000msat \t p = 56.01% amt: 20000sats path hops: 9\n", - "Success: True \t fee: 28.440msat \t p = 78.38% amt: 20000sats path hops: 9\n", - "Success: True \t fee: 254.880msat \t p = 55.15% amt: 180000sats path hops: 9\n", - "Success: True \t fee: 85.020msat \t p = 81.54% amt: 60000sats path hops: 9\n", - "Success: True \t fee: 458.370msat \t p = 28.20% amt: 330000sats path hops: 9\n", - "Success: True \t fee: 41.790msat \t p = 59.88% amt: 30000sats path hops: 9\n", - "Success: True \t fee: 70.650msat \t p = 28.30% amt: 50000sats path hops: 9\n", - "Success: True \t fee: 14.250msat \t p = 86.22% amt: 10000sats path hops: 10\n", - "Success: True \t fee: 114.000msat \t p = 55.56% amt: 80000sats path hops: 10\n", - "Success: True \t fee: 356.000msat \t p = 33.25% amt: 250000sats path hops: 10\n", - "Success: True \t fee: 124.920msat \t p = 69.39% amt: 90000sats path hops: 10\n", - "Success: True \t fee: 83.400msat \t p = 61.44% amt: 60000sats path hops: 10\n", - "Success: True \t fee: 134.100msat \t p = 24.63% amt: 100000sats path hops: 10\n", - "Success: True \t fee: 93.940msat \t p = 17.60% amt: 70000sats path hops: 10\n", - "Success: True \t fee: 81.780msat \t p = 23.44% amt: 60000sats path hops: 11\n", - "Success: True \t fee: 82.440msat \t p = 84.97% amt: 60000sats path hops: 12\n", - "Success: True \t fee: 188.300msat \t p = 45.34% amt: 140000sats path hops: 12\n", - "Success: True \t fee: 13.490msat \t p = 84.28% amt: 10000sats path hops: 13\n", - "Success: True \t fee: 42.270msat \t p = 55.23% amt: 30000sats path hops: 14\n", - "Success: True \t fee: 14.090msat \t p = 83.26% amt: 10000sats path hops: 14\n", - "Success: True \t fee: 27.160msat \t p = 34.91% amt: 20000sats path hops: 16\n", - "total_fee: 28012.850 msat \t paid fees: 27941.900 msat\n", + "Success: True \t fee: 94.080msat \t p = 25.35% amt: 70000sats path hops: 6\n", + "Success: True \t fee: 68.050msat \t p = 76.63% amt: 50000sats path hops: 6\n", + "Success: True \t fee: 1040.250msat \t p = 18.68% amt: 750000sats path hops: 6\n", + "Success: True \t fee: 13.990msat \t p = 92.20% amt: 10000sats path hops: 6\n", + "Success: True \t fee: 26.880msat \t p = 73.73% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 544.050msat \t p = 46.97% amt: 390000sats path hops: 7\n", + "Success: True \t fee: 13.710msat \t p = 43.05% amt: 10000sats path hops: 7\n", + "Success: True \t fee: 114.240msat \t p = 64.00% amt: 80000sats path hops: 7\n", + "Success: True \t fee: 27.380msat \t p = 75.72% amt: 20000sats path hops: 7\n", + "Success: True \t fee: 470.250msat \t p = 67.28% amt: 330000sats path hops: 7\n", + "Success: True \t fee: 855.000msat \t p = 43.54% amt: 600000sats path hops: 7\n", + "Success: True \t fee: 510.480msat \t p = 62.17% amt: 360000sats path hops: 7\n", + "Success: True \t fee: 165.360msat \t p = 57.92% amt: 120000sats path hops: 7\n", + "Success: False \t fee: 2569.650msat \t p = 17.54% amt: 1850000sats path hops: 7\n", + "Success: True \t fee: 226.720msat \t p = 88.00% amt: 160000sats path hops: 7\n", + "Success: True \t fee: 707.500msat \t p = 48.74% amt: 500000sats path hops: 7\n", + "Success: True \t fee: 95.270msat \t p = 9.51% amt: 70000sats path hops: 8\n", + "Success: True \t fee: 212.250msat \t p = 86.65% amt: 150000sats path hops: 8\n", + "Success: True \t fee: 327.980msat \t p = 63.79% amt: 230000sats path hops: 8\n", + "Success: True \t fee: 28.340msat \t p = 98.23% amt: 20000sats path hops: 8\n", + "Success: True \t fee: 1232.790msat \t p = 35.71% amt: 870000sats path hops: 8\n", + "Success: True \t fee: 651.360msat \t p = 48.47% amt: 460000sats path hops: 8\n", + "Success: True \t fee: 93.940msat \t p = 21.06% amt: 70000sats path hops: 8\n", + "Success: True \t fee: 164.160msat \t p = 26.66% amt: 120000sats path hops: 9\n", + "Success: True \t fee: 68.100msat \t p = 37.01% amt: 50000sats path hops: 9\n", + "Success: True \t fee: 179.140msat \t p = 66.57% amt: 130000sats path hops: 9\n", + "Success: True \t fee: 83.340msat \t p = 44.50% amt: 60000sats path hops: 9\n", + "Success: True \t fee: 70.450msat \t p = 35.18% amt: 50000sats path hops: 9\n", + "Success: True \t fee: 355.000msat \t p = 33.25% amt: 250000sats path hops: 9\n", + "Success: True \t fee: 99.540msat \t p = 27.92% amt: 70000sats path hops: 9\n", + "Success: True \t fee: 27.240msat \t p = 89.33% amt: 20000sats path hops: 10\n", + "Success: True \t fee: 13.620msat \t p = 95.64% amt: 10000sats path hops: 10\n", + "Success: True \t fee: 490.320msat \t p = 16.43% amt: 360000sats path hops: 10\n", + "Success: True \t fee: 67.900msat \t p = 63.60% amt: 50000sats path hops: 10\n", + "Success: True \t fee: 249.300msat \t p = 34.12% amt: 180000sats path hops: 10\n", + "Success: True \t fee: 286.600msat \t p = 25.73% amt: 200000sats path hops: 10\n", + "Success: True \t fee: 178.230msat \t p = 74.95% amt: 130000sats path hops: 10\n", + "Success: True \t fee: 288.960msat \t p = 17.44% amt: 210000sats path hops: 10\n", + "Success: True \t fee: 27.400msat \t p = 81.30% amt: 20000sats path hops: 11\n", + "Success: True \t fee: 55.040msat \t p = 70.06% amt: 40000sats path hops: 11\n", + "Success: True \t fee: 42.030msat \t p = 57.56% amt: 30000sats path hops: 11\n", + "Success: True \t fee: 67.700msat \t p = 34.09% amt: 50000sats path hops: 12\n", + "Success: True \t fee: 85.260msat \t p = 72.16% amt: 60000sats path hops: 12\n", + "Success: True \t fee: 369.720msat \t p = 6.48% amt: 260000sats path hops: 13\n", + "Success: True \t fee: 142.300msat \t p = 61.87% amt: 100000sats path hops: 14\n", + "Success: True \t fee: 13.650msat \t p = 78.28% amt: 10000sats path hops: 14\n", + "Success: True \t fee: 94.780msat \t p = 37.30% amt: 70000sats path hops: 14\n", + "Success: True \t fee: 40.950msat \t p = 79.93% amt: 30000sats path hops: 14\n", + "Success: True \t fee: 13.650msat \t p = 61.84% amt: 10000sats path hops: 14\n", + "Success: True \t fee: 28.080msat \t p = 82.16% amt: 20000sats path hops: 15\n", + "Success: True \t fee: 40.860msat \t p = 71.38% amt: 30000sats path hops: 15\n", + "Success: True \t fee: 70.200msat \t p = 33.78% amt: 50000sats path hops: 15\n", + "Success: True \t fee: 27.240msat \t p = 65.31% amt: 20000sats path hops: 15\n", + "Success: True \t fee: 27.060msat \t p = 55.86% amt: 20000sats path hops: 15\n", + "Success: True \t fee: 99.470msat \t p = 33.11% amt: 70000sats path hops: 16\n", + "Success: True \t fee: 71.050msat \t p = 42.26% amt: 50000sats path hops: 16\n", + "total_fee: 28528.620 msat \t paid fees: 20299.460 msat\n", "\n", - "Try: 50000 sats. Round number: 3\n", + "Try: 6080000 sats. Round number: 3\n", "\\mu: 100 \n", - "Runtime of flow computation: 1.82 sec \n", - "Success: True \t fee: 66.850msat \t p = 96.43% amt: 50000sats path hops: 5\n", - "total_fee: 66.850 msat \t paid fees: 66.850 msat\n", + "Runtime of flow computation: 1.18 sec \n", + "Success: True \t fee: 108.720msat \t p = 88.09% amt: 80000sats path hops: 3\n", + "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", + "Success: True \t fee: 499.500msat \t p = 56.27% amt: 370000sats path hops: 4\n", + "Success: True \t fee: 2180.940msat \t p = 31.99% amt: 1630000sats path hops: 4\n", + "Success: True \t fee: 93.660msat \t p = 70.58% amt: 70000sats path hops: 4\n", + "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", + "Success: True \t fee: 108.720msat \t p = 56.07% amt: 80000sats path hops: 5\n", + "Success: True \t fee: 284.970msat \t p = 67.44% amt: 210000sats path hops: 5\n", + "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", + "Success: True \t fee: 27.180msat \t p = 76.38% amt: 20000sats path hops: 6\n", + "Success: True \t fee: 189.980msat \t p = 70.77% amt: 140000sats path hops: 6\n", + "Success: True \t fee: 348.400msat \t p = 59.16% amt: 260000sats path hops: 6\n", + "Success: True \t fee: 93.870msat \t p = 22.20% amt: 70000sats path hops: 6\n", + "Success: True \t fee: 635.910msat \t p = 48.72% amt: 470000sats path hops: 7\n", + "Success: True \t fee: 378.840msat \t p = 55.62% amt: 280000sats path hops: 8\n", + "Success: True \t fee: 93.870msat \t p = 23.85% amt: 70000sats path hops: 8\n", + "Success: True \t fee: 26.820msat \t p = 72.44% amt: 20000sats path hops: 8\n", + "Success: True \t fee: 27.180msat \t p = 83.23% amt: 20000sats path hops: 9\n", + "Success: True \t fee: 67.850msat \t p = 63.39% amt: 50000sats path hops: 9\n", + "Success: True \t fee: 67.650msat \t p = 37.37% amt: 50000sats path hops: 10\n", + "Success: True \t fee: 67.400msat \t p = 40.44% amt: 50000sats path hops: 11\n", + "Success: True \t fee: 26.960msat \t p = 61.88% amt: 20000sats path hops: 11\n", + "Success: True \t fee: 27.000msat \t p = 57.58% amt: 20000sats path hops: 12\n", + "Success: True \t fee: 67.200msat \t p = 25.49% amt: 50000sats path hops: 12\n", + "total_fee: 8166.750 msat \t paid fees: 8166.750 msat\n", "\n", "SUMMARY:\n", "Rounds of mcf-computations: 3\n", - "Number of onions sent: 207\n", - "Number of failed onions: 25 failure rate: 12.08% \n", - "total runtime (including inefficient memory managment): 4.992 sec\n", - "Learnt entropy: 194.36 bits\n", - "Fees for successfull delivery: 69975.050 sat --> 1399 ppm\n" + "Number of onions sent: 236\n", + "Number of failed onions: 19 failure rate: 8.05% \n", + "total runtime (including inefficient memory managment): 4.032 sec\n", + "Learnt entropy: 169.60 bits\n", + "Fees for successfull delivery: 70887.930 sat --> 1417 ppm\n" ] } ], @@ -1666,104 +1672,97 @@ "\n", "Try: 50000000 sats. Round number: 1\n", "\\mu: 1 \n", - "Runtime of flow computation: 1.04 sec \n", - "Success: True \t fee: 7567.020msat \t p = 47.70% amt: 5190000sats path hops: 3\n", - "Success: True \t fee: 9203.370msat \t p = 49.19% amt: 5010000sats path hops: 3\n", - "Success: True \t fee: 601.600msat \t p = 74.39% amt: 400000sats path hops: 3\n", - "Success: True \t fee: 1813.660msat \t p = 58.37% amt: 1180000sats path hops: 3\n", - "Success: True \t fee: 1620.780msat \t p = 24.44% amt: 1190000sats path hops: 3\n", - "Success: True \t fee: 475.650msat \t p = 52.76% amt: 350000sats path hops: 3\n", - "Success: True \t fee: 828.940msat \t p = 70.54% amt: 620000sats path hops: 3\n", - "Success: True \t fee: 944.720msat \t p = 90.88% amt: 560000sats path hops: 3\n", - "Success: True \t fee: 2191.840msat \t p = 32.55% amt: 1520000sats path hops: 3\n", - "Success: True \t fee: 380.500msat \t p = 72.73% amt: 250000sats path hops: 4\n", - "Success: True \t fee: 295.290msat \t p = 32.64% amt: 170000sats path hops: 4\n", - "Success: True \t fee: 1965.590msat \t p = 62.34% amt: 1070000sats path hops: 4\n", - "Success: True \t fee: 28.760msat \t p = 74.64% amt: 20000sats path hops: 4\n", - "Success: True \t fee: 57.880msat \t p = 89.08% amt: 40000sats path hops: 4\n", - "Success: True \t fee: 143.800msat \t p = 68.43% amt: 100000sats path hops: 4\n", - "Success: True \t fee: 701.190msat \t p = 12.68% amt: 490000sats path hops: 4\n", - "Success: True \t fee: 270.000msat \t p = 74.42% amt: 200000sats path hops: 4\n", - "Success: True \t fee: 977.350msat \t p = 57.52% amt: 550000sats path hops: 4\n", - "Success: True \t fee: 3510.160msat \t p = 35.47% amt: 2320000sats path hops: 4\n", - "Success: True \t fee: 2411.130msat \t p = 7.35% amt: 1790000sats path hops: 4\n", - "Success: True \t fee: 2612.750msat \t p = 32.16% amt: 1750000sats path hops: 4\n", - "Success: True \t fee: 754.880msat \t p = 22.81% amt: 560000sats path hops: 4\n", - "Success: True \t fee: 770.640msat \t p = 34.42% amt: 520000sats path hops: 4\n", - "Success: True \t fee: 312.800msat \t p = 36.34% amt: 230000sats path hops: 4\n", - "Success: True \t fee: 404.570msat \t p = 38.55% amt: 230000sats path hops: 4\n", - "Success: True \t fee: 371.070msat \t p = 58.35% amt: 210000sats path hops: 4\n", - "Success: True \t fee: 372.330msat \t p = 62.84% amt: 270000sats path hops: 4\n", - "Success: True \t fee: 17.590msat \t p = 96.96% amt: 10000sats path hops: 4\n", - "Success: True \t fee: 229.330msat \t p = 26.26% amt: 170000sats path hops: 4\n", - "Success: True \t fee: 115.120msat \t p = 76.87% amt: 80000sats path hops: 4\n", - "Success: True \t fee: 7715.140msat \t p = 31.63% amt: 5140000sats path hops: 4\n", - "Success: True \t fee: 574.260msat \t p = 93.35% amt: 340000sats path hops: 4\n", - "Success: True \t fee: 79.450msat \t p = 96.69% amt: 50000sats path hops: 4\n", - "Success: True \t fee: 1969.800msat \t p = 1.14% amt: 1470000sats path hops: 4\n", - "Success: True \t fee: 1234.440msat \t p = 47.30% amt: 810000sats path hops: 4\n", - "Success: True \t fee: 69.520msat \t p = 42.23% amt: 40000sats path hops: 5\n", - "Success: True \t fee: 194.920msat \t p = 54.09% amt: 110000sats path hops: 5\n", - "Success: True \t fee: 177.320msat \t p = 81.89% amt: 110000sats path hops: 5\n", - "Success: True \t fee: 223.720msat \t p = 78.74% amt: 140000sats path hops: 5\n", - "Success: True \t fee: 121.320msat \t p = 91.56% amt: 90000sats path hops: 5\n", - "Success: True \t fee: 656.600msat \t p = 47.08% amt: 490000sats path hops: 5\n", - "Success: True \t fee: 579.640msat \t p = 60.58% amt: 430000sats path hops: 5\n", - "Success: True \t fee: 624.840msat \t p = 56.43% amt: 410000sats path hops: 5\n", - "Success: True \t fee: 1889.400msat \t p = 35.43% amt: 1410000sats path hops: 5\n", - "Success: True \t fee: 1611.360msat \t p = 48.70% amt: 1080000sats path hops: 5\n", - "Success: True \t fee: 2328.100msat \t p = 46.26% amt: 1550000sats path hops: 5\n", - "Success: True \t fee: 1199.440msat \t p = 21.04% amt: 880000sats path hops: 5\n", - "Success: True \t fee: 719.040msat \t p = 53.74% amt: 420000sats path hops: 5\n", - "Success: True \t fee: 192.360msat \t p = 72.57% amt: 140000sats path hops: 5\n", - "Success: True \t fee: 695.760msat \t p = 51.96% amt: 520000sats path hops: 5\n", - "Success: True \t fee: 70.280msat \t p = 85.90% amt: 40000sats path hops: 5\n", - "Success: True \t fee: 374.640msat \t p = 3.83% amt: 280000sats path hops: 5\n", - "Success: True \t fee: 32.240msat \t p = 95.97% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 2580.630msat \t p = 17.61% amt: 1690000sats path hops: 6\n", - "Success: True \t fee: 463.200msat \t p = 44.60% amt: 300000sats path hops: 6\n", - "Success: True \t fee: 142.400msat \t p = 79.66% amt: 100000sats path hops: 6\n", - "Success: True \t fee: 544.950msat \t p = 45.76% amt: 350000sats path hops: 7\n", - "Success: True \t fee: 581.020msat \t p = 33.75% amt: 380000sats path hops: 7\n", - "Success: False \t fee: 85.260msat \t p = 68.86% amt: 60000sats path hops: 7\n", - "Success: True \t fee: 72.050msat \t p = 73.63% amt: 50000sats path hops: 7\n", - "Success: True \t fee: 14.950msat \t p = 95.03% amt: 10000sats path hops: 7\n", - "Success: True \t fee: 14.800msat \t p = 47.83% amt: 10000sats path hops: 7\n", - "Success: True \t fee: 28.820msat \t p = 35.74% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 100.100msat \t p = 8.77% amt: 70000sats path hops: 7\n", - "Success: False \t fee: 144.100msat \t p = 61.04% amt: 100000sats path hops: 7\n", - "Success: True \t fee: 76.000msat \t p = 24.55% amt: 50000sats path hops: 7\n", - "Success: True \t fee: 29.380msat \t p = 35.74% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 285.200msat \t p = 65.89% amt: 200000sats path hops: 7\n", - "Success: True \t fee: 17.800msat \t p = 64.71% amt: 10000sats path hops: 7\n", - "Success: True \t fee: 656.040msat \t p = 68.54% amt: 440000sats path hops: 7\n", - "Success: True \t fee: 28.540msat \t p = 92.27% amt: 20000sats path hops: 8\n", - "Success: True \t fee: 527.820msat \t p = 65.43% amt: 380000sats path hops: 8\n", - "Success: True \t fee: 1817.930msat \t p = 16.34% amt: 1070000sats path hops: 8\n", - "Success: True \t fee: 131.580msat \t p = 6.03% amt: 90000sats path hops: 8\n", - "Success: False \t fee: 331.200msat \t p = 51.20% amt: 230000sats path hops: 8\n", - "Success: True \t fee: 246.000msat \t p = 62.11% amt: 150000sats path hops: 8\n", - "Success: True \t fee: 295.020msat \t p = 84.27% amt: 180000sats path hops: 8\n", - "Success: True \t fee: 1085.040msat \t p = 35.96% amt: 660000sats path hops: 8\n", - "Success: True \t fee: 112.160msat \t p = 18.21% amt: 80000sats path hops: 8\n", - "Success: True \t fee: 259.920msat \t p = 64.29% amt: 180000sats path hops: 8\n", - "Success: True \t fee: 121.760msat \t p = 13.35% amt: 80000sats path hops: 10\n", - "total_fee: 76077.570 msat \t paid fees: 75517.010 msat\n", + "Runtime of flow computation: 0.91 sec \n", + "Success: True \t fee: 13180.320msat \t p = 21.27% amt: 9040000sats path hops: 3\n", + "Success: True \t fee: 2060.480msat \t p = 23.93% amt: 1370000sats path hops: 3\n", + "Success: True \t fee: 2197.910msat \t p = 50.98% amt: 1430000sats path hops: 3\n", + "Success: True \t fee: 1511.820msat \t p = 28.04% amt: 1110000sats path hops: 3\n", + "Success: True \t fee: 217.440msat \t p = 76.84% amt: 160000sats path hops: 3\n", + "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", + "Success: True \t fee: 5971.980msat \t p = 49.35% amt: 3540000sats path hops: 3\n", + "Success: True \t fee: 1225.700msat \t p = 57.83% amt: 850000sats path hops: 3\n", + "Success: True \t fee: 289.180msat \t p = 78.79% amt: 190000sats path hops: 4\n", + "Success: True \t fee: 129.420msat \t p = 6.99% amt: 90000sats path hops: 4\n", + "Success: True \t fee: 390.690msat \t p = 38.52% amt: 270000sats path hops: 4\n", + "Success: True \t fee: 100.170msat \t p = 84.19% amt: 70000sats path hops: 4\n", + "Success: True \t fee: 472.500msat \t p = 58.24% amt: 350000sats path hops: 4\n", + "Success: True \t fee: 2057.680msat \t p = 57.80% amt: 1360000sats path hops: 4\n", + "Success: True \t fee: 205.050msat \t p = 88.90% amt: 150000sats path hops: 4\n", + "Success: True \t fee: 5270.290msat \t p = 2.22% amt: 3530000sats path hops: 4\n", + "Success: True \t fee: 465.930msat \t p = 89.42% amt: 310000sats path hops: 4\n", + "Success: True \t fee: 350.480msat \t p = 56.01% amt: 260000sats path hops: 4\n", + "Success: True \t fee: 696.540msat \t p = 39.41% amt: 470000sats path hops: 4\n", + "Success: True \t fee: 95.200msat \t p = 76.94% amt: 70000sats path hops: 4\n", + "Success: True \t fee: 685.730msat \t p = 36.73% amt: 470000sats path hops: 4\n", + "Success: True \t fee: 1980.240msat \t p = 36.78% amt: 1480000sats path hops: 4\n", + "Success: True \t fee: 215.800msat \t p = 89.80% amt: 130000sats path hops: 4\n", + "Success: True \t fee: 902.850msat \t p = 15.53% amt: 650000sats path hops: 4\n", + "Success: True \t fee: 386.120msat \t p = 61.62% amt: 280000sats path hops: 4\n", + "Success: True \t fee: 184.680msat \t p = 93.91% amt: 120000sats path hops: 4\n", + "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", + "Success: True \t fee: 187.070msat \t p = 63.82% amt: 130000sats path hops: 4\n", + "Success: True \t fee: 2113.370msat \t p = 26.47% amt: 1330000sats path hops: 4\n", + "Success: True \t fee: 897.800msat \t p = 44.01% amt: 670000sats path hops: 4\n", + "Success: True \t fee: 48.540msat \t p = 99.23% amt: 30000sats path hops: 4\n", + "Success: True \t fee: 548.640msat \t p = 74.31% amt: 360000sats path hops: 4\n", + "Success: True \t fee: 115.760msat \t p = 76.88% amt: 80000sats path hops: 5\n", + "Success: True \t fee: 28.760msat \t p = 92.73% amt: 20000sats path hops: 5\n", + "Success: True \t fee: 1278.400msat \t p = 19.31% amt: 800000sats path hops: 5\n", + "Success: True \t fee: 783.200msat \t p = 34.37% amt: 550000sats path hops: 5\n", + "Success: True \t fee: 1896.570msat \t p = 28.04% amt: 1170000sats path hops: 5\n", + "Success: True \t fee: 603.540msat \t p = 25.46% amt: 420000sats path hops: 5\n", + "Success: True \t fee: 180.240msat \t p = 94.86% amt: 120000sats path hops: 5\n", + "Success: True \t fee: 1800.960msat \t p = 51.40% amt: 1120000sats path hops: 5\n", + "Success: True \t fee: 1025.440msat \t p = 64.67% amt: 680000sats path hops: 5\n", + "Success: True \t fee: 1244.700msat \t p = 0.71% amt: 900000sats path hops: 6\n", + "Success: True \t fee: 274.930msat \t p = 53.50% amt: 190000sats path hops: 6\n", + "Success: True \t fee: 981.760msat \t p = 32.78% amt: 640000sats path hops: 6\n", + "Success: True \t fee: 809.460msat \t p = 59.73% amt: 540000sats path hops: 6\n", + "Success: True \t fee: 641.340msat \t p = 70.18% amt: 420000sats path hops: 6\n", + "Success: True \t fee: 416.880msat \t p = 48.97% amt: 270000sats path hops: 6\n", + "Success: True \t fee: 949.770msat \t p = 20.51% amt: 610000sats path hops: 7\n", + "Success: True \t fee: 527.680msat \t p = 34.64% amt: 340000sats path hops: 7\n", + "Success: True \t fee: 321.310msat \t p = 65.85% amt: 230000sats path hops: 7\n", + "Success: True \t fee: 125.730msat \t p = 90.13% amt: 90000sats path hops: 7\n", + "Success: True \t fee: 436.790msat \t p = 45.01% amt: 310000sats path hops: 7\n", + "Success: True \t fee: 138.900msat \t p = 85.38% amt: 100000sats path hops: 7\n", + "Success: True \t fee: 1089.660msat \t p = 33.08% amt: 780000sats path hops: 7\n", + "Success: True \t fee: 43.440msat \t p = 91.82% amt: 30000sats path hops: 7\n", + "Success: True \t fee: 14.700msat \t p = 85.67% amt: 10000sats path hops: 7\n", + "Success: True \t fee: 116.960msat \t p = 13.21% amt: 80000sats path hops: 7\n", + "Success: True \t fee: 1893.480msat \t p = 16.80% amt: 1240000sats path hops: 8\n", + "Success: True \t fee: 599.640msat \t p = 53.89% amt: 380000sats path hops: 8\n", + "Success: True \t fee: 449.500msat \t p = 53.89% amt: 290000sats path hops: 8\n", + "Success: True \t fee: 14.410msat \t p = 94.41% amt: 10000sats path hops: 8\n", + "Success: False \t fee: 14.210msat \t p = 94.41% amt: 10000sats path hops: 8\n", + "Success: True \t fee: 254.150msat \t p = 26.89% amt: 170000sats path hops: 8\n", + "Success: True \t fee: 14.800msat \t p = 47.84% amt: 10000sats path hops: 8\n", + "Success: True \t fee: 1344.600msat \t p = 61.55% amt: 900000sats path hops: 8\n", + "Success: True \t fee: 288.230msat \t p = 68.52% amt: 190000sats path hops: 8\n", + "Success: True \t fee: 805.680msat \t p = 53.61% amt: 540000sats path hops: 8\n", + "Success: True \t fee: 150.500msat \t p = 82.16% amt: 100000sats path hops: 9\n", + "Success: True \t fee: 45.450msat \t p = 82.45% amt: 30000sats path hops: 9\n", + "Success: True \t fee: 14.500msat \t p = 63.10% amt: 10000sats path hops: 9\n", + "Success: True \t fee: 1232.460msat \t p = 20.52% amt: 820000sats path hops: 9\n", + "Success: True \t fee: 2748.960msat \t p = 17.37% amt: 1840000sats path hops: 9\n", + "Success: True \t fee: 804.010msat \t p = 24.76% amt: 530000sats path hops: 9\n", + "Success: True \t fee: 395.280msat \t p = 4.86% amt: 270000sats path hops: 9\n", + "Success: True \t fee: 138.600msat \t p = 5.81% amt: 90000sats path hops: 10\n", + "total_fee: 74503.840 msat \t paid fees: 74489.630 msat\n", "\n", - "Try: 390000 sats. Round number: 2\n", + "Try: 10000 sats. Round number: 2\n", "\\mu: 1 \n", - "Runtime of flow computation: 0.81 sec \n", - "Success: True \t fee: 53.480msat \t p = 98.01% amt: 40000sats path hops: 3\n", - "Success: True \t fee: 467.950msat \t p = 65.98% amt: 350000sats path hops: 4\n", - "total_fee: 521.430 msat \t paid fees: 521.430 msat\n", + "Runtime of flow computation: 0.89 sec \n", + "Success: True \t fee: 13.370msat \t p = 99.28% amt: 10000sats path hops: 5\n", + "total_fee: 13.370 msat \t paid fees: 13.370 msat\n", "\n", "SUMMARY:\n", "Rounds of mcf-computations: 2\n", - "Number of onions sent: 83\n", - "Number of failed onions: 3 failure rate: 3.61% \n", - "total runtime (including inefficient memory managment): 1.853 sec\n", - "Learnt entropy: 67.87 bits\n", - "Fees for successfull delivery: 76038.440 sat --> 1520 ppm\n" + "Number of onions sent: 76\n", + "Number of failed onions: 1 failure rate: 1.32% \n", + "total runtime (including inefficient memory managment): 1.796 sec\n", + "Learnt entropy: 53.58 bits\n", + "Fees for successfull delivery: 74503.000 sat --> 1490 ppm\n" ] } ], From 8c15359e9460065a2191b80385a7004310c7011f Mon Sep 17 00:00:00 2001 From: Rene Pickhardt Date: Tue, 12 Apr 2022 17:27:46 +0200 Subject: [PATCH 3/3] complete refactoring of the code base and ipynb we now have 7 classes, channel, uncertaintychannel, oraclechannel, ChannelGraph, UncertaintyNetwork, OracleLightningNetwork and PaymentSession with a clean speration of concerns. this is still WIP and needs review --- Pickhardt-Payments-Simulation.ipynb | 4132 ++++++++++++++++++--------- 1 file changed, 2815 insertions(+), 1317 deletions(-) diff --git a/Pickhardt-Payments-Simulation.ipynb b/Pickhardt-Payments-Simulation.ipynb index ce11498..66c94d0 100644 --- a/Pickhardt-Payments-Simulation.ipynb +++ b/Pickhardt-Payments-Simulation.ipynb @@ -4,27 +4,43 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "# Pickhardt Payments Simulator\n", + "\n", "This is an educational simulation to demonstrate how to implement the main concepts of [probabilistic payment delivery with the additional maintainance of the uncertainty network](https://arxiv.org/abs/2103.08576) and [optimal splitting of payments in MPP which is also known as optimally realiable payment flows](https://arxiv.org/abs/2107.05322)\n", "\n", - "This code assumes an oracle with the actual liquidity of channels to exist. In reality the oracle is the lightning network which can be queried by sending out actual onions.\n", + "This code assumes an oracle with the actual liquidity of channels to exist. In reality the oracle is the lightning network which can be queried by sending out actual onions. We randomly generate the liquidity for the oracle but one may also obviously use a crawl of the network\n", + "\n", "\n", "## Warning: THIS IS WORK IN PROGRESS: The code has some severe limitations...\n", - "...which make it impractical for real nodes and implementations. Do not just blindly wrap this into production code but address the following limitations:\n", + "... which may make it impractical for real nodes and implementations. Do not just blindly wrap this into production code but address the following limitations:\n", "\n", + "* Software tests are missing\n", "* channel reserves are ignored\n", "* HTLC limits like min_size, max_size, max_accepted_htlc are fully ignored\n", - "* proper handling of parallel channels needs to be done\n", "* strategies to operate with hanging htlc's (some might require protocol updates) may need to be included\n", "* concurrent handeling of onions and maintanance of the uncertainty network\n", "* proper handling of non zero base fee channels is needed and in particular handeling their cost properly at least as good as it is possible\n", "* better piecewise splitting / quantization of the amounts is necessary\n", - "* learning how to weight various features needs to be conducted or at least configureably be in place\n", + "* learning how to weight various features needs to be conducted or at least configureably be in place or...\n", + "* ...proper feature Engineering. Combining the linearized integer uncertainty cost and the routing cost just via the weight $\\mu$ seens a bit arbitrary. I think centering, scaling and especially for channels log transformation etc as [described in this article](https://www.kaggle.com/code/milankalkenings/comprehensive-tutorial-feature-engineering/notebook) might work better\n", "* Mechanics of making learnt information persistant over some time\n", - "* inclusion of other otpimization goals that predict reliability are missing (like latency, distance, ...)\n", - "* One should Prune the graph before invoking the solver\n", + "* inclusion of other optimization goals that predict reliability are missing (like latency, distance, ...)\n", + "* One should Prune the graph before invoking the solver (I tested but excluded a totally arbitrary pruning mechanism which produced a speedup of 10x for the solver making it run constantly in less than 100ms). I am very sure with centering, scaling and proper feature engineering we can get a much better pruner with errror guarantees and similar or even better speedup)\n", "* properly conduct the piecewise linearization of the cost function\n", - "* don't overwrite memory of the entire uncertainty network all the time but just update the necessary pieces before invoking the solver\n", - "* potentially write your own stand alone cost scaling min cost flow solver instead of relying on a third party dependency\n" + "* don't overwrite memory of the entire UncertaintyNetwork and UncertaintyChannel and the solver all the time but just update the necessary pieces before invoking the solver\n", + "* potentially write your own stand alone cost scaling min cost flow solver instead of relying on a third party dependency\n", + "* Onions of upstream channels do not add downstream fees which would have to be done in mainnet\n", + "* **IMPORTANT** Proper error handling of the ortools lib if not enough liquidity is on the network and no flow is feasible\n", + " \n", + "## What the code does: \n", + "* Conduct and simulate a single PaymentSession \n", + "* Properly track the learnt information from prior Attempts\n", + "* Showcase how strategies similar to the BOTL 14 proposal may be used\n", + "* Show how a sequential pay loop may conceptionally be built\n", + "* Properly transform the payment delivery problem to a min cost flow problem with a piecewise linearized cost function\n", + "* Demonstrate that the min cost flow approach is feasbale. \n", + "* Allow for extension \n", + "* proper handling of parallel channels! (YES! I finally handle them properly. I always virtualized and simplified but I came around)\n" ] }, { @@ -44,17 +60,20 @@ "nodes would only signal a message if the liquidity switches from one of those intervals to another (of course one could also require 3 bits or so)\n", "\n", "## TODOS: \n", - "as hinted in the ldk issue https://github.com/lightningdevkit/rust-lightning/issues/1372 it might make sense to not use a global \\mu but rather learn it for each channel by comparing min uncertainty cost ~ 1/c max uncertainty cost = log(c+1) with the ppm on the edge and make sure we get this in the same order. It is only a test but it might turn out to work really well\n", "\n", - "fix some fixme's most notably the data model that produces poor probability computation in outputs as it ignors the prior knowlege which means all displayed probabilities are too low (though the flow is computed properly)\n", - "\n", - "make a useful design for liquidity sharing...\n", + "* Make it easier to use with other implementations than c-lighting by creating a mapping from your channel data to cln_json and use \n", + "* make bolt14 experiemtns more realistic and depend on actual `send_onions` calls\n", + "* as hinted in the ldk issue https://github.com/lightningdevkit/rust-lightning/issues/1372 it might make sense to not use a global \\mu but rather learn it for each channel by comparing min uncertainty cost ~ 1/c max uncertainty cost = log(c+1) with the ppm on the edge and make sure we get this in the same order. It is only a test but it might turn out to work really well\n", + "* fix some fixme's most notably the data model that produces poor probability computation in outputs as it ignors the prior knowlege which means all displayed probabilities are too low (though the flow is computed properly)\n", + "* make a useful design for liquidity sharing and BOLT 14 experiments\n", + "* Extract standalone python module with Channel, UncertaintyChannel, ChannelGraph & UncertaintyNetwork. Also provide clearer Interface for people to implement their own Oracles\n", + "* provide a few more examples / simulations and in particular derrive some nice diagrams sumarizing some results\n", "\n", "# Funding\n", "\n", "This research result is funded through [NTNU](https://www.ntnu.no) and [BitMEX](https://blog.bitmex.com/bitmex-2021-open-source-developer-grants/) as well as generous donations from the Bitcoin community via https://donate.ln.rene-pickhardt.de and via recurring donations at https://www.patreon.com/renepickhardt. If you want to learn why independent research and development for Bitcoin and the Lightning Network is important I kindly refer you to: https://ln.rene-pickhardt.de/ of course I will be grateful if you consider my work of importance and decide to support it.\n", "\n", - "Special Thanks to Stefan Richter with whom we implemented the first mainnet tests on top of lnd which certainly helped me to clarify many details and get the maintanance of the uncertainty network straight." + "Special Thanks to Stefan Richter with whom we implemented the first mainnet tests on top of lnd which certainly helped me to clarify many details and get the maintanance of the uncertainty network straight. Thanks to Michael Ziegler and Carsten Otto for an initial code review that made me rewrite the entire code base from scratch." ] }, { @@ -67,10 +86,15 @@ "\n", "\n", "## (Payment) Channel\n", - "Payment `channel`s are either announced or unnannounced but known to the sender and recpient of a payment. They have meta data like the `capacity` or `routing fees` as well as some other config values which we ignore for simplicity here.\n", + "Payment `channel`s are either announced or unnannounced but known to the sender and recpient of a payment. They have meta data like the `capacity` or `routing fees` as well as some other config values which we carry around but ignore for simplicity here.\n", + "\n", + "The `Channel` is the base class in this code and identifies a channel by the trippled `(source_node_id, destionation_node_id, short_channel_id)` in this way we make the direction explicit and don't encode about lexicographical DER-encoding of `node_ids` and the direction field as done by the bolts.\n", "\n", "## Arc\n", - "An `arc` is not to be confused with a payment `channel`. `Arc`s are the data structure that arise from the piece wise linearized `cost function` and are used internally in the min cost flow solver. \n", + "An `arc` is not to be confused with a payment `channel`. `Arc`s are the data structure that arise from the piece wise linearized `cost function` and are used internally in the min cost flow solver. In this code you will not find the terminology of an arc.\n", + "\n", + "## edge\n", + "eges are the things between nodes of a graph or network. In the code this is just the native name of the networkx library. Edges usually map to `Channels`, `UncertaintyChannels` or `OracleChannels` and usually have one of those attached to it in the `channel`-field.\n", "\n", "\n", "## (Channel) Capacity\n", @@ -141,7 +165,7 @@ "\n", "The `features` of our cost function encode our optimization goals. Typicalfeatures goals might be to have a cheap price (usually encoded by `fee`) or to have a high reliability (in this work best encoded by the `uncertainty cost`that comes from the estimated `success probability` that the channel has enough `liquidity`. Other features that seam reasonable are things related to `latency` of payments (e.g. [pyhsical geodistance or virtaul IP-distance as indicted in this comment](https://github.com/lightningdevkit/rust-lightning/issues/1170)). Implementations have also experimented with other features like CLTV delta or channel age. \n", "\n", - "Feature engineering is a crucial part for future research \n", + "Feature engineering [as described in this article](https://www.kaggle.com/code/milankalkenings/comprehensive-tutorial-feature-engineering/notebook) is a crucial part for future research \n", "\n", "## Success Probability\n", "\n", @@ -171,7 +195,22 @@ "## Pickhardt Payments\n", "As the term is more and more starting to flow around I will try to summarize best what is currently from a technial point of view meant by it: \n", "\n", - "`Using probabilistic payment delivery` in a round based `payment loop` that updeates our belief of the remote `liquidity` in the `uncertainty network` and generates reliable and cheap `payment flows` in every round by solving a `piece wise linearized min integer cost flow problem with a seperable cost function` (I start to see why a shorter term was needed)." + "`Using probabilistic payment delivery` in a round based `payment loop` that updeates our belief of the remote `liquidity` in the `uncertainty network` and generates reliable and cheap `payment flows` in every round by solving a `piece wise linearized min integer cost flow problem with a seperable cost function` (I start to see why a shorter term was needed).\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Imports from the Python standard lib\n", + "\n", + "We could get rid of all these dependencies! \n", + "* `json` is only used to parse and store the information from `lightning-cli listchannels`. \n", + "* `random` is used to feed our oracle with a simulated ground truth. If you make actual payments the mainnet Lightnign Network will act as an oracle\n", + "* `time` is only used for time measurements\n", + "* While `log` is used to measure `entropy` and `uncertainty cost` the linerized problem gets rid of the `log` and the Entropy is also only measured for experimental data.\n", + "* the `typing` lib is just for type safty" ] }, { @@ -180,12 +219,22 @@ "metadata": {}, "outputs": [], "source": [ - "from ortools.graph import pywrapgraph\n", - "import time\n", - "import random\n", - "import networkx as nx\n", "import json\n", - "from math import log2 as log" + "import random\n", + "import time\n", + "from math import log2 as log\n", + "from typing import List\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Imports of third party libraries\n", + "\n", + "We use `networkx` to internally store the `ChannelGraph`, the `UncertaintyNetwork` and the `OracleLightningNetwork` this produces quite some inefficient memory management an decreases the runtime of this simulation significantly. Yet for the sake of simplicity and readability of the code and to explain the concepts we chose to use the `networkx` for this task.\n", + "\n", + "For solving the min cost flow problem we used `ortools` from the Google OR-Tools lib. This is a highly efficient C++ library that contains an integer linear min cost flow solver. We loose most of our runtime by maintaining the the state of our model and feeding it into the min cost flow solver provided by `ortools`. If you want to create an actual pay implementation we suggest that you extract the solver from `ortools` and maintain the state of the model in a way that is memory efficient." ] }, { @@ -194,28 +243,355 @@ "metadata": {}, "outputs": [], "source": [ - "def next_hop(path):\n", + "import networkx as nx\n", + "from ortools.graph import pywrapgraph" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Some config values" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "#ignores all channels with a base fee higher than DEFAULT_BASE_THRESHOLD msat\n", + "DEFAULT_BASE_THRESHOLD = 0\n", + "\n", + "#mu value to combine both features\n", + "DEFAULT_MU = 1\n", + "\n", + "#default number of piecewise linear approximations of the uncertainty cost\n", + "DEFAULT_N = 5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Channel\n", + "\n", + "The `Channel` is used to store publicly available infromation about a channel. It currently follows mainly the format of `lightning-cli listchannels` output from `c-lightning`. The class is intended to only store the gossip information and not meant to modify the information. In a mainnet `pickhardt-pay` implementation one would obviously want a class that also processes incoming `update_channel` messages.\n", + "\n", + "`Channels` are identified by the trippled `(source_node_id, destionation_node_id, short_channel_id)` in this way we make the direction explicit and don't encode about lexicographical DER-encoding of `node_ids` and the direction field as done by the bolts.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "class ChannelFields():\n", + " \"\"\"\n", + " These are the values describing public data about channels that is either available\n", + " via gossip or via the Bitcoin Blockchain. Their format is taken from the c-lighting\n", + " API. If you use a different implementation I suggest to write a wrapper around the\n", + " `ChannelFields` and `Channel` class\n", + " \"\"\"\n", + " SRC = 'source'\n", + " HTLC_MINIMUM_MSAT = 'htlc_minimum_msat'\n", + " HTLC_MAXIMUM_MSAT = 'htlc_maximum_msat'\n", + " BASE_FEE_MSAT = 'base_fee_millisatoshi'\n", + " ANNOUNCED = 'public'\n", + " DEST = 'destination'\n", + " LAST_UPDATE = 'last_update'\n", + " FEE_RATE = 'fee_per_millionth'\n", + " FEATURES = 'features' \n", + " CAP = 'satoshis'\n", + " ACTIVE = 'active'\n", + " CLTV = 'delay'\n", + " FLAGS = 'channel_flags'\n", + " SHORT_CHANNEL_ID = 'short_channel_id'\n", + "\n", + "class Channel():\n", + " \"\"\"\n", + " Stores the public available information of a channel.\n", + " \n", + " The `Channel` Class is intended to be read only and internatlly stores\n", + " the data from c-lightning's `lightning-cli listchannels` command as a json.\n", + " If you retrieve data from a different implementation I suggest to overload\n", + " the constructor and transform the information into the given json format\n", + " \"\"\"\n", + " def __init__(self,cln_jsn):\n", + " self._cln_jsn = cln_jsn\n", + " \n", + " @property\n", + " def cln_jsn(self):\n", + " return self._cln_jsn\n", + " \n", + " @property\n", + " def src(self):\n", + " return self._cln_jsn[ChannelFields.SRC]\n", + "\n", + " @property\n", + " def htlc_min_msat(self):\n", + " return self._cln_jsn[ChannelFields.HTLC_MINIMUM_MSAT]\n", + "\n", + " @property\n", + " def htlc_max_msat(self):\n", + " return self._cln_jsn[ChannelFields.HTLC_MAXIMUM_MSAT]\n", + "\n", + " @property\n", + " def base_fee(self):\n", + " return self._cln_jsn[ChannelFields.BASE_FEE_MSAT]\n", + "\n", + " @property\n", + " def is_announced(self):\n", + " return self._cln_jsn[ChannelFields.ANNOUNCED]\n", + "\n", + " @property\n", + " def dest(self):\n", + " return self._cln_jsn[ChannelFields.DEST]\n", + "\n", + " @property\n", + " def ppm(self):\n", + " return self._cln_jsn[ChannelFields.FEE_RATE]\n", + "\n", + " @property\n", + " def capacity(self):\n", + " return self._cln_jsn[ChannelFields.CAP]\n", + "\n", + " @property\n", + " def is_active(self):\n", + " return self._cln_jsn[ChannelFields.ACTIVE]\n", + "\n", + " @property\n", + " def cltv_delta(self):\n", + " return self._cln_jsn[ChannelFields.CLTV]\n", + " \n", + " @property\n", + " def flags(self):\n", + " return self._cln_jsn[ChannelFields.FLAGS]\n", + "\n", + " @property\n", + " def short_channel_id(self):\n", + " return self._cln_jsn[ChannelFields.SHORT_CHANNEL_ID]\n", + " \n", + " def __str__(self):\n", + " return str(self._cln_jsn)\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# ChannelGraph\n", + "\n", + "The `ChannelGraph` is a term borrowed from `lnd`. While we also have the `UncertaintyNetwork` and the `OracleLightningNetwork` we decided to take over the `lnd` notation because it is wildly used\n", + "\n", + "The `ChannelGraph` is the most basic data structure and extended to the `UncertaintyNetwork` and `OracleNetwork`. Note that we didn't use the Term `Network` or `ChannelNetwork` which from a software engineering perspecive would have been more resonable. There was [a poll deciding against](https://twitter.com/renepickhardt/status/1513095719862816769) this." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "class ChannelGraph():\n", " \"\"\"\n", - " generator to iterate through edges indext by node id of paths\n", + " Represents the public information about the Lightning Network that we see from Gossip and the \n", + " Bitcoin Blockchain. \n", " \n", - " The path is a list of node ids. Each call returns a tuple src, dest of an edge in the path \n", + " The channels of the Channel Graph are directed and identiried uniquly by a triple consisting of\n", + " (source_node_id, destination_node_id, short_channel_id). This allows the ChannelGraph to also \n", + " contain parallel channels.\n", " \"\"\"\n", - " for i in range(1,len(path)):\n", - " src = path[i-1]\n", - " dest = path[i]\n", - " yield (src,dest)" + " def _get_channel_json(self,filename:str):\n", + " \"\"\"\n", + " extracts the dictionary from the file that contains lightnig-cli listchannels json string\n", + " \"\"\"\n", + " f = open(filename)\n", + " return json.load(f)[\"channels\"]\n", + " \n", + " \n", + " def __init__(self,lightning_cli_listchannels_json_file:str):\n", + " \"\"\"\n", + " Importing the channel_graph from c-lightning listchannels command the file can be received by \n", + " #$ lightning-cli listchannels > listchannels.json\n", + "\n", + " \"\"\"\n", + " \n", + " self._channel_graph = nx.MultiDiGraph()\n", + " channels = self._get_channel_json(lightning_cli_listchannels_json_file)\n", + " for channel in channels:\n", + " channel = Channel(channel)\n", + " self._channel_graph.add_edge(channel.src, channel.dest, key=channel.short_channel_id, channel=channel)\n", + " \n", + " @property\n", + " def network(self):\n", + " return self._channel_graph\n", + " \n", + " \n", + " def get_channel(self, src: str, dest: str, short_channel_id: str):\n", + " \"\"\"\n", + " returns a specific channel object identified by source, destination and short_channel_id\n", + " from the ChannelGraph\n", + " \"\"\"\n", + " if self.network.has_edge(src,dest):\n", + " if short_channel_id in self.network[src][dest]:\n", + " return self.network[src][dest][short_channel_id][\"channel\"]\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Oracle Channel\n", + "\n", + "While on the Lightning Network we cannot ask a channel for its actual liquidity we decided for the simplicity of the simulation to not only have the `can_forward` API call but also provide `actual_liquidity` API. This makes some data flow easier. Of course this information must not be used to feed the min cost flow solver in the actual experiments" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "class OracleChannel(Channel):\n", + " \"\"\"\n", + " An OracleChannel us used in experiments and Simulations to form the (Oracle)LightningNetwork.\n", + " \n", + " It contains a ground truth about the Liquidity of a channel\n", + " \"\"\" \n", + " def __init__(self, channel:Channel, actual_liquidity : int = None):\n", + " super().__init__(channel.cln_jsn)\n", + " self._actual_liquidity=actual_liquidity\n", + " if actual_liquidity is None or actual_liquidity >= self.capacity or actual_liquidity < 0:\n", + " self._actual_liquidity = random.randint(0,self.capacity)\n", + " \n", + " def __str__(self):\n", + " return super().__str__()+\" actual Liquidity: {}\".format(self.actual_liquidity)\n", + " \n", + " @property\n", + " def actual_liquidity(self):\n", + " \"\"\"\n", + " Tells us the actual liquidity according to the oracle. \n", + " \n", + " This is usful for experiments but must of course not be used in routing and is also\n", + " not a vailable if mainnet remote channels are being used.\n", + " \"\"\"\n", + " return self._actual_liquidity\n", + "\n", + " def can_forward(self,amt:int):\n", + " \"\"\"\n", + " check if the oracle channel can forward a certain amount\n", + " \"\"\"\n", + " if amt <= self.actual_liquidity:\n", + " return True\n", + " else:\n", + " return False " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Oracle Lightning Network\n", + "\n", + "This is a very simplified class that can easily be used in simulations. It randomly assigns liquidity to channels of an existing ChannelGraph following a uniform prior. \n", + "\n", + "One might want to have interfaces to import liquidity information from crawls of the network or instead or use the live mainnet Lightning Network as an oracle" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "class OracleLightningNetwork(ChannelGraph):\n", + " \n", + " def __init__(self,channel_graph:ChannelGraph):\n", + " self._channel_graph = channel_graph\n", + " self._network = nx.MultiDiGraph()\n", + " for src,dest, short_channel_id, channel in channel_graph.network.edges(data=\"channel\", keys=True):\n", + " oracle_channel = None\n", + " \n", + " #If Channel in oposite direction already exists with liquidity information match the channel\n", + " if self._network.has_edge(dest,src):\n", + " if short_channel_id in self._network[dest][src]:\n", + " capacity = channel.capacity\n", + " opposite_channel = self._network[dest][src][short_channel_id][\"channel\"]\n", + " opposite_liquidity = opposite_channel.actual_liquidity\n", + " oracle_channel = OracleChannel(channel, capacity - opposite_liquidity)\n", + " \n", + " \n", + " if oracle_channel is None:\n", + " oracle_channel = OracleChannel(channel)\n", + " \n", + " self._network.add_edge(oracle_channel.src, \n", + " oracle_channel.dest, \n", + " key=short_channel_id, \n", + " channel=oracle_channel)\n", + " \n", + " @property\n", + " def network(self):\n", + " return self._network\n", + " \n", + " def send_onion(self,path,amt):\n", + " for channel in path:\n", + " oracle_channel = self.get_channel(channel.src, channel.dest, channel.short_channel_id)\n", + " success_of_probe = oracle_channel.can_forward(channel.in_flight+amt)\n", + " #print(channel,amt,success_of_probe)\n", + " channel.update_knowledge(amt,success_of_probe)\n", + " if success_of_probe == False:\n", + " return False, channel\n", + " return True, None\n", + " \n", + " def theoretical_maximum_payable_amount(self, source : str, destination : str, base_fee : int = DEFAULT_BASE_THRESHOLD):\n", + " \"\"\"\n", + " Uses the information from the oracle to compute the min-cut between source and destination\n", + " \n", + " This is only useful for experiments and simulations if one wants to know what would be \n", + " possible to actually send before starting the payment loop\n", + " \"\"\" \n", + " test_network = nx.DiGraph()\n", + " for src,dest,channel in self.network.edges(data=\"channel\"):\n", + " #liqudity = 0\n", + " #for channel in channels:\n", + " if channel.base_fee > base_fee:\n", + " continue\n", + " liquidity = self.get_channel(src,dest,channel.short_channel_id).actual_liquidity\n", + " if liquidity > 0:\n", + " if test_network.has_edge(src,dest):\n", + " test_network[src][dest][\"capacity\"]+=liquidity\n", + " else:\n", + " test_network.add_edge(src,\n", + " dest,\n", + " capacity = liquidity)\n", + " \n", + " mincut, _ = nx.minimum_cut(test_network, source, destination)\n", + " return mincut" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Uncertainty Channel Class\n", + "\n", + "The uncertainty channel is the core object for the uncertainty network and is where all the magic happens. Some API calls have been included even though we don't need them to precisely explain the theory and where everything is coming from. The reasoning for all the various costs and how to derive at the linearized integer unit costs is in the glossary. " + ] + }, + { + "cell_type": "code", + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ - "class Channel:\n", + "class UncertaintyChannel(Channel):\n", " \"\"\"\n", " The channel class contains basic information of a channel that will be used to create the\n", - " Uncertainty network.\n", + " UncertaintyNetwork.\n", " \n", " Since we optimize for reliability via a probability estimate for liquidity that is based\n", " on the capacity of the channel the class contains the `capacity` as seen in the funding tx output.\n", @@ -229,142 +605,259 @@ " Additionally we need to know how many sats we currently have allocated via outstanding onions\n", " to the channel which is stored in `inflight`.\n", " \n", - " the `key` field is necessary to map the channel to its corresponding arcs in the minc cost flow solver\n", - " \n", - " FIXME: the class does not contain min_htlc_size, channel_reserve or other meta data from gossip yet.\n", + " The most important API call is the `get_piecewise_linearized_costs` function that computes the\n", + " pieceweise linearized cost for a channel rising from uncertainty as well as routing fees.\n", " \"\"\"\n", - " def __init__(self,size,key,ppm,base):\n", - " self.__key=key\n", - " self.__ppm=ppm\n", - " self.__base=base\n", - " self.__capacity=size\n", - " self.__minLiquidity=0\n", - " self.__maxLiquidity=size\n", - " self.__inflight = 0\n", - " \n", - " def __str__(self):\n", - " return \"Size: {} with {:4.2f} bits of Entropy. Uncertainty Interval: [{},{}]\".format(self.__capacity, self.entropy(), self.__minLiquidity, self.__maxLiquidity)\n", - "\n", - " def get_key(self):\n", - " return self.__key\n", " \n", - " def get_capacity(self):\n", - " return self.__capacity\n", - " \n", - " def get_ppm(self):\n", - " return self.__ppm\n", + " TOTAL_NUMBER_OF_SATS = 21_000_000 * 100_000_000\n", + " MAX_CHANNEL_SIZE = 15_000_000_000 #150 BTC\n", + "\n", + " def __init__(self,cln_jsn):\n", + " super().__init__(cln_jsn)\n", + " self.forget_information()\n", " \n", - " def get_base(self):\n", - " return self.__base\n", + " def __init__(self, channel:Channel):\n", + " super().__init__(channel.cln_jsn)\n", + " self.forget_information()\n", " \n", - " def get_max_liquidity(self):\n", - " return self.__maxLiquidity\n", + " def __str__(self):\n", + " return \"Size: {} with {:4.2f} bits of Entropy. Uncertainty Interval: [{},{}] inflight: {}\".format(\n", + " self.capacity, \n", + " self.entropy(), \n", + " self.min_liquidity, \n", + " self.max_liquidity, \n", + " self.in_flight)\n", + "\n", + " @property\n", + " def max_liquidity(self):\n", + " return self._max_liquidity\n", + "\n", + " @property\n", + " def min_liquidity(self):\n", + " return self._min_liquidity\n", + "\n", + " @property\n", + " def in_flight(self):\n", + " return self._in_flight\n", + "\n", + " #FIXME: store timestamps when using setters so that we know when we learnt our belief\n", + " @min_liquidity.setter\n", + " def min_liquidity(self,value:int):\n", + " self._min_liquidity=value\n", + "\n", + " #FIXME: store timestamps when using setters so that we know when we learnt our belief\n", + " @max_liquidity.setter\n", + " def max_liquidity(self,value:int):\n", + " self._max_liquidity=value\n", + "\n", + " #FIXME: store timestamps when using setters so that we know when we learnt our belief\n", + " @in_flight.setter \n", + " def in_flight(self,value:int):\n", + " self._in_flight=value\n", + " \n", + " @property\n", + " def conditional_capacity(self,respect_inflight=True):\n", + " #FIXME: make sure if respect_inflight=True is needed for linearized cost\n", + " if respect_inflight == False:\n", + " return self.max_liquidity - self.min_liquidity\n", + " \n", + " min_liquidity = max(self.min_liquidity,self.in_flight)\n", + " return max(self.max_liquidity - min_liquidity,0)\n", "\n", - " def get_min_liquidity(self):\n", - " return self.__minLiquidity\n", - " \n", + " \n", + " def allocate_amount(self,amt:int):\n", + " \"\"\"\n", + " assign or remove ammount that is assigned to be `in_flight`.\n", + " \"\"\"\n", + " self.in_flight += amt\n", + " if self.in_flight < 0:\n", + " raise Exception(\"Can't remove in flight HTLC of amt {} current inflight: {}\".format(-amt,self._in_flight-amt))\n", + "\n", + " #FIXME: store timestamps when using setters so that we know when we learnt our belief\n", " def forget_information(self):\n", " \"\"\"\n", " resets the information that we belief to have about the channel. \n", " \"\"\"\n", - " self.__minLiquidity=0\n", - " self.__maxLiquidity=self.__capacity\n", - " self.__inflight = 0\n", - " \n", - " def set_min_liquidity(self,value):\n", - " self.__minLiquidity=value\n", - " \n", - " def set_max_liquidity(self,value):\n", - " self.__maxLiquidity=value\n", + " self.min_liquidity=0\n", + " self.max_liquidity=self.capacity\n", + " #FIXME: Is there a case where we want to keep inflight information but reset information?\n", + " self.in_flight = 0\n", "\n", - " def allocate_amount(self,amt):\n", - " self.__inflight += amt\n", - " return\n", " \n", " def entropy(self):\n", " \"\"\"\n", " returns the uncertainty that we have about the channel\n", - " \n", - " FIXME: Do we have to respect inflight information? I assume no.\n", + "\n", + " this respects our belief about the channel's liquidity and thus is just the log\n", + " of the conditional capacity.\n", + "\n", + " FIXME: This respects inflight information? I assume it shouldn't.\n", " \"\"\"\n", - " return log(self.__maxLiquidity - self.__minLiquidity + 1)\n", + " return log(self.conditional_capacity + 1)\n", " \n", - " def success_probability(self,amt):\n", + " def success_probability(self,amt:int = None):\n", " \"\"\"\n", " returns the estimated success probability for a payment based on our belief about the channel using a uniform distribution.\n", - "\n", + " \n", + " While this is the core of the theory it is only used for evaluation and not for the\n", + " actual min cost flow computation as we linearize this to an integer unit cost\n", + " \n", " In particular the conditional probability P(X>=a | min_liquidity < X < max_liquidity)\n", " is computed based on our belief also respecting how many satoshis we have currently \n", - " outstanding and allocated.\n", + " outstanding and allocated. Thus it is possible that testing for the `amt=0` that the success probability\n", + " is zero and in particular not `1`.\n", + " \n", + " It also accounts for the number of satoshis we have already outstanding but have not received information about\n", " \n", " FIXME: Potentially test other prior distributions like mixedmodels where most funds are on one side of the channel\n", " \"\"\"\n", - " tested_liquidity = amt + self.__inflight\n", - "\n", - " if tested_liquidity <= self.__minLiquidity:\n", + " if amt is None:\n", + " amt = 0\n", + " tested_liquidity = amt + self.in_flight\n", + " if tested_liquidity <= self.min_liquidity:\n", " return 1.0\n", - " elif amt >= self.__maxLiquidity:\n", - " return 0\n", + " elif tested_liquidity >= self.max_liquidity:\n", + " return 0.\n", " else: \n", - " conditional_amount = tested_liquidity - self.__minLiquidity\n", - " conditional_capacity = self.__maxLiquidity - self.__minLiquidity\n", + " conditional_amount = tested_liquidity - self.min_liquidity\n", + " #TODO: can't use self.condition_capacity as that respects inflight htlcs\n", + " conditional_capacity= self.max_liquidity - self.min_liquidity\n", + " if conditional_amount > conditional_capacity:\n", + " return 0.\n", " return float(conditional_capacity + 1 - conditional_amount)/ (conditional_capacity + 1)\n", " \n", + " def uncertainty_cost(self,amt:int):\n", + " \"\"\"\n", + " Returns the uncertainty cost associated to sending the amount `amt` respecting our current belief\n", + " about the channel's liquidity and the in_flight HTLC's that we have allocated and outstanding.\n", + " \"\"\"\n", + " return -log(self.success_probability(amt))\n", + "\n", + " def linearized_uncertainty_cost(self,amt:int):\n", + " \"\"\"\n", + " the linearized uncertainty cost is just amt/(capacity+1). Using this is most likely not what\n", + " one wants as this tends to saturate channels. The API is included to explain the theory.\n", " \n", + " Warning: This API does not respect our belief about the channels liquidity or allocated in_flight HTLCs\n", " \"\"\"\n", - " This is how it would be computed without respecting in_flight information \n", + " #TODO: Maybe change to `return amt*self.linlinearized_integer_uncertainty_unit_cost()`\n", + " return float(amt)/(self.capacity+1)\n", + " \n", + " def linearized_integer_uncertainty_unit_cost(self,use_conditional_capacity=True):\n", + " \"\"\"\n", + " estimates the linearized integer uncertainty cost\n", " \n", - " if amt <= self.__minLiquidity:\n", - " return 1.0\n", - " elif amt >= self.__maxLiquidity:\n", - " return 0\n", + " FIXME: Instead of using the maximum capacity on the network it just assumes 150BTC to be max\n", + " \"\"\"\n", + " #FIXME: interesting! Quantization does not change unit cost as it cancles itself\n", + " #FIXME: use max satoshis available and control for quantization (makes mu depend on quantization....)\n", + " if use_conditional_capacity:\n", + " #FIXME: better choice of magic number but TOTAL_NUMBER_OF_SATS breaks solver\n", + " return int(self.MAX_CHANNEL_SIZE/self.conditional_capacity)\n", + " #return int(self.TOTAL_NUMBER_OF_SATS/self.capacity)\n", " else:\n", - " \n", - " effective_amount = amt - self.__minLiquidity\n", - " effective_capacity = self.__maxLiquidity - self.__minLiquidity\n", - " return float(effective_capacity+1 - effective_amount)/ (effective_capacity+1)\n", - " \"\"\"\n" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "class OracleChannel(Channel):\n", - " \"\"\"\n", - " The Oracle channel inherits from the channel and is used for our simulation to act as the Oracle\n", + " return int(self.MAX_CHANNEL_SIZE/self.capacity)\n", + " #return int(self.TOTAL_NUMBER_OF_SATS/self.conditional_capacity)\n", + " \n", " \n", - " The Oracle channel has assigned liquidity information about a payment channel and can be tested \n", - " against. Note that on mainnet the actual channels act as oracles as one tests them by sending out\n", - " onions. For the simulation we just create ourselves an `known_liquidity_network` as an oracle.\n", - " (Note in the optimally reliable payment flows paper we still called this the known balance graph\n", - " however we retracted from using the term balance.)\n", + " def routing_cost_msat(self,amt:int):\n", + " \"\"\"\n", + " Routing cost a routing node will earn to forward a payment along this channel in msats\n", + " \"\"\"\n", + " return int(self.ppm*amt/1000) + self.base_fee\n", + " \n", + " def linearized_routing_cost_msat(self,amt:int):\n", + " \"\"\"\n", + " Linearizing the routing cost by ignoring the base fee.\n", + " \n", + " Note that one can still include channels with small base fees to the computation the base \n", + " will just be excluded in the computation and has to be paid later anyway. If as developers\n", + " we go down this road this will allow routing node operators to game us with the base fee\n", + " thus it seems reasonable in routing computations to just ignore channels that charge a base fee.\n", + " \n", + " There are other ways of achieving this by overestimating the fee as ZmnSCPxj suggested at:\n", + " https://lists.linuxfoundation.org/pipermail/lightning-dev/2021-August/003206.html\n", + " \"\"\"\n", + " return int(self.ppm*amt/1000.)\n", + " \n", + " def linearized_integer_routing_unit_cost(self):\n", + " \"Note that the ppm is natively an integer and can just be taken as a unit cost for the solver\"\n", + " return int(self.ppm)\n", " \n", + " def combined_linearized_unit_cost(self,mu :int =DEFAULT_MU):#FIXME: better default mu\n", + " \"\"\"\n", + " Builds the weighted sum between our two unit costs.\n", + " \n", + " Not being used in the code. Just here to describe the theory.\n", + " \"\"\"\n", + " return self.linearized_integer_uncertainty_unit_cost() + mu * self.linearized_integer_routing_unit_cost()\n", + " \n", + " def get_piecewise_linearized_costs(self,number_of_pieces : int = DEFAULT_N,\n", + " mu : int = DEFAULT_MU):\n", + " \"\"\"\n", + " \n", + " \"\"\"\n", + " #FIXME: compute smarter linearization eg: http://www.iaeng.org/publication/WCECS2008/WCECS2008_pp1191-1194.pdf\n", + " pieces = []*number_of_pieces\n", + "\n", + " #using certainly available liquidity costs us nothing but fees\n", + " if int(self.min_liquidity-self.in_flight) > 0:\n", + " uncertintay_unit_cost = 0 #is zero as we have no uncertainty in this case!\n", + " pieces.append((int(self.min_liquidity-self.in_flight),uncertintay_unit_cost + mu * self.linearized_integer_routing_unit_cost()))\n", + " number_of_pieces-=1\n", + "\n", + " # FIXME: include the in_flight stuff\n", + " if int(self.conditional_capacity) > 0 and number_of_pieces > 0:\n", + " arc_capacity = int(self.conditional_capacity/number_of_pieces)\n", + " uncertintay_unit_cost = self.linearized_integer_uncertainty_unit_cost()\n", + " for i in range(number_of_pieces):\n", + " pieces.append((arc_capacity,(i+1)*uncertintay_unit_cost + mu * self.linearized_integer_routing_unit_cost()))\n", + " return pieces\n", " \n", " \"\"\"\n", - " def __init__(self,size,key,ppm,base,actual_liquidity=None):\n", - " super().__init__(size,key,ppm,base)\n", - " self.__actual_liquidity=actual_liquidity\n", - " if actual_liquidity is None or actual_liquidity >= size or actual_liquidity < 0:\n", - " self.__actual_liquidity = random.randint(0,size)\n", - " def __str__(self):\n", - " return super().__str__()+\" actual Liquidity: {}\".format(self.__actual_liquidity)\n", + " #FIXME: interestingly the following feature engineering does not work at all\n", " \n", - " def update_knowledge(self,amt):\n", + " TODO: Look at more standard Univariate Transformations on Numerical Data techniques as described at \n", + " https://www.kaggle.com/code/milankalkenings/comprehensive-tutorial-feature-engineering/notebook\n", + " \n", + " def get_piecewise_linearized_costs(self,number_of_pieces : int = DEFAULT_N,\n", + " mu : int = DEFAULT_MU,\n", + " quantization : int = DEFAULT_QUANTIZATION):\n", + " #FIXME: compute smarter linearization eg: http://www.iaeng.org/publication/WCECS2008/WCECS2008_pp1191-1194.pdf\n", + " pieces = []*number_of_pieces\n", + "\n", + " #using certainly available liquidity costs us nothing but fees\n", + " if int((self.min_liquidity-self.in_flight)/quantization) > 0:\n", + " uncertintay_unit_cost = 0 #is zero as we have no uncertainty in this case!\n", + " pieces.append((int((self.min_liquidity-self.in_flight)/quantization),uncertintay_unit_cost + mu * self.linearized_integer_routing_unit_cost()))\n", + " number_of_pieces-=1\n", + "\n", + " # FIXME: include the in_flight stuff\n", + " if int(self.conditional_capacity/quantization) > 0 and number_of_pieces > 0:\n", + " capacity = int(self.conditional_capacity/(number_of_pieces*quantization))\n", + " uncertintay_unit_cost = self.linearized_integer_uncertainty_unit_cost()\n", + " for i in range(number_of_pieces):\n", + " a = (i+1)*uncertintay_unit_cost+1\n", + " b = self.linearized_integer_routing_unit_cost()+1\n", + " pieces.append((capacity, int(a*b/(a+mu*b)) ))\n", + " return pieces\n", + " \"\"\"\n", + "\n", + " def update_knowledge(self,amt:int,success_of_probe):\n", " \"\"\"\n", " updates our knowledge about the channel if we tried to probe it for amount `amt`\n", + " \n", + " This API works ony if we have an Oracle that allows to ask the actual liquidity of a channel\n", + " In mainnet Lightning our oracle will not work on a per_channel level. This will change the data\n", + " flow. Here for simplicity of the simulation we make use of the Oracle on a per channel level\n", " \"\"\"\n", - " if amt <= self.__actual_liquidity:\n", - " self.set_min_liquidity(max(self.get_min_liquidity(),amt))\n", - " return True\n", + " if success_of_probe:\n", + " self.min_liquidity = max(self.min_liquidity,self.in_flight+amt)\n", " else:\n", - " self.set_max_liquidity(min(self.get_max_liquidity(), amt))\n", - " return False\n", + " self.max_liquidity = min(self.max_liquidity, self.in_flight+amt)\n", " \n", " #needed for BOLT14 test experiment\n", - " def learn_n_bits(self,n):\n", + " def learn_n_bits(self,oracle: OracleLightningNetwork, n : int = 1):\n", " \"\"\"\n", " conducts n probes of channel via binary search starting from our belief\n", " \n", @@ -373,273 +866,99 @@ " \"\"\"\n", " if n <= 0:\n", " return\n", - " amt = self.get_min_liquidity() + int((self.get_max_liquidity() - self.get_min_liquidity())/2)\n", - " self.update_knowledge(amt)\n", - " self.learn_n_bits(n-1)\n", - " \n", - " def get_actual_liquidity(self):\n", - " \"\"\"\n", - " Tells us the actual liquidity according to the oracle. \n", - " \n", - " This is usful for experiments but must of course not be used in routing and is also\n", - " not a vailable if mainnet remote channels are being used.\n", - " \"\"\"\n", - " return self.__actual_liquidity" + " amt = self.min_liquidity + int((self.max_liquidity - self.min_liquidity)/2)\n", + " oracle_channel = oracle.get_channel(self.src, self.dest, self.short_channel_id)\n", + " success_of_probing = oracle_channel.can_forward(amt)\n", + " self.update_knowledge(amt, success_of_probing)\n", + " self.learn_n_bits(oracle,n-1)\n", + " \n" ] }, { - "cell_type": "code", - "execution_count": 5, + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "class Oracle:\n", - " def __init__(self,):\n", - " return \n", + "# Uncertainty Network\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "class UncertaintyNetwork(ChannelGraph): \n", + " \"\"\"\n", + " The UncertaintayNetwork is the main data structure to store our belief about the \n", + " Liquidity in the channels of the ChannelGraph.\n", " \n", - " def get_max_cap(self):\n", - " \"\"\"\n", - " returns the maximum capacity on the channel graph\n", - " \n", - " This is necessary to produce integer costs for the linearized uncertainty cost\n", - " \"\"\"\n", - " return self.__max_cap\n", + " Most of its functionality comes from the UncertaintyChannel. Most notably the ability\n", + " to assign a linearized integer uncertainty unit cost to its channels and do this even\n", + " piecewise.\n", " \n", - " def reset_uncertainty_network(self):\n", + " Paths cannot be probed against the UncertaintyNetwork as it lacks an Oracle\n", + " \"\"\"\n", + " def __init__(self,channel_graph:ChannelGraph, base_threshold : int = DEFAULT_BASE_THRESHOLD):\n", + " self._channel_graph = nx.MultiDiGraph()\n", + " for src,dest, keys, channel in channel_graph.network.edges(data=\"channel\", keys=True):\n", + " oracle_channel = UncertaintyChannel(channel)\n", + " if channel.base_fee <= base_threshold:\n", + " self._channel_graph.add_edge(oracle_channel.src, \n", + " oracle_channel.dest, \n", + " key=oracle_channel.short_channel_id, \n", + " channel=oracle_channel)\n", + "\n", + " @property\n", + " def network(self):\n", + " return self._channel_graph\n", + " \n", + " def entropy(self):\n", " \"\"\"\n", - " Forgets all learnt information on the uncertainty network. \n", - " \n", - " This is usful to resuse the same data from the oracle between various experiments\n", + " computes to total uncertainty in the network summing the entropy of all channels\n", " \"\"\"\n", - " for key in self.__arcs.keys():\n", - " self.__arcs[key].forget_information()\n", + " return sum(channel.entropy() for src,dest, channel in self.network.edges(data = \"channel\"))\n", " \n", - " def __get_channel_json(self,fp):\n", - " #$ lightning-cli listchannels > listchannels20211028.json\n", - " f = open(fp)\n", - " return json.load(f)[\"channels\"]\n", " \n", - " def __prepare_integer_indices_for_nodes(self,channels):\n", - " \"\"\"\n", - " necessary for the OR-lib by google and the min cost flow solver\n", + " def get_features_of_candidate_path(self,path: List[UncertaintyChannel], amt: int) -> (float, float):\n", " \"\"\"\n", - " # let's first find all node_ids \n", - " # so that we can build the look up table and use integer unit costs\n", - "\n", - " node_ids = set()\n", - " for c in channels:\n", - " src = c[\"source\"]\n", - " dest = c[\"destination\"]\n", - " node_ids.add(src)\n", - " node_ids.add(dest) \n", - "\n", - " # let's initialize the look up tables for node_ids to integers from [0,...,#number of nodes]\n", - " # this is necessary because of the API of the Google Operations Research min cost flow solver\n", - " self.__node_key_to_id = {}\n", - " self.__id_to_node_key = {}\n", - " for k, node_id in enumerate(node_ids):\n", - " self.__node_key_to_id[node_id]=k\n", - " self.__id_to_node_key[k]=node_id\n", - " \n", - " def import_channels(self,fp):\n", + " returns the routing fees and probability of a candidate path\n", " \"\"\"\n", - " This function does all the magic! \n", - " \n", - " It starts by importing the channel_graph from c-lightning listchannels command and then \n", - " it goes through the channels to find all node ids and max capacity (to make integer uncertainty cost)\n", - " in a second pass it goes over all channels and adds arcs to the modelled linearized network\n", - " for each channel N arcs are being added with increasing unit costs to mimic the convex behavior\n", - " the piecewise dissection is not optimal nor is the linear approximation of negative log probs exact\n", - " however this does not matter for the sake of argument the runtime will not change if the costs\n", - " are chosen a bit more optimally. But the code will blow up thus those simplifications\n", - " \"\"\"\n", - "\n", - " channels = self.__get_channel_json(fp)\n", - " self.__prepare_integer_indices_for_nodes(channels)\n", - "\n", - " self.__max_cap = 0\n", - " for c in channels:\n", - " cap = c[\"satoshis\"]\n", - " if cap > self.__max_cap:\n", - " self.__max_cap = cap\n", - "\n", - " self.__arcs = {}\n", - " self.__parallel = {}\n", - " for c in channels:\n", - " cap = c[\"satoshis\"]\n", - " sid = c[\"short_channel_id\"]\n", - "\n", - " src = self.__node_key_to_id[c[\"source\"]]\n", - " dest = self.__node_key_to_id[c[\"destination\"]]\n", - " cap = c[\"satoshis\"]\n", - "\n", - " key = \"{}x{}x{}\".format(src,dest,sid)\n", - " base = c[\"base_fee_millisatoshi\"]\n", - " ppm = c[\"fee_per_millionth\"]\n", - " self.__arcs[key]=OracleChannel(cap,key,ppm,base)\n", - " arc = \"{}x{}\".format(src,dest)\n", - " if arc in self.__parallel:\n", - " self.__parallel[arc].append(key)\n", - " else:\n", - " self.__parallel[arc] = [key]\n", - "\n", + " probability = 1\n", + " routing_fees = 0\n", + " for channel in path:\n", + " routing_fees += channel.routing_cost_msat(amt)\n", + " probability *= channel.success_probability(amt)\n", + " return routing_fees, probability\n", "\n", - " def arcs_to_networkx(self,base_threshold = None):\n", + " def allocate_amount_on_path(self,path: List[UncertaintyChannel], amt: int):\n", " \"\"\"\n", - " stores the arcs also in networkx for fee computation and display of probabilities\n", - " \n", - " FIXME: it should actually be the other way around. First store the channel graph in \n", - " networkx and then compute the piece wise linearized arcs from this\n", - " \"\"\"\n", - " self.__channel_graph = nx.MultiDiGraph()\n", - " for channel in self.__arcs.values():\n", - " src, dest, height, index, out = channel.get_key().split(\"x\")\n", - " if base_threshold is not None:\n", - " if channel.get_base() > base_threshold:\n", - " continue\n", - " self.__channel_graph.add_edge(int(src),int(dest),capacity=channel.get_capacity(),base=channel.get_base(),ppm=channel.get_ppm())\n", - " \n", + " allocates `amt` to all channels of the path of `UncertaintyChannels`\n", + " \"\"\"\n", + " for channel in path:\n", + " channel.allocate_amount(amt) \n", "\n", - " \n", - " def theoretical_maximum_payable_amount(self, source, destination):\n", + " def reset_uncertainty_network(self):\n", " \"\"\"\n", - " Uses the information from the oracle to compute the min-cut between source and destination\n", - " \n", - " This is only useful for experiments and simulations if one wants to know what would be \n", - " possible to actually send before starting the payment loop\n", + " resets our belief about the liquidity & inflight information of all channels on the UncertaintyNetwork\n", " \"\"\"\n", - " self.__channel_graph = nx.MultiDiGraph()\n", - " for channel in self.__arcs.values():\n", - " src, dest, height, index, out = channel.get_key().split(\"x\")\n", - " if base_threshold is not None:\n", - " if channel.get_base() > base_threshold:\n", - " continue\n", - " self.__channel_graph.add_edge(int(src),int(dest),capacity=channel.get_actual_liquidity(),base=channel.get_base(),ppm=channel.get_ppm())\n", - " \n", - " self.__G = nx.DiGraph()\n", - " for u,v,data in self.__channel_graph.edges(data=True):\n", - " if not self.__G.has_edge(u,v):\n", - " capacity = sum(d.get('capacity') for d in self.__channel_graph.get_edge_data(u,v).values())\n", - " self.__G.add_edge(u, v, capacity=capacity)\n", - " \n", - " mincut, _ = nx.minimum_cut(self.__G, self.__node_key_to_id[source], self.__node_key_to_id[destination])\n", - " return mincut\n", + " for src,dest, channel in self.network.edges(data = \"channel\"):\n", + " channel.forget_information()\n", " \n", - " def get_probability(self,src,dest,amt):\n", - " #FIXME: handle multi edges properly\n", - " #if not self.__channel_graph.has_edge(src,dest):\n", - " capacity = sum(d.get('capacity') for d in self.__channel_graph.get_edge_data(src,dest).values())\n", - " #else:\n", - " # capacity = self.__channel_graph[src][dest][\"capacity\"]\n", - " if amt > capacity:\n", - " print(src,dest,self.__channel_graph.get_edge_data(src,dest))\n", - " return float(capacity+1-amt)/(capacity+1)\n", - "\n", - " \n", - " def get_fees_msat(self,src,dest,amt):\n", - " #FIXME: handle multi edges properly\n", - " ppm = min(d.get('ppm') for d in self.__channel_graph.get_edge_data(src,dest).values())\n", - " base = min(d.get('base') for d in self.__channel_graph.get_edge_data(src,dest).values())\n", - " return int(base + float(amt * ppm)/1000) \n", - " \n", - " def test_path(self,path,amt):\n", - " probability = 1\n", - " fees = 0\n", - " success = True\n", - " for src,dest in next_hop(path):\n", - " fees += self.get_fees_msat(src,dest,amt)\n", - " probability *= self.get_probability(src,dest,amt)\n", - " key = \"{}x{}\".format(src,dest)\n", - " #FIXME: do not just take the first parallel channel\n", - " arc_key = self.__parallel[key][0]\n", - " if success:\n", - " success = self.__arcs[arc_key].update_knowledge(amt)\n", - " \n", - " return success, fees, probability\n", - " \n", - " def allocate_path(self,path,amt):\n", - " t,_,_ = self.test_path(path,amt)\n", - " if t == False:\n", - " return False\n", - " for src,dest in next_hop(path):\n", - " key = \"{}x{}\".format(src,dest)\n", - " #FIXME: do not just take the first parallel channel\n", - " arc_key = self.__parallel[key][0]\n", - " if success:\n", - " success = self.__arcs[arc_key].allocate_amount(amt)\n", - " \n", + " def activate_network_wide_uncertainty_reduction(self,n,oracle:OracleLightningNetwork):\n", + " \"\"\"\n", + " With the help of an `OracleLightningNetwork` probes all chennels `n` times to reduce uncertainty.\n", " \n", - " def get_arcs(self):\n", - " return self.__arcs\n", - " \n", - " def look_up_id(self,node_id):\n", - " return self.__node_key_to_id[node_id]\n", - " \n", - " def get_uncertainty_network(self,start_node,mu,threshold_base =None):\n", - " #FIXME: find mu\n", - " start_node = self.__node_key_to_id[start_node]\n", - "\n", - " max_cap = oracle.get_max_cap()\n", - " used_arcs = []\n", - " for key, channel in self.__arcs.items():\n", - " base = channel.get_base()\n", - " if threshold_base is not None:\n", - " if base > threshold_base:\n", - " continue\n", - "\n", - " cap = channel.get_capacity()\n", - " src,dest,_,_,_ = channel.get_key().split(\"x\")\n", - " src = int(src)\n", - " dest = int(dest)\n", - "\n", - " is_own_channel = False\n", - " if src == start_node:\n", - " is_own_channel=True\n", - " \n", - " #FIXME: might need a fix if we account for HTLCs in flight but I guess this is just reduced from actual liqudity\n", - " if is_own_channel: #we know exactly how much liquidity we have in our channels\n", - " channel.set_min_liquidity(channel.get_actual_liquidity())\n", - " channel.set_min_liquidity(channel.get_actual_liquidity())\n", - "\n", - " conditional_capacity = channel.get_max_liquidity() - channel.get_min_liquidity()\n", - " min_liquidity = channel.get_min_liquidity()\n", - " ppm = channel.get_ppm()\n", - " \n", - " if is_own_channel: #we don't have to pay ppm on our own channels\n", - " ppm = 0\n", - " \n", - " n = N\n", - " \n", - " #FIXME: prune expensive and unlikeli channels\n", - " #FIXME: compute smarter linearization eg: http://www.iaeng.org/publication/WCECS2008/WCECS2008_pp1191-1194.pdf \n", - " #using certainly available liquidity costs us nothing but fees\n", - " if int(min_liquidity/QUANTIZATION) > 0:\n", - " used_arcs.append((src,dest,int(min_liquidity/QUANTIZATION),0 + mu*ppm))\n", - " n-=1\n", - "\n", - " # FIXME: include the \n", - " if int(conditional_capacity/QUANTIZATION) > 0:\n", - " unit_cost = int(max_cap/conditional_capacity)\n", - " for i in range(n):\n", - " #arc format is src, dest, capacity, unit_cost\n", - " # THIS IS THE IMPORTANT LINE OF CODE WHERE THE MAGIC HAPPENS\n", - " used_arcs.append((src,dest,int(conditional_capacity/(N*QUANTIZATION)),(i+1)*unit_cost +mu* ppm))\n", - " return used_arcs\n", - " \n", - " ##############################################################\n", - " #\n", - " # needed for FOAF liquidity sharing (BOLT 14 proposal) \n", - " #\n", - " ##############################################################\n", - "\n", - " def entropy(self):\n", - " return sum(arc.entropy() for _,arc in self.__arcs.items())\n", - " \n", - " \n", - " def activate_network_wide_uncertainty_reduction(self,n):\n", - " for arc in self.__arcs.values():\n", - " arc.learn_n_bits(n)\n", + " While one can do this on mainnet by probing we can do this very quickly in simulation\n", + " at virtually no cost. Thus this API call needs to be taken with caution when using a different\n", + " oracle. \n", + " \"\"\"\n", + " for src,dest, channel in self.network.edges(data = \"channel\"):\n", + " channel.learn_n_bits(oracle,n)\n", " \n", + " #FIXME: refactor to new code base. The following call will break!\n", " def activate_foaf_uncertainty_reduction(self,src,dest):\n", " ego_netwok=set()\n", " foaf_network = set()\n", @@ -692,224 +1011,396 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Define some helper functions to prepare experiments" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [], - "source": [ - "def prepare_mcf_solver(src, dest,amt, mu=0, base=0):\n", - " \"\"\"\n", - " computes the uncertainty network given our prior belief and prepares the min cost flow solver\n", - " \n", - " This function can define a value for \\mu to control how heavily we combine the uncertainty cost and fees\n", - " Also the function supports only taking channels into account that don't charge a base_fee higher or equal to `base`\n", + "# Payment Session\n", "\n", - " returns the instantiated min_cost_flow object from the google OR-lib that contains the piecewise linearized problem\n", - " \"\"\"\n", - " used_arcs = oracle.get_uncertainty_network(src,mu,base)\n", - " oracle.arcs_to_networkx(base)\n", - " min_cost_flow = pywrapgraph.SimpleMinCostFlow()\n", - "\n", - " # Add each of the prepared arcs from import_channels().\n", - " node_ids = set()\n", - " for arc in used_arcs:\n", - " node_ids.add(arc[0])\n", - " node_ids.add(arc[1])\n", - " min_cost_flow.AddArcWithCapacityAndUnitCost(arc[0], arc[1], arc[2],\n", - " arc[3])\n", - "\n", - " # Add node supply to 0 for all nodes\n", - " for i in node_ids:\n", - " min_cost_flow.SetNodeSupply(i, 0)\n", - "\n", - " #add amount to sending node\n", - " min_cost_flow.SetNodeSupply(oracle.look_up_id(src),int(amt/QUANTIZATION))\n", - "\n", - " #add -amount to recipient nods\n", - " min_cost_flow.SetNodeSupply(oracle.look_up_id(dest),-int(amt/QUANTIZATION))\n", - " return min_cost_flow\n", - "\n" + "Payments are conducted within a payment session. The payment session needs to be given an instance from the` UncertaintyNetwork` and an `Oracle` against which it will `send_onions`. In this notebook the `Oracel` is just a simulated distribution of the Liquidity in the network. For experiments we could distribute the liquidity differently or we could use the mainnet network or a crawl as the oracle. In particular the `UncertaintyNetwork` may contain prior belief about the uncertainty of the liquidity in remote channels.\n", + "\n", + "The main API call in a payment session is `pickhardt_pay` which is a `pay`-implementation of our method. Internally `pickhardt_pay` feeds the min cost solver with `pieceweise linearized integer unit costs` for all channels of the uncertainty network that are not to be pruned. The pruning is currently pretty arbitrary and exists to show that another order of magnitude in compuational time seems possible without loosing much optimality but shall be chosen better for future extensability. (I assume with proper feature engineering one may prune based on unit costs).\n", + "The min cost flow solver produces a flow that is disected into candidate path. instead of just invoking `send_onion` and makting payment attempts the `pickhardt_pay` loop here collects our belief about success probabilities and fees so that we can investigate the results of the simulation. These results are also depicted as part of the API call. " ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 34, "metadata": {}, "outputs": [], "source": [ - "def disect_flow_to_paths(min_cost_flow,s,d):\n", + "class PaymentSession():\n", " \"\"\"\n", - " A standard algorithm to disect a flow into several paths.\n", + " A PaymentSesssion is used to create the min cost flow problem from the UncertaintyNetwork\n", " \n", - " FIXME: Note that this disection while accurate is probably not optimal in practise. \n", - " As noted in our Probabilistic payment delivery paper the payment process is a bernoulli trial \n", - " and I assume it makes sense to disect the flow into paths of similar likelihood to make most\n", - " progress but this is a mere conjecture at this point. I expect quite a bit of research will be\n", - " necessary to resolve this issue.\n", - " \"\"\"\n", - " total_flow = {}\n", - "\n", - " #first collect all linearized edges which are assigned a non zero flow\n", - " for i in range(min_cost_flow.NumArcs()):\n", - " if min_cost_flow.Flow(i) == 0:\n", - " continue\n", - " src = min_cost_flow.Tail(i)\n", - " dest = min_cost_flow.Head(i)\n", - " flow = min_cost_flow.Flow(i)*QUANTIZATION\n", - "\n", - " key = str(src)+\":\"+str(dest)\n", - " if key in total_flow:\n", - " total_flow[key]=(src,dest,total_flow[key][2]+flow)\n", - " else:\n", - " total_flow[key]=(src,dest,flow)\n", + " This happens by adding several parallel arcs coming from the piece wise linearization of the\n", + " UncertaintyChannel to the min_cost_flow object. \n", " \n", - " \n", - " G = nx.DiGraph()\n", - " for key, val in total_flow.items():\n", - " src, dest, flow = val\n", - " G.add_edge(src,dest,weight=flow)\n", - "\n", - " m = 1\n", - " paths = []\n", - " while m>0:\n", - " try: \n", - " path = nx.shortest_path(G,s,d)\n", - " m = min(G[src][dest][\"weight\"] for src, dest in next_hop(path))\n", - " #t+=m\n", - " #print(\"{} sats along {}\".format(m*10000,path_str(path)))\n", - " paths.append((path,m))\n", - " for src,dest in next_hop(path):\n", - " G[src][dest][\"weight\"]-=m\n", - " if G[src][dest][\"weight\"]==0:\n", - " G.remove_edge(src,dest)\n", - " except: \n", - " break\n", - " return paths\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": { - "scrolled": false - }, - "outputs": [], - "source": [ - "def make_attempt(src, dest, amt,mu,base):\n", + " The main API call ist `pickhardt_pay` which invokes a sequential loop to conduct trial and error\n", + " attmpts. The loop could easily send out all onions concurrently but this does not make sense \n", + " against the simulated OracleLightningNetwork. \n", " \"\"\"\n", - " computes the optimal payment split to deliver `amt` from `src` to `dest` and updates our belief about the liquidity\n", - " \n", - " This is one step within the payment loop.\n", - " \n", - " Retuns the residual amount of the `amt` that could ne be delivered and the paid fees\n", - " (on a per channel base not including fees for downstream fees) for the delivered amount\n", + " \n", + " def __init__(self, \n", + " oracle : OracleLightningNetwork, \n", + " uncertainty_network: UncertaintyNetwork,\n", + " prune_network : bool =True):\n", + " self._oracle = oracle\n", + " self._uncertainty_network = uncertainty_network\n", + " self._prune_network=prune_network\n", + " self._prepare_integer_indices_for_nodes()\n", + " \n", + " def _prepare_integer_indices_for_nodes(self):\n", + " \"\"\"\n", + " necessary for the OR-lib by google and the min cost flow solver\n", + " \n", + "\n", + " let's initialize the look up tables for node_ids to integers from [0,...,#number of nodes]\n", + " this is necessary because of the API of the Google Operations Research min cost flow solver\n", + " \"\"\"\n", + " self._mcf_id = {}\n", + " self._node_key = {}\n", + " for k, node_id in enumerate(self._uncertainty_network.network.nodes()):\n", + " self._mcf_id[node_id]=k\n", + " self._node_key[k]=node_id\n", + "\n", " \n", - " the function also prints some results an statistics about the paths of the flow to stdout.\n", - " \"\"\"\n", - " start = time.time()\n", + " def _prepare_mcf_solver(self, src, dest,amt :int=1, mu : int =100_000_000, base_fee : int =DEFAULT_BASE_THRESHOLD):\n", + " \"\"\"\n", + " computes the uncertainty network given our prior belief and prepares the min cost flow solver\n", + "\n", + " This function can define a value for \\mu to control how heavily we combine the uncertainty cost and fees\n", + " Also the function supports only taking channels into account that don't charge a base_fee higher or equal to `base`\n", + "\n", + " returns the instantiated min_cost_flow object from the google OR-lib that contains the piecewise linearized problem\n", + " \"\"\"\n", + " self._min_cost_flow = pywrapgraph.SimpleMinCostFlow()\n", + " self._arc_to_channel = {}\n", + " \n", + " for s, d, channel in self._uncertainty_network.network.edges(data=\"channel\"):\n", + " #ignore channels with too large base fee\n", + " if channel.base_fee > base_fee:\n", + " continue\n", + " #FIXME: Remove Magic Number for pruning\n", + " # Prune channels away thay have too low success probability! This is a huge runtime boost\n", + " # However the pruning would be much better to work on quantiles of normalized cost\n", + " # So as soon as we have better Scaling, Centralization and feature engineering we can \n", + " # probably have a more focused pruning\n", + " if self._prune_network and channel.success_probability(250_000)<0.9:\n", + " continue\n", + " cnt = 0\n", + " for capacity, cost in channel.get_piecewise_linearized_costs(mu=mu): #QUANTIZATION):\n", + " index = self._min_cost_flow.AddArcWithCapacityAndUnitCost(self._mcf_id[s], \n", + " self._mcf_id[d], \n", + " capacity,\n", + " cost)\n", + " self._arc_to_channel[index]=(s,d,channel,0)\n", + " if self._prune_network and cnt>1:\n", + " break\n", + " cnt+=1\n", + "\n", + " # Add node supply to 0 for all nodes\n", + " for i in self._uncertainty_network.network.nodes():\n", + " self._min_cost_flow.SetNodeSupply(self._mcf_id[i], 0)\n", + "\n", + " #add amount to sending node\n", + " self._min_cost_flow.SetNodeSupply(self._mcf_id[src],int(amt))#/QUANTIZATION))\n", + "\n", + " #add -amount to recipient nods\n", + " self._min_cost_flow.SetNodeSupply(self._mcf_id[dest],-int(amt))#/QUANTIZATION))\n", + "\n", + " def _next_hop(self,path):\n", + " \"\"\"\n", + " generator to iterate through edges indext by node id of paths\n", + "\n", + " The path is a list of node ids. Each call returns a tuple src, dest of an edge in the path \n", + " \"\"\"\n", + " for i in range(1,len(path)):\n", + " src = path[i-1]\n", + " dest = path[i]\n", + " yield (src,dest)\n", + " \n", + " def _make_channel_path(self,G :nx.MultiDiGraph, path: List[str]):\n", + " \"\"\"\n", + " network x returns a path as a list of node_ids. However we need a list of `UncertaintyChannels`\n", + " Since the graph has parallel edges it is quite some work to get the actual channels that the \n", + " min cost flow solver produced\n", + " \"\"\"\n", + " channel_path = []\n", + " bottleneck = 2**63\n", + " for src,dest in self._next_hop(path):\n", + " w = 2**63\n", + " c = None\n", + " flow = 0\n", + " for sid in G[src][dest].keys():\n", + " if G[src][dest][sid][\"weight\"]< w:\n", + " w = G[src][dest][sid][\"weight\"]\n", + " c = G[src][dest][sid][\"channel\"]\n", + " flow = G[src][dest][sid][\"flow\"]\n", + " channel_path.append(c)\n", + " \n", + " if flow < bottleneck:\n", + " bottleneck = flow\n", + " \n", + " return channel_path,bottleneck\n", "\n", - " mcf = prepare_mcf_solver(src,dest,amt,mu,base) \n", + " def _disect_flow_to_paths(self,s,d):\n", + " \"\"\"\n", + " A standard algorithm to disect a flow into several paths.\n", "\n", - " status = mcf.Solve()\n", + " FIXME: Note that this disection while accurate is probably not optimal in practise. \n", + " As noted in our Probabilistic payment delivery paper the payment process is a bernoulli trial \n", + " and I assume it makes sense to disect the flow into paths of similar likelihood to make most\n", + " progress but this is a mere conjecture at this point. I expect quite a bit of research will be\n", + " necessary to resolve this issue.\n", + " \"\"\"\n", + " total_flow = {}\n", "\n", + " #first collect all linearized edges which are assigned a non zero flow put them into a networkx graph\n", + " G = nx.MultiDiGraph()\n", + " for i in range(self._min_cost_flow.NumArcs()):\n", + " flow = self._min_cost_flow.Flow(i)#*QUANTIZATION\n", + " if flow == 0:\n", + " continue\n", "\n", - " if status != mcf.OPTIMAL:\n", - " print('There was an issue with the min cost flow input.')\n", - " print(f'Status: {status}')\n", - " exit(1)\n", + " \n", + " src, dest, channel,_ = self._arc_to_channel[i]\n", + " if G.has_edge(src,dest):\n", + " if channel.short_channel_id in G[src][dest]:\n", + " G[src][dest][channel.short_channel_id][\"flow\"]+=flow\n", + " else:\n", + " #FIXME: cost is not reflecting exactly the piecewise linearization\n", + " #Probably not such a big issue as we just disect flow\n", + " G.add_edge(src,dest,key=channel.short_channel_id,flow=flow,channel=channel, weight=channel.combined_linearized_unit_cost())\n", + " used_flow = 1\n", + " channel_paths = []\n", + " \n", + " #allocate flow to shortest / cheapest paths from src to dest as long as this is possible\n", + " #decrease flow along those edges. This is a standard mechanism to disect a flow int paths\n", + " while used_flow>0:\n", + " path = None\n", + " try: \n", + " path = nx.shortest_path(G,s,d)\n", + " except: \n", + " break\n", + " channel_path,used_flow = self._make_channel_path(G,path) \n", + " channel_paths.append((channel_path,used_flow))\n", + " \n", + " #reduce the flow from the selected path\n", + " for pos,hop in enumerate(self._next_hop(path)):\n", + " src, dest = hop\n", + " channel = channel_path[pos]\n", + " G[src][dest][channel.short_channel_id][\"flow\"]-=used_flow\n", + " if G[src][dest][channel.short_channel_id][\"flow\"]==0:\n", + " G.remove_edge(src,dest,key=channel.short_channel_id)\n", + " return channel_paths\n", + " \n", + " def _generate_candidate_paths(self,src, dest, amt,mu: int =100_000_000,base : int =DEFAULT_BASE_THRESHOLD):\n", + " \"\"\"\n", + " computes the optimal payment split to deliver `amt` from `src` to `dest` and updates our belief about the liquidity\n", "\n", - " paths = disect_flow_to_paths(mcf,oracle.look_up_id(src),oracle.look_up_id(dest))\n", - " #print(paths) \n", + " This is one step within the payment loop.\n", "\n", - " end = time.time()\n", - " print(\"\\\\mu: {} \\nRuntime of flow computation: {:4.2f} sec \".format(mu, end-start))\n", + " Retuns the residual amount of the `amt` that could ne be delivered and the paid fees\n", + " (on a per channel base not including fees for downstream fees) for the delivered amount\n", "\n", - " total_fees = 0\n", - " paid_fees = 0\n", - " residual_amt = 0\n", - " number_failed_paths = 0\n", - " for path in paths:\n", - " success, fee, probability = oracle.test_path(path[0],path[1])\n", - " fee /= 1000.\n", - " total_fees += fee\n", - " print(\"Success: {} \\t fee: {:8.3f}msat \\t p = {:5.2f}% amt: {:7}sats path hops: {}\".\n", - " format(success, fee, probability*100, path[1], len(path[0])))\n", - " if success == False:\n", - " number_failed_paths += 1\n", - " residual_amt += path[1]\n", - " else:\n", + " the function also prints some results an statistics about the paths of the flow to stdout.\n", + " \"\"\"\n", + " \n", + " #First we prepare the min cost flow by getting arcs from the uncertainty network\n", + " self._prepare_mcf_solver(src,dest,amt,mu,base) \n", + "\n", + " start = time.time()\n", + " #print(\"solving mcf...\")\n", + " status = self._min_cost_flow.Solve()\n", + " \n", + " if status != self._min_cost_flow.OPTIMAL:\n", + " print('There was an issue with the min cost flow input.')\n", + " print(f'Status: {status}')\n", + " exit(1)\n", + "\n", + " paths = self._disect_flow_to_paths(src,dest)\n", + " end = time.time()\n", + " return paths, end-start\n", + " \n", + " \n", + " def _estimate_payment_statistics(self,paths):\n", + " \"\"\"\n", + " estimates the success probability of paths and computes fees (without paying downstream fees)\n", + " \n", + " @returns the statistics in the `payments` dictionary\n", + " \"\"\"\n", + " #FIXME: Decide if an `Payments` or `Attempt` class shall be used\n", + " payments = {}\n", + " #compute fees and probabilities of candidate paths for evaluation\n", + " for i, onion in enumerate(paths):\n", + " path, amount = onion\n", + " fee, probability = self._uncertainty_network.get_features_of_candidate_path(path,amount)\n", + " payments[i] = {\"routing_fee\": fee, \"probability\": probability, \"path\": path, \"amount\": amount}\n", + " \n", + " #to correctly compute conditional probabilities of non disjoint paths in the same set of paths\n", + " self._uncertainty_network.allocate_amount_on_path(path,amount)\n", + "\n", + " #remove allocated amounts for all planned onions before doing actual attempts \n", + " for key, attempt in payments.items():\n", + " self._uncertainty_network.allocate_amount_on_path(attempt[\"path\"],-attempt[\"amount\"])\n", + " \n", + " return payments\n", + " \n", + " def _attempt_payments(self, payments):\n", + " \"\"\"\n", + " we attempt all planned payments and test the success against the oracle in particular this\n", + " method changes - depending on the outcome of each payment - our belief about the uncertainty\n", + " in the UncertaintyNetwork\n", + " \"\"\"\n", + " #test actual payment attempts\n", + " for key, attempt in payments.items():\n", + " success, erring_channel = self._oracle.send_onion(attempt[\"path\"],attempt[\"amount\"])\n", + " payments[key][\"success\"] = success\n", + " payments[key][\"erring_channel\"] = erring_channel\n", + " if success:\n", + " self._uncertainty_network.allocate_amount_on_path(attempt[\"path\"],attempt[\"amount\"]) \n", + " \n", + " def _evaluate_attempts(self,payments):\n", + " \"\"\"\n", + " helper function to collect statistics about attempts and print them\n", + " \n", + " returns the `residual` amount that could not have been delivered and some statistics\n", + " \"\"\"\n", + " total_fees = 0\n", + " paid_fees = 0\n", + " residual_amt = 0\n", + " number_failed_paths = 0\n", + " expected_sats_to_deliver = 0\n", + " amt = 0\n", + " print(\"\\nStatistics about {} candidate onions:\\n\".format(len(payments)))\n", + " \n", + " has_failed_attempt = False\n", + " print(\"successful attempts:\")\n", + " print(\"--------------------\")\n", + " for attempt in payments.values():\n", + " success = attempt[\"success\"]\n", + " if success == False:\n", + " has_failed_attempt = True\n", + " continue\n", + " fee = attempt[\"routing_fee\"] / 1000.\n", + " probability = attempt[\"probability\"]\n", + " path = attempt[\"path\"]\n", + " amount = attempt[\"amount\"]\n", + " amt += amount\n", + " total_fees += fee\n", + " expected_sats_to_deliver += probability * amount\n", + " print(\" p = {:6.2f}% amt: {:9} sats hops: {} ppm: {:5}\".format(probability*100, amount, len(path),int(fee*1000_000/amount)))\n", " paid_fees += fee\n", + " \n", + " if has_failed_attempt:\n", + " print(\"\\nfailed attempts:\")\n", + " print(\"----------------\")\n", + " for attempt in payments.values():\n", + " success = attempt[\"success\"]\n", + " if success:\n", + " continue\n", + " fee = attempt[\"routing_fee\"] / 1000.\n", + " probability = attempt[\"probability\"]\n", + " path = attempt[\"path\"]\n", + " amount = attempt[\"amount\"]\n", + " amt += amount\n", + " total_fees += fee\n", + " expected_sats_to_deliver += probability * amount\n", + " print(\" p = {:6.2f}% amt: {:9} sats hops: {} ppm: {:5} \".format(probability*100, amount, len(path),int(fee*1000_000/amount)))\n", + " number_failed_paths += 1\n", + " residual_amt += amount\n", "\n", - " print(\"total_fee: {:8.3f} msat \\t paid fees: {:8.3f} msat\".format(total_fees, paid_fees))\n", - " return residual_amt, paid_fees, len(paths), number_failed_paths\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [], - "source": [ - "def run_pickhardt_payments_experiment(oracle,src,dest,amt,mu=1,base=0):\n", - " \"\"\"\n", - " conduct one experiment! might need to call oracle.reset_uncertainty_network() first\n", - " I could not put it here as some experiments require sharing of liqudity information\n", + " \n", + " print(\"\\nAttempt Summary:\")\n", + " print(\"=================\")\n", + " print(\"\\nTried to deliver {:10} sats\".format(amt))\n", + " fraction = expected_sats_to_deliver*100./amt\n", + " print(\"expected to deliver {:10} sats \\t({:4.2f}%)\".format(int(expected_sats_to_deliver),fraction))\n", + " fraction = (amt-residual_amt)*100./(amt)\n", + " print(\"actually deliverd {:10} sats \\t({:4.2f}%)\".format(amt-residual_amt,fraction))\n", + " print(\"deviation: {:4.2f}\".format( (amt-residual_amt)/(expected_sats_to_deliver+1)))\n", + " print(\"planned_fee: {:8.3f} sat\".format(total_fees))\n", + " print(\"paid fees: {:8.3f} sat\".format(paid_fees))\n", + " return residual_amt, paid_fees, len(payments), number_failed_paths\n", + "\n", + " \n", + " def forget_information(self):\n", + " \"\"\"\n", + " forgets all the information in the UncertaintyNetwork that is a member of the PaymentSession\n", + " \"\"\"\n", + " self._uncertainty_network.reset_uncertainty_network()\n", + " \n", + " def activate_network_wide_uncertainty_reduction(self,n):\n", + " \"\"\"\n", + " Pipes API call to the UncertaintyNetwork\n", + " \"\"\"\n", + " self._uncertainty_network.activate_network_wide_uncertainty_reduction(n,self._oracle)\n", "\n", - " \"\"\"\n", - " entropy_start=oracle.entropy()\n", - " start = time.time()\n", - " full_amt = amt\n", - " cnt = 0\n", - " total_fees = 0\n", - " number_number_of_onions = 0\n", - " total_number_failed_paths = 0\n", - " while amt > 0 and cnt < 10:\n", - " print(\"\\nTry: \", amt, \" sats. Round number: \", cnt+1)\n", - " amt, paid_fees, num_paths, number_failed_paths = make_attempt(src,dest,amt,mu,base)\n", - " number_number_of_onions += num_paths\n", - " total_number_failed_paths+=number_failed_paths\n", - " total_fees += paid_fees\n", - " cnt+=1\n", - " end = time.time()\n", - " entropy_end = oracle.entropy()\n", - " print(\"\\nSUMMARY:\")\n", - " print(\"Rounds of mcf-computations: \", cnt)\n", - " print(\"Number of onions sent: \", number_number_of_onions)\n", - " print(\"Number of failed onions: \", total_number_failed_paths, \" failure rate: {:4.2f}% \".format(total_number_failed_paths*100./number_number_of_onions))\n", - " print(\"total runtime (including inefficient memory managment): {:4.3f} sec\".format(end-start))\n", - " print(\"Learnt entropy: {:5.2f} bits\".format(entropy_start-entropy_end))\n", - " print(\"Fees for successfull delivery: {:8.3f} sat --> {} ppm\".format(total_fees,int(total_fees*1000*1000/full_amt)))\n", " \n", - " " + " def pickhardt_pay(self,src,dest,amt,mu=1,base=0):\n", + " \"\"\"\n", + " conduct one experiment! might need to call oracle.reset_uncertainty_network() first\n", + " I could not put it here as some experiments require sharing of liqudity information\n", + "\n", + " \"\"\" \n", + " entropy_start=self._uncertainty_network.entropy()\n", + " start = time.time()\n", + " full_amt = amt\n", + " cnt = 0\n", + " total_fees = 0\n", + " number_number_of_onions = 0\n", + " total_number_failed_paths = 0\n", + " \n", + " #This is the main payment loop. It is currently blocking and synchronous but may be \n", + " #implemented in a concurrent way. Also we stop after 10 rounds which is pretty arbitrary\n", + " #a better stop criteria would be if we compute infeasable flows or if the probabilities \n", + " #are to low or residual amounts decrease to slowly\n", + " while amt > 0 and cnt < 10:\n", + " print(\"Round number: \", cnt+1)\n", + " print(\"Try to deliver\", amt, \"satoshi:\")\n", + " \n", + " #transfer to a min cost flow problem and rund the solver\n", + " paths,runtime = self._generate_candidate_paths(src,dest,amt,mu,base)\n", + " \n", + " #compute some statistics about candidate paths\n", + " payments = self._estimate_payment_statistics(paths)\n", + " \n", + " #matke attempts and update our information about the UncertaintyNetwork\n", + " self._attempt_payments(payments)\n", + " \n", + " #run some simple statistics and depict them\n", + " amt, paid_fees, num_paths, number_failed_paths = self._evaluate_attempts(payments)\n", + " print(\"Runtime of flow computation: {:4.2f} sec \".format(runtime))\n", + " print(\"\\n================================================================\\n\")\n", + "\n", + " number_number_of_onions += num_paths\n", + " total_number_failed_paths+=number_failed_paths\n", + " total_fees += paid_fees\n", + " cnt+=1\n", + " end = time.time()\n", + " entropy_end = self._uncertainty_network.entropy()\n", + " print(\"SUMMARY:\")\n", + " print(\"========\")\n", + " print(\"Rounds of mcf-computations: \", cnt)\n", + " print(\"Number of onions sent: \", number_number_of_onions)\n", + " print(\"Number of failed onions: \", total_number_failed_paths)\n", + " print(\"Failure rate: {:4.2f}% \".format(total_number_failed_paths*100./number_number_of_onions))\n", + " print(\"total runtime (including inefficient memory managment): {:4.3f} sec\".format(end-start))\n", + " print(\"Learnt entropy: {:5.2f} bits\".format(entropy_start-entropy_end))\n", + " print(\"Fees for successfull delivery: {:8.3f} sat --> {} ppm\".format(total_fees,int(total_fees*1000*1000/full_amt)))\n", + " print(\"used mu:\", mu)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "# Conducting experiments\n", - "\n", - "We now use our sequential simulation of the uncertainty network to coduct a few experiments. In all cases we try to deliver Payments from Rene's node to Carsten Otto (who is working on an alternative implementation) on a recent snapshot of the channel graph.\n", + "# Do experiments and apply the API\n", "\n", - "In the experiments we first want to study a few things: \n", - "\n", - "1. What happens if we mainly optimize for high success probability\n", - "2. What happens if we optimize for both success probability and fees\n", - "3. what happens if we optimize mainly for fees\n", - "4. How much better is the delivery of payments if we globaly would know 2 bits of information on alle channels\n", - "5. What is the effect of the BOLT 14 proposal to reliability where nodes would share liquidity information of their direct peers\n", - "6. MISSING: How is the difference in paid fee and payment attempts with different focus on various features (selection of \\mu)" + "We can now use the `PaymentSession` to conduct several experiments by calling `pickhardt_pay`.\n", + "We may of course exchange the Oracle or modify our belief by manipulating the UncertaintyNetwork" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -917,198 +1408,229 @@ "RENE = \"03efccf2c383d7bf340da9a3f02e2c23104a0e4fe8ac1a880c8e2dc92fbdacd9df\"\n", "#Carsten Otto's public node key\n", "C_OTTO = \"027ce055380348d7812d2ae7745701c9f93e70c1adeb2657f053f91df4f2843c71\"\n", - "\n", - "AMT = 50*1000*1000\n", "N = 5\n", - "QUANTIZATION=10000" + "\n", + "channel_graph = ChannelGraph(\"listchannels20220412.json\")\n", + "oracle_lightning_network = OracleLightningNetwork(channel_graph)\n", + "uncertainty_network = UncertaintyNetwork(channel_graph)" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 30, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "channels with full knowlege: 215\n", - "channels with 2 Bits of less entropy: 8750\n" + "133317516 sats would be possible on this oracle to deliver if including 1 sat basefee channels\n", + "81606959 sats possible on this oracle on the zeroBaseFeeGraph\n" ] } ], "source": [ - "oracle = Oracle()\n", - "oracle.import_channels(\"listchannels20211028.json\")\n", - "\n", - "#we only conduct the computation on the channels that have a basefee of 0\n", - "oracle.arcs_to_networkx(0)\n", - "oracle.activate_foaf_uncertainty_reduction(RENE,C_OTTO)" + "max_possible =oracle_lightning_network.theoretical_maximum_payable_amount(RENE,C_OTTO,1000)\n", + "print(max_possible, \"sats would be possible on this oracle to deliver if including 1 sat basefee channels\")\n", + "max_possible =oracle_lightning_network.theoretical_maximum_payable_amount(RENE,C_OTTO,0)\n", + "print(max_possible, \"sats possible on this oracle on the zeroBaseFeeGraph\")" ] }, { - "cell_type": "code", - "execution_count": 12, + "cell_type": "markdown", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "OPTIMIZE FOR soly for RELIABILITY\n", - "\n", - "Try: 50000000 sats. Round number: 1\n", - "\\mu: 0 \n", - "Runtime of flow computation: 1.43 sec \n", - "Success: True \t fee: 6153.950msat \t p = 64.05% amt: 3350000sats path hops: 3\n", - "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", - "Success: True \t fee: 3374.000msat \t p = 69.33% amt: 2000000sats path hops: 3\n", - "Success: True \t fee: 312.290msat \t p = 89.94% amt: 170000sats path hops: 3\n", - "Success: False \t fee: 12752.550msat \t p = 47.10% amt: 7650000sats path hops: 3\n", - "Success: True \t fee: 18.370msat \t p = 96.10% amt: 10000sats path hops: 4\n", - "Success: True \t fee: 3248.960msat \t p = 43.40% amt: 1430000sats path hops: 4\n", - "Success: True \t fee: 949.000msat \t p = 87.99% amt: 500000sats path hops: 4\n", - "Success: True \t fee: 1423.500msat \t p = 22.80% amt: 750000sats path hops: 4\n", - "Success: True \t fee: 2738.630msat \t p = 28.11% amt: 1370000sats path hops: 4\n", - "Success: True \t fee: 4052.290msat \t p = 82.72% amt: 1870000sats path hops: 4\n", - "Success: False \t fee: 37961.370msat \t p = 35.89% amt: 9110000sats path hops: 4\n", - "Success: True \t fee: 21620.230msat \t p = 55.79% amt: 5290000sats path hops: 5\n", - "Success: True \t fee: 1617.850msat \t p = 25.35% amt: 650000sats path hops: 5\n", - "Success: True \t fee: 1937.360msat \t p = 50.20% amt: 1220000sats path hops: 5\n", - "Success: True \t fee: 260.910msat \t p = 79.14% amt: 130000sats path hops: 5\n", - "Success: False \t fee: 13636.480msat \t p = 32.44% amt: 7040000sats path hops: 5\n", - "Success: True \t fee: 2300.160msat \t p = 68.51% amt: 1280000sats path hops: 5\n", - "Success: True \t fee: 6468.850msat \t p = 41.34% amt: 3350000sats path hops: 5\n", - "Success: True \t fee: 1515.150msat \t p = 88.25% amt: 650000sats path hops: 6\n", - "Success: True \t fee: 2757.090msat \t p = 90.46% amt: 570000sats path hops: 7\n", - "total_fee: 127251.560 msat \t paid fees: 62901.160 msat\n", - "\n", - "Try: 23800000 sats. Round number: 2\n", - "\\mu: 0 \n", - "Runtime of flow computation: 0.79 sec \n", - "Success: True \t fee: 6153.950msat \t p = 64.05% amt: 3350000sats path hops: 3\n", - "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", - "Success: True \t fee: 3374.000msat \t p = 69.33% amt: 2000000sats path hops: 3\n", - "Success: True \t fee: 312.290msat \t p = 89.94% amt: 170000sats path hops: 3\n", - "Success: True \t fee: 4284.190msat \t p = 80.86% amt: 2570000sats path hops: 3\n", - "Success: True \t fee: 18.370msat \t p = 96.10% amt: 10000sats path hops: 4\n", - "Success: True \t fee: 3248.960msat \t p = 43.40% amt: 1430000sats path hops: 4\n", - "Success: True \t fee: 2738.630msat \t p = 28.11% amt: 1370000sats path hops: 4\n", - "Success: True \t fee: 4052.290msat \t p = 82.72% amt: 1870000sats path hops: 4\n", - "Success: True \t fee: 166.680msat \t p = 99.66% amt: 40000sats path hops: 4\n", - "Success: True \t fee: 759.200msat \t p = 90.32% amt: 400000sats path hops: 4\n", - "Success: True \t fee: 664.300msat \t p = 62.30% amt: 350000sats path hops: 4\n", - "Success: True \t fee: 15121.900msat \t p = 67.67% amt: 3700000sats path hops: 5\n", - "Success: True \t fee: 1617.850msat \t p = 25.35% amt: 650000sats path hops: 5\n", - "Success: True \t fee: 260.910msat \t p = 79.14% amt: 130000sats path hops: 5\n", - "Success: True \t fee: 1437.600msat \t p = 79.81% amt: 800000sats path hops: 5\n", - "Success: True \t fee: 6468.850msat \t p = 41.34% amt: 3350000sats path hops: 5\n", - "total_fee: 52832.540 msat \t paid fees: 52832.540 msat\n", - "\n", - "SUMMARY:\n", - "Rounds of mcf-computations: 2\n", - "Number of onions sent: 38\n", - "Number of failed onions: 3 failure rate: 7.89% \n", - "total runtime (including inefficient memory managment): 2.223 sec\n", - "Learnt entropy: 157.24 bits\n", - "Fees for successfull delivery: 115733.700 sat --> 2314 ppm\n" - ] - } - ], "source": [ - "\n", - "print(\"OPTIMIZE FOR soly for RELIABILITY\")\n", - "oracle.reset_uncertainty_network()\n", - "run_pickhardt_payments_experiment(oracle,RENE,C_OTTO,AMT,mu=0,base=0)\n" + "## make highly reliable payment on the zeroBaseFee Network" ] }, { "cell_type": "code", - "execution_count": 13, - "metadata": { - "scrolled": false - }, + "execution_count": 38, + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "Round number: 1\n", + "Try to deliver 40803479 satoshi:\n", + "\n", + "Statistics about 12 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 52.92% amt: 2800000 sats hops: 3 ppm: 1897\n", + " p = 68.30% amt: 2020000 sats hops: 3 ppm: 1974\n", + " p = 69.25% amt: 630528 sats hops: 4 ppm: 3717\n", + " p = 59.67% amt: 200000 sats hops: 4 ppm: 21787\n", + " p = 70.46% amt: 858430 sats hops: 4 ppm: 2186\n", + " p = 48.33% amt: 3355443 sats hops: 4 ppm: 2496\n", + " p = 48.11% amt: 969011 sats hops: 5 ppm: 2057\n", + " p = 43.50% amt: 3000000 sats hops: 5 ppm: 2580\n", + " p = 20.97% amt: 5046329 sats hops: 5 ppm: 2551\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 3.89% amt: 15412696 sats hops: 3 ppm: 2036 \n", + " p = 70.31% amt: 1000000 sats hops: 4 ppm: 2060 \n", + " p = 17.01% amt: 5369472 sats hops: 6 ppm: 5317 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 40661909 sats\n", + "expected to deliver 10689556 sats \t(26.29%)\n", + "actually deliverd 18879741 sats \t(46.43%)\n", + "deviation: 1.77\n", + "planned_fee: 110879.668 sat\n", + "paid fees: 48869.156 sat\n", + "Runtime of flow computation: 0.52 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 2\n", + "Try to deliver 21782168 satoshi:\n", + "\n", + "Statistics about 8 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 76.04% amt: 2873894 sats hops: 4 ppm: 3717\n", + " p = 87.47% amt: 795578 sats hops: 4 ppm: 21786\n", + " p = 50.38% amt: 3200000 sats hops: 4 ppm: 2603\n", + " p = 67.19% amt: 1297336 sats hops: 5 ppm: 2592\n", + " p = 80.85% amt: 1000000 sats hops: 5 ppm: 2060\n", + " p = 17.41% amt: 1273183 sats hops: 6 ppm: 9024\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 22.48% amt: 10000000 sats hops: 3 ppm: 2037 \n", + " p = 61.05% amt: 1342177 sats hops: 5 ppm: 2579 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 21782168 sats\n", + "expected to deliver 9462316 sats \t(43.44%)\n", + "actually deliverd 10439991 sats \t(47.93%)\n", + "deviation: 1.10\n", + "planned_fee: 77095.271 sat\n", + "paid fees: 53262.456 sat\n", + "Runtime of flow computation: 0.54 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 3\n", + "Try to deliver 11342177 satoshi:\n", + "\n", + "Statistics about 3 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 85.86% amt: 1017742 sats hops: 5 ppm: 2201\n", + " p = 66.62% amt: 324435 sats hops: 7 ppm: 3251\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 47.68% amt: 10000000 sats hops: 6 ppm: 9025 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 11342177 sats\n", + "expected to deliver 5857548 sats \t(51.64%)\n", + "actually deliverd 1342177 sats \t(11.83%)\n", + "deviation: 0.23\n", + "planned_fee: 93546.128 sat\n", + "paid fees: 3296.128 sat\n", + "Runtime of flow computation: 0.60 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 4\n", + "Try to deliver 10000000 satoshi:\n", + "\n", + "Statistics about 1 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 60.31% amt: 10000000 sats hops: 6 ppm: 2879 \n", + "\n", + "Attempt Summary:\n", + "=================\n", "\n", + "Tried to deliver 10000000 sats\n", + "expected to deliver 6031170 sats \t(60.31%)\n", + "actually deliverd 0 sats \t(0.00%)\n", + "deviation: 0.00\n", + "planned_fee: 28790.000 sat\n", + "paid fees: 0.000 sat\n", + "Runtime of flow computation: 0.34 sec \n", "\n", - "OTPTIMIZE RELIABILITY AND FEES\n", - "\n", - "Try: 50000000 sats. Round number: 1\n", - "\\mu: 1 \n", - "Runtime of flow computation: 1.23 sec \n", - "Success: False \t fee: 14652.900msat \t p = 16.08% amt: 10050000sats path hops: 3\n", - "Success: True \t fee: 6631.570msat \t p = 61.60% amt: 3610000sats path hops: 3\n", - "Success: True \t fee: 2060.480msat \t p = 23.93% amt: 1370000sats path hops: 3\n", - "Success: True \t fee: 1537.000msat \t p = 64.00% amt: 1000000sats path hops: 3\n", - "Success: True \t fee: 908.700msat \t p = 23.40% amt: 650000sats path hops: 3\n", - "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", - "Success: True \t fee: 6748.000msat \t p = 44.00% amt: 4000000sats path hops: 3\n", - "Success: True \t fee: 1153.600msat \t p = 60.00% amt: 800000sats path hops: 3\n", - "Success: True \t fee: 312.290msat \t p = 89.94% amt: 170000sats path hops: 3\n", - "Success: True \t fee: 3454.770msat \t p = 75.12% amt: 2090000sats path hops: 4\n", - "Success: True \t fee: 18.370msat \t p = 96.10% amt: 10000sats path hops: 4\n", - "Success: False \t fee: 15743.040msat \t p = 29.51% amt: 9920000sats path hops: 4\n", - "Success: True \t fee: 2108.160msat \t p = 67.86% amt: 1280000sats path hops: 4\n", - "Success: True \t fee: 900.350msat \t p = 78.34% amt: 550000sats path hops: 4\n", - "Success: True \t fee: 1993.620msat \t p = 36.45% amt: 1490000sats path hops: 4\n", - "Success: False \t fee: 3392.260msat \t p = 63.59% amt: 2260000sats path hops: 4\n", - "Success: True \t fee: 5067.000msat \t p = 51.20% amt: 3000000sats path hops: 4\n", - "Success: False \t fee: 991.600msat \t p = 39.26% amt: 740000sats path hops: 4\n", - "Success: True \t fee: 1617.000msat \t p = 50.67% amt: 1000000sats path hops: 4\n", - "Success: True \t fee: 3236.000msat \t p = 56.47% amt: 2000000sats path hops: 4\n", - "Success: True \t fee: 407.680msat \t p = 69.08% amt: 260000sats path hops: 4\n", - "Success: True \t fee: 1518.000msat \t p = 70.81% amt: 1000000sats path hops: 4\n", - "Success: False \t fee: 1524.000msat \t p = 37.50% amt: 1000000sats path hops: 4\n", - "Success: True \t fee: 191.660msat \t p = 91.92% amt: 140000sats path hops: 5\n", - "total_fee: 78320.620 msat \t paid fees: 42016.820 msat\n", - "\n", - "Try: 23970000 sats. Round number: 2\n", - "\\mu: 1 \n", - "Runtime of flow computation: 1.37 sec \n", - "Success: True \t fee: 2930.580msat \t p = 77.47% amt: 2010000sats path hops: 3\n", - "Success: True \t fee: 2060.480msat \t p = 23.93% amt: 1370000sats path hops: 3\n", - "Success: True \t fee: 1537.000msat \t p = 64.00% amt: 1000000sats path hops: 3\n", - "Success: True \t fee: 908.700msat \t p = 23.40% amt: 650000sats path hops: 3\n", - "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", - "Success: True \t fee: 4622.380msat \t p = 59.34% amt: 2740000sats path hops: 3\n", - "Success: True \t fee: 1153.600msat \t p = 60.00% amt: 800000sats path hops: 3\n", - "Success: True \t fee: 3454.770msat \t p = 75.12% amt: 2090000sats path hops: 4\n", - "Success: True \t fee: 8538.060msat \t p = 57.36% amt: 5380000sats path hops: 4\n", - "Success: True \t fee: 2108.160msat \t p = 67.86% amt: 1280000sats path hops: 4\n", - "Success: True \t fee: 900.350msat \t p = 78.34% amt: 550000sats path hops: 4\n", - "Success: True \t fee: 1617.000msat \t p = 50.67% amt: 1000000sats path hops: 4\n", - "Success: True \t fee: 970.800msat \t p = 85.24% amt: 600000sats path hops: 4\n", - "Success: True \t fee: 407.680msat \t p = 69.08% amt: 260000sats path hops: 4\n", - "Success: True \t fee: 1518.000msat \t p = 70.81% amt: 1000000sats path hops: 4\n", - "Success: True \t fee: 1996.600msat \t p = 32.83% amt: 1490000sats path hops: 5\n", - "Success: True \t fee: 191.660msat \t p = 91.92% amt: 140000sats path hops: 5\n", - "total_fee: 37068.390 msat \t paid fees: 37068.390 msat\n", + "================================================================\n", + "\n", + "Round number: 5\n", + "Try to deliver 10000000 satoshi:\n", + "\n", + "Statistics about 2 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 99.03% amt: 203549 sats hops: 4 ppm: 1944\n", + " p = 72.16% amt: 9796451 sats hops: 7 ppm: 2878\n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 10000000 sats\n", + "expected to deliver 7270973 sats \t(72.71%)\n", + "actually deliverd 10000000 sats \t(100.00%)\n", + "deviation: 1.38\n", + "planned_fee: 28599.880 sat\n", + "paid fees: 28599.880 sat\n", + "Runtime of flow computation: 0.44 sec \n", + "\n", + "================================================================\n", "\n", "SUMMARY:\n", - "Rounds of mcf-computations: 2\n", - "Number of onions sent: 41\n", - "Number of failed onions: 5 failure rate: 12.20% \n", - "total runtime (including inefficient memory managment): 2.609 sec\n", - "Learnt entropy: 166.14 bits\n", - "Fees for successfull delivery: 79085.210 sat --> 1581 ppm\n" + "========\n", + "Rounds of mcf-computations: 5\n", + "Number of onions sent: 26\n", + "Number of failed onions: 7\n", + "Failure rate: 26.92% \n", + "total runtime (including inefficient memory managment): 7.449 sec\n", + "Learnt entropy: 32.02 bits\n", + "Fees for successfull delivery: 134027.620 sat --> 3284 ppm\n", + "used mu: 0\n" ] } ], "source": [ - "print(\"\\n\\nOTPTIMIZE RELIABILITY AND FEES\")\n", - "oracle.reset_uncertainty_network()\n", - "run_pickhardt_payments_experiment(oracle,RENE,C_OTTO,AMT,mu=1,base=0)\n", + "AMT = int(max_possible/2)\n", + "payment_session = PaymentSession(oracle_lightning_network, \n", + " uncertainty_network,\n", + " prune_network=False)\n", + "payment_session.forget_information()\n", + "#payment_session.activate_network_wide_uncertainty_reduction(1)\n", + "\n", + "payment_session.pickhardt_pay(RENE,C_OTTO, AMT,mu=0,base=0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## make very cheap payment on the zeroBaseFee Network without Pruning\n", "\n", - "\n" + "currently the pruning strategy is mainly implemented on a reliability estimate thus pruning when optimizing for fees does not make sense" ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 39, "metadata": { "scrolled": false }, @@ -1117,254 +1639,727 @@ "name": "stdout", "output_type": "stream", "text": [ + "Round number: 1\n", + "Try to deliver 40803479 satoshi:\n", "\n", + "Statistics about 33 candidate onions:\n", "\n", - "OTPTIMIZE MAINLY FOR FEES\n", - "\n", - "Try: 50000000 sats. Round number: 1\n", - "\\mu: 100 \n", - "Runtime of flow computation: 1.28 sec \n", - "Success: True \t fee: 8354.340msat \t p = 43.36% amt: 5730000sats path hops: 3\n", - "Success: True \t fee: 1338.560msat \t p = 46.83% amt: 890000sats path hops: 3\n", - "Success: True \t fee: 1089.600msat \t p = 44.00% amt: 800000sats path hops: 3\n", - "Success: False \t fee: 1087.200msat \t p = 10.57% amt: 800000sats path hops: 3\n", - "Success: False \t fee: 3061.730msat \t p = 6.48% amt: 2290000sats path hops: 3\n", - "Success: False \t fee: 4037.600msat \t p = 3.75% amt: 2800000sats path hops: 3\n", - "Success: True \t fee: 318.340msat \t p = 47.75% amt: 220000sats path hops: 4\n", - "Success: False \t fee: 230.080msat \t p = 51.83% amt: 160000sats path hops: 4\n", - "Success: False \t fee: 386.370msat \t p = 45.34% amt: 270000sats path hops: 4\n", - "Success: False \t fee: 675.000msat \t p = 44.44% amt: 500000sats path hops: 4\n", - "Success: True \t fee: 409.200msat \t p = 66.46% amt: 300000sats path hops: 4\n", - "Success: False \t fee: 539.200msat \t p = 38.40% amt: 400000sats path hops: 4\n", - "Success: False \t fee: 1078.400msat \t p = 40.48% amt: 800000sats path hops: 4\n", - "Success: False \t fee: 3625.980msat \t p = 5.14% amt: 2710000sats path hops: 4\n", - "Success: True \t fee: 66.900msat \t p = 78.60% amt: 50000sats path hops: 4\n", - "Success: False \t fee: 1144.570msat \t p = 10.26% amt: 830000sats path hops: 4\n", - "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", - "Success: True \t fee: 354.900msat \t p = 78.08% amt: 260000sats path hops: 4\n", - "Success: False \t fee: 1795.600msat \t p = 6.46% amt: 1340000sats path hops: 4\n", - "Success: True \t fee: 576.000msat \t p = 40.49% amt: 400000sats path hops: 5\n", - "Success: True \t fee: 492.660msat \t p = 41.10% amt: 340000sats path hops: 5\n", - "Success: True \t fee: 407.100msat \t p = 56.07% amt: 300000sats path hops: 5\n", - "Success: False \t fee: 896.280msat \t p = 32.70% amt: 660000sats path hops: 5\n", - "Success: False \t fee: 5668.000msat \t p = 0.00% amt: 4000000sats path hops: 5\n", - "Success: False \t fee: 567.600msat \t p = 55.65% amt: 400000sats path hops: 5\n", - "Success: False \t fee: 769.500msat \t p = 56.77% amt: 540000sats path hops: 5\n", - "Success: True \t fee: 818.400msat \t p = 18.28% amt: 600000sats path hops: 5\n", - "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", - "Success: False \t fee: 1537.920msat \t p = 5.94% amt: 1080000sats path hops: 5\n", - "Success: False \t fee: 2831.520msat \t p = 22.21% amt: 2040000sats path hops: 5\n", - "Success: True \t fee: 278.000msat \t p = 74.26% amt: 200000sats path hops: 5\n", - "Success: True \t fee: 102.760msat \t p = 96.14% amt: 70000sats path hops: 5\n", - "Success: True \t fee: 293.600msat \t p = 59.68% amt: 200000sats path hops: 5\n", - "Success: False \t fee: 81.660msat \t p = 65.60% amt: 60000sats path hops: 6\n", - "Success: True \t fee: 1011.050msat \t p = 5.76% amt: 730000sats path hops: 6\n", - "Success: True \t fee: 271.600msat \t p = 63.79% amt: 200000sats path hops: 6\n", - "Success: False \t fee: 5399.800msat \t p = 2.76% amt: 3800000sats path hops: 6\n", - "Success: True \t fee: 177.060msat \t p = 75.11% amt: 130000sats path hops: 6\n", - "Success: True \t fee: 190.540msat \t p = 41.79% amt: 140000sats path hops: 6\n", - "Success: True \t fee: 54.520msat \t p = 80.83% amt: 40000sats path hops: 6\n", - "Success: False \t fee: 4307.100msat \t p = 8.05% amt: 2930000sats path hops: 6\n", - "Success: True \t fee: 744.660msat \t p = 39.85% amt: 540000sats path hops: 6\n", - "Success: False \t fee: 272.000msat \t p = 47.11% amt: 200000sats path hops: 6\n", - "Success: False \t fee: 166.800msat \t p = 33.26% amt: 120000sats path hops: 6\n", - "Success: True \t fee: 40.530msat \t p = 73.18% amt: 30000sats path hops: 7\n", - "Success: False \t fee: 348.920msat \t p = 4.37% amt: 260000sats path hops: 7\n", - "Success: True \t fee: 122.580msat \t p = 58.86% amt: 90000sats path hops: 7\n", - "Success: False \t fee: 682.560msat \t p = 60.01% amt: 480000sats path hops: 7\n", - "Success: True \t fee: 69.100msat \t p = 37.10% amt: 50000sats path hops: 7\n", - "Success: True \t fee: 138.300msat \t p = 60.54% amt: 100000sats path hops: 7\n", - "Success: False \t fee: 135.900msat \t p = 78.69% amt: 100000sats path hops: 7\n", - "Success: False \t fee: 588.400msat \t p = 46.70% amt: 400000sats path hops: 7\n", - "Success: False \t fee: 2778.000msat \t p = 14.66% amt: 2000000sats path hops: 7\n", - "Success: True \t fee: 85.260msat \t p = 94.30% amt: 60000sats path hops: 7\n", - "Success: True \t fee: 1799.590msat \t p = 32.64% amt: 1270000sats path hops: 7\n", - "Success: True \t fee: 254.980msat \t p = 68.01% amt: 190000sats path hops: 7\n", - "Success: True \t fee: 26.840msat \t p = 73.70% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 308.200msat \t p = 54.63% amt: 230000sats path hops: 7\n", - "Success: True \t fee: 230.350msat \t p = 61.96% amt: 170000sats path hops: 7\n", - "Success: True \t fee: 312.110msat \t p = 57.58% amt: 230000sats path hops: 8\n", - "Success: False \t fee: 135.200msat \t p = 67.64% amt: 100000sats path hops: 8\n", - "Success: False \t fee: 1472.000msat \t p = 40.64% amt: 1000000sats path hops: 8\n", - "Success: False \t fee: 536.800msat \t p = 23.29% amt: 400000sats path hops: 9\n", - "Success: True \t fee: 138.500msat \t p = 57.06% amt: 100000sats path hops: 10\n", - "Success: True \t fee: 425.320msat \t p = 55.58% amt: 310000sats path hops: 10\n", - "Success: False \t fee: 712.920msat \t p = 29.03% amt: 520000sats path hops: 10\n", - "Success: False \t fee: 537.810msat \t p = 43.65% amt: 390000sats path hops: 10\n", - "Success: True \t fee: 138.400msat \t p = 48.69% amt: 100000sats path hops: 10\n", - "Success: True \t fee: 84.600msat \t p = 69.93% amt: 60000sats path hops: 11\n", - "Success: True \t fee: 42.240msat \t p = 84.00% amt: 30000sats path hops: 12\n", - "total_fee: 70246.670 msat \t paid fees: 22158.250 msat\n", - "\n", - "Try: 34380000 sats. Round number: 2\n", - "\\mu: 100 \n", - "Runtime of flow computation: 1.22 sec \n", - "Success: True \t fee: 9360.360msat \t p = 38.11% amt: 6420000sats path hops: 3\n", - "Success: True \t fee: 1416.480msat \t p = 31.36% amt: 1040000sats path hops: 3\n", - "Success: False \t fee: 706.680msat \t p = 34.37% amt: 520000sats path hops: 3\n", - "Success: False \t fee: 2847.810msat \t p = 11.65% amt: 2130000sats path hops: 3\n", - "Success: False \t fee: 3662.680msat \t p = 7.53% amt: 2540000sats path hops: 3\n", - "Success: True \t fee: 318.340msat \t p = 47.75% amt: 220000sats path hops: 4\n", - "Success: True \t fee: 100.170msat \t p = 84.19% amt: 70000sats path hops: 4\n", - "Success: True \t fee: 135.000msat \t p = 86.61% amt: 100000sats path hops: 4\n", - "Success: True \t fee: 409.200msat \t p = 66.46% amt: 300000sats path hops: 4\n", - "Success: False \t fee: 215.680msat \t p = 85.70% amt: 160000sats path hops: 4\n", - "Success: False \t fee: 3304.860msat \t p = 10.02% amt: 2470000sats path hops: 4\n", - "Success: True \t fee: 66.900msat \t p = 78.60% amt: 50000sats path hops: 4\n", - "Success: False \t fee: 1034.250msat \t p = 15.94% amt: 750000sats path hops: 4\n", - "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", - "Success: False \t fee: 1119.300msat \t p = 40.53% amt: 820000sats path hops: 4\n", - "Success: False \t fee: 1581.200msat \t p = 13.86% amt: 1180000sats path hops: 4\n", - "Success: True \t fee: 576.000msat \t p = 40.49% amt: 400000sats path hops: 5\n", - "Success: True \t fee: 492.660msat \t p = 41.10% amt: 340000sats path hops: 5\n", - "Success: True \t fee: 203.550msat \t p = 75.85% amt: 150000sats path hops: 5\n", - "Success: False \t fee: 3953.430msat \t p = 9.29% amt: 2790000sats path hops: 5\n", - "Success: False \t fee: 113.520msat \t p = 90.64% amt: 80000sats path hops: 5\n", - "Success: True \t fee: 818.400msat \t p = 18.28% amt: 600000sats path hops: 5\n", - "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", - "Success: False \t fee: 854.400msat \t p = 30.42% amt: 600000sats path hops: 5\n", - "Success: True \t fee: 777.280msat \t p = 70.27% amt: 560000sats path hops: 5\n", - "Success: True \t fee: 278.000msat \t p = 74.26% amt: 200000sats path hops: 5\n", - "Success: False \t fee: 1542.240msat \t p = 10.77% amt: 1120000sats path hops: 5\n", - "Success: True \t fee: 138.100msat \t p = 60.94% amt: 100000sats path hops: 6\n", - "Success: True \t fee: 998.640msat \t p = 57.85% amt: 720000sats path hops: 6\n", - "Success: True \t fee: 40.500msat \t p = 73.70% amt: 30000sats path hops: 6\n", - "Success: False \t fee: 214.560msat \t p = 26.04% amt: 160000sats path hops: 6\n", - "Success: True \t fee: 1011.050msat \t p = 5.76% amt: 730000sats path hops: 6\n", - "Success: True \t fee: 163.320msat \t p = 48.77% amt: 120000sats path hops: 6\n", - "Success: True \t fee: 108.640msat \t p = 84.20% amt: 80000sats path hops: 6\n", - "Success: True \t fee: 54.520msat \t p = 80.83% amt: 40000sats path hops: 6\n", - "Success: True \t fee: 122.580msat \t p = 82.30% amt: 90000sats path hops: 6\n", - "Success: True \t fee: 1989.400msat \t p = 38.52% amt: 1400000sats path hops: 6\n", - "Success: False \t fee: 149.820msat \t p = 51.19% amt: 110000sats path hops: 7\n", - "Success: False \t fee: 1716.990msat \t p = 42.37% amt: 1210000sats path hops: 7\n", - "Success: True \t fee: 54.120msat \t p = 92.57% amt: 40000sats path hops: 7\n", - "Success: True \t fee: 69.100msat \t p = 37.10% amt: 50000sats path hops: 7\n", - "Success: True \t fee: 111.120msat \t p = 93.94% amt: 80000sats path hops: 7\n", - "Success: True \t fee: 85.260msat \t p = 94.30% amt: 60000sats path hops: 7\n", - "Success: True \t fee: 2564.770msat \t p = 18.47% amt: 1810000sats path hops: 7\n", - "Success: True \t fee: 268.400msat \t p = 66.54% amt: 200000sats path hops: 7\n", - "Success: True \t fee: 312.110msat \t p = 59.01% amt: 230000sats path hops: 7\n", - "Success: True \t fee: 26.840msat \t p = 73.70% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 67.450msat \t p = 89.50% amt: 50000sats path hops: 8\n", - "Success: True \t fee: 13.470msat \t p = 97.94% amt: 10000sats path hops: 8\n", - "Success: True \t fee: 271.000msat \t p = 74.22% amt: 200000sats path hops: 8\n", - "Success: True \t fee: 26.840msat \t p = 94.31% amt: 20000sats path hops: 8\n", - "Success: True \t fee: 138.500msat \t p = 57.06% amt: 100000sats path hops: 10\n", - "Success: True \t fee: 285.000msat \t p = 70.23% amt: 200000sats path hops: 10\n", - "Success: True \t fee: 275.400msat \t p = 67.89% amt: 200000sats path hops: 10\n", - "Success: True \t fee: 151.250msat \t p = 76.32% amt: 110000sats path hops: 10\n", - "Success: True \t fee: 138.000msat \t p = 46.62% amt: 100000sats path hops: 10\n", - "Success: True \t fee: 28.120msat \t p = 88.34% amt: 20000sats path hops: 11\n", - "Success: True \t fee: 56.320msat \t p = 79.11% amt: 40000sats path hops: 12\n", - "total_fee: 48131.140 msat \t paid fees: 25113.720 msat\n", - "\n", - "Try: 16640000 sats. Round number: 3\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\\mu: 100 \n", - "Runtime of flow computation: 1.27 sec \n", - "Success: True \t fee: 1934.040msat \t p = 15.27% amt: 1420000sats path hops: 3\n", - "Success: False \t fee: 312.570msat \t p = 67.54% amt: 230000sats path hops: 3\n", - "Success: False \t fee: 2553.670msat \t p = 19.09% amt: 1910000sats path hops: 3\n", - "Success: True \t fee: 243.000msat \t p = 76.76% amt: 180000sats path hops: 4\n", - "Success: False \t fee: 3037.260msat \t p = 14.54% amt: 2270000sats path hops: 4\n", - "Success: True \t fee: 66.900msat \t p = 78.60% amt: 50000sats path hops: 4\n", - "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", - "Success: True \t fee: 382.200msat \t p = 76.52% amt: 280000sats path hops: 4\n", - "Success: False \t fee: 1206.000msat \t p = 29.14% amt: 900000sats path hops: 4\n", - "Success: False \t fee: 82.200msat \t p = 85.37% amt: 60000sats path hops: 5\n", - "Success: True \t fee: 203.550msat \t p = 75.85% amt: 150000sats path hops: 5\n", - "Success: True \t fee: 818.400msat \t p = 18.28% amt: 600000sats path hops: 5\n", - "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", - "Success: True \t fee: 694.000msat \t p = 73.10% amt: 500000sats path hops: 5\n", - "Success: True \t fee: 950.130msat \t p = 30.76% amt: 690000sats path hops: 5\n", - "Success: True \t fee: 278.000msat \t p = 74.26% amt: 200000sats path hops: 5\n", - "Success: True \t fee: 1009.590msat \t p = 5.52% amt: 730000sats path hops: 6\n", - "Success: True \t fee: 372.330msat \t p = 56.27% amt: 270000sats path hops: 6\n", - "Success: True \t fee: 138.100msat \t p = 60.94% amt: 100000sats path hops: 6\n", - "Success: True \t fee: 832.200msat \t p = 63.73% amt: 600000sats path hops: 6\n", - "Success: True \t fee: 40.500msat \t p = 73.70% amt: 30000sats path hops: 6\n", - "Success: False \t fee: 147.510msat \t p = 43.27% amt: 110000sats path hops: 6\n", - "Success: False \t fee: 53.720msat \t p = 75.89% amt: 40000sats path hops: 6\n", - "Success: True \t fee: 455.730msat \t p = 49.46% amt: 330000sats path hops: 6\n", - "Success: True \t fee: 68.100msat \t p = 89.90% amt: 50000sats path hops: 6\n", - "Success: True \t fee: 108.640msat \t p = 84.20% amt: 80000sats path hops: 6\n", - "Success: False \t fee: 123.660msat \t p = 78.83% amt: 90000sats path hops: 6\n", - "Success: True \t fee: 1577.310msat \t p = 47.90% amt: 1110000sats path hops: 6\n", - "Success: False \t fee: 13.420msat \t p = 93.43% amt: 10000sats path hops: 7\n", - "Success: True \t fee: 108.960msat \t p = 62.89% amt: 80000sats path hops: 7\n", - "Success: True \t fee: 108.240msat \t p = 85.57% amt: 80000sats path hops: 7\n", - "Success: True \t fee: 69.100msat \t p = 37.10% amt: 50000sats path hops: 7\n", - "Success: True \t fee: 166.680msat \t p = 91.02% amt: 120000sats path hops: 7\n", - "Success: True \t fee: 1261.130msat \t p = 46.91% amt: 890000sats path hops: 7\n", - "Success: True \t fee: 348.920msat \t p = 58.14% amt: 260000sats path hops: 7\n", - "Success: True \t fee: 312.110msat \t p = 59.01% amt: 230000sats path hops: 7\n", - "Success: True \t fee: 26.840msat \t p = 73.70% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 948.500msat \t p = 30.05% amt: 700000sats path hops: 8\n", - "Success: True \t fee: 26.840msat \t p = 94.31% amt: 20000sats path hops: 8\n", - "Success: True \t fee: 41.160msat \t p = 95.00% amt: 30000sats path hops: 9\n", - "Success: True \t fee: 315.100msat \t p = 58.50% amt: 230000sats path hops: 9\n", - "Success: True \t fee: 138.500msat \t p = 57.06% amt: 100000sats path hops: 10\n", - "Success: True \t fee: 68.600msat \t p = 91.30% amt: 50000sats path hops: 10\n", - "Success: True \t fee: 137.700msat \t p = 49.60% amt: 100000sats path hops: 10\n", - "Success: True \t fee: 84.180msat \t p = 70.70% amt: 60000sats path hops: 11\n", - "Success: True \t fee: 259.350msat \t p = 26.56% amt: 190000sats path hops: 11\n", - "total_fee: 22716.200 msat \t paid fees: 15186.190 msat\n", - "\n", - "Try: 5620000 sats. Round number: 4\n", - "\\mu: 100 \n", - "Runtime of flow computation: 1.43 sec \n", - "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", - "Success: True \t fee: 243.000msat \t p = 76.76% amt: 180000sats path hops: 4\n", - "Success: True \t fee: 1391.520msat \t p = 52.45% amt: 1040000sats path hops: 4\n", - "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", - "Success: False \t fee: 991.600msat \t p = 39.26% amt: 740000sats path hops: 4\n", - "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", - "Success: True \t fee: 696.800msat \t p = 71.72% amt: 520000sats path hops: 5\n", - "Success: True \t fee: 93.660msat \t p = 92.28% amt: 70000sats path hops: 5\n", - "Success: True \t fee: 66.900msat \t p = 76.25% amt: 50000sats path hops: 5\n", - "Success: True \t fee: 40.500msat \t p = 73.70% amt: 30000sats path hops: 6\n", - "Success: True \t fee: 108.240msat \t p = 85.57% amt: 80000sats path hops: 7\n", - "Success: True \t fee: 147.400msat \t p = 75.79% amt: 110000sats path hops: 7\n", - "Success: True \t fee: 26.840msat \t p = 73.70% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 201.000msat \t p = 72.36% amt: 150000sats path hops: 8\n", - "Success: True \t fee: 757.680msat \t p = 36.37% amt: 560000sats path hops: 9\n", - "Success: True \t fee: 26.800msat \t p = 94.02% amt: 20000sats path hops: 9\n", - "total_fee: 7536.070 msat \t paid fees: 6544.470 msat\n", - "\n", - "Try: 740000 sats. Round number: 5\n", - "\\mu: 100 \n", - "Runtime of flow computation: 0.90 sec \n", - "Success: True \t fee: 280.770msat \t p = 89.68% amt: 210000sats path hops: 3\n", - "Success: True \t fee: 708.610msat \t p = 65.98% amt: 530000sats path hops: 5\n", - "total_fee: 989.380 msat \t paid fees: 989.380 msat\n", + "successful attempts:\n", + "--------------------\n", + " p = 57.70% amt: 384000 sats hops: 2 ppm: 1342\n", + " p = 72.45% amt: 194200 sats hops: 3 ppm: 1362\n", + " p = 63.79% amt: 400000 sats hops: 3 ppm: 1347\n", + " p = 5.33% amt: 1000000 sats hops: 4 ppm: 1368\n", + " p = 0.00% amt: 1188865 sats hops: 5 ppm: 1352\n", + " p = 20.54% amt: 1000000 sats hops: 5 ppm: 1357\n", + " p = 4.16% amt: 3200000 sats hops: 5 ppm: 1362\n", + " p = 0.27% amt: 605279 sats hops: 6 ppm: 1361\n", + " p = 28.63% amt: 400000 sats hops: 6 ppm: 1339\n", + " p = 1.35% amt: 224144 sats hops: 6 ppm: 1364\n", + " p = 16.27% amt: 400000 sats hops: 6 ppm: 1351\n", + " p = 42.28% amt: 200000 sats hops: 8 ppm: 1345\n", + " p = 13.09% amt: 20000 sats hops: 11 ppm: 1343\n", "\n", - "SUMMARY:\n", - "Rounds of mcf-computations: 5\n", - "Number of onions sent: 192\n", - "Number of failed onions: 57 failure rate: 29.69% \n", - "total runtime (including inefficient memory managment): 6.112 sec\n", - "Learnt entropy: 268.16 bits\n", - "Fees for successfull delivery: 69992.010 sat --> 1399 ppm\n" - ] - } - ], - "source": [ - " \n", - "print(\"\\n\\nOTPTIMIZE MAINLY FOR FEES\")\n", - "oracle.reset_uncertainty_network()\n", - "run_pickhardt_payments_experiment(oracle,RENE,C_OTTO,AMT,mu=100,base=0)\n", - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": 15, + "failed attempts:\n", + "----------------\n", + " p = 31.20% amt: 660000 sats hops: 2 ppm: 1339 \n", + " p = 0.00% amt: 5000000 sats hops: 2 ppm: 1360 \n", + " p = 72.00% amt: 200000 sats hops: 2 ppm: 1357 \n", + " p = 12.34% amt: 3600000 sats hops: 3 ppm: 1352 \n", + " p = 1.38% amt: 8811135 sats hops: 3 ppm: 1365 \n", + " p = 32.20% amt: 540000 sats hops: 4 ppm: 1354 \n", + " p = 30.79% amt: 1000000 sats hops: 4 ppm: 1357 \n", + " p = 1.08% amt: 2000000 sats hops: 4 ppm: 1341 \n", + " p = 18.99% amt: 600000 sats hops: 5 ppm: 1352 \n", + " p = 8.40% amt: 1000000 sats hops: 5 ppm: 1352 \n", + " p = 0.26% amt: 3020000 sats hops: 6 ppm: 1352 \n", + " p = 2.91% amt: 400000 sats hops: 6 ppm: 1363 \n", + " p = 0.00% amt: 1015856 sats hops: 6 ppm: 1353 \n", + " p = 24.86% amt: 360000 sats hops: 6 ppm: 1339 \n", + " p = 0.00% amt: 375856 sats hops: 6 ppm: 1372 \n", + " p = 40.49% amt: 500000 sats hops: 6 ppm: 1353 \n", + " p = 20.16% amt: 1124144 sats hops: 6 ppm: 1358 \n", + " p = 38.83% amt: 400000 sats hops: 7 ppm: 1340 \n", + " p = 13.37% amt: 600000 sats hops: 9 ppm: 1343 \n", + " p = 9.26% amt: 380000 sats hops: 9 ppm: 1342 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 40803479 sats\n", + "expected to deliver 3706918 sats \t(9.08%)\n", + "actually deliverd 9216488 sats \t(22.59%)\n", + "deviation: 2.49\n", + "planned_fee: 55362.431 sat\n", + "paid fees: 12512.958 sat\n", + "Runtime of flow computation: 0.75 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 2\n", + "Try to deliver 31586991 satoshi:\n", + "\n", + "Statistics about 40 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 28.13% amt: 200000 sats hops: 3 ppm: 1388\n", + " p = 26.70% amt: 100000 sats hops: 3 ppm: 1338\n", + " p = 0.00% amt: 65240 sats hops: 3 ppm: 1359\n", + " p = 58.88% amt: 400000 sats hops: 3 ppm: 1381\n", + " p = 20.39% amt: 355644 sats hops: 4 ppm: 1360\n", + " p = 68.15% amt: 20000 sats hops: 4 ppm: 1345\n", + " p = 2.65% amt: 800000 sats hops: 4 ppm: 1368\n", + " p = 0.00% amt: 1968503 sats hops: 5 ppm: 1352\n", + " p = 34.13% amt: 800000 sats hops: 5 ppm: 1357\n", + " p = 0.17% amt: 1470344 sats hops: 6 ppm: 1361\n", + " p = 42.69% amt: 120000 sats hops: 6 ppm: 1363\n", + " p = 37.06% amt: 120000 sats hops: 6 ppm: 1349\n", + " p = 7.92% amt: 880000 sats hops: 6 ppm: 1341\n", + " p = 0.00% amt: 400000 sats hops: 6 ppm: 1364\n", + " p = 57.45% amt: 72000 sats hops: 7 ppm: 1343\n", + " p = 54.80% amt: 12999 sats hops: 9 ppm: 1396\n", + " p = 0.00% amt: 7216 sats hops: 11 ppm: 1364\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 38.53% amt: 345600 sats hops: 2 ppm: 1341 \n", + " p = 0.02% amt: 4934760 sats hops: 2 ppm: 1359 \n", + " p = 52.21% amt: 310720 sats hops: 3 ppm: 1362 \n", + " p = 3.26% amt: 6386988 sats hops: 3 ppm: 1365 \n", + " p = 70.63% amt: 80000 sats hops: 3 ppm: 1338 \n", + " p = 40.00% amt: 2014760 sats hops: 3 ppm: 1351 \n", + " p = 76.71% amt: 133333 sats hops: 3 ppm: 1378 \n", + " p = 0.47% amt: 1800000 sats hops: 4 ppm: 1341 \n", + " p = 26.74% amt: 480000 sats hops: 4 ppm: 1345 \n", + " p = 31.23% amt: 396000 sats hops: 4 ppm: 1339 \n", + " p = 9.25% amt: 2560000 sats hops: 5 ppm: 1362 \n", + " p = 8.86% amt: 600000 sats hops: 6 ppm: 1352 \n", + " p = 3.58% amt: 935443 sats hops: 6 ppm: 1356 \n", + " p = 36.34% amt: 289656 sats hops: 6 ppm: 1358 \n", + " p = 27.13% amt: 200000 sats hops: 6 ppm: 1364 \n", + " p = 0.00% amt: 426803 sats hops: 7 ppm: 1357 \n", + " p = 39.86% amt: 240000 sats hops: 7 ppm: 1343 \n", + " p = 55.80% amt: 72000 sats hops: 8 ppm: 1344 \n", + " p = 12.37% amt: 600000 sats hops: 8 ppm: 1368 \n", + " p = 32.22% amt: 220000 sats hops: 9 ppm: 1349 \n", + " p = 0.00% amt: 200000 sats hops: 9 ppm: 1368 \n", + " p = 8.80% amt: 500000 sats hops: 11 ppm: 1369 \n", + " p = 33.59% amt: 68982 sats hops: 12 ppm: 1347 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 31586991 sats\n", + "expected to deliver 3476148 sats \t(11.01%)\n", + "actually deliverd 7791946 sats \t(24.67%)\n", + "deviation: 2.24\n", + "planned_fee: 42914.071 sat\n", + "paid fees: 10585.265 sat\n", + "Runtime of flow computation: 0.72 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 3\n", + "Try to deliver 23795045 satoshi:\n", + "\n", + "Statistics about 39 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 80.00% amt: 40000 sats hops: 2 ppm: 1357\n", + " p = 77.29% amt: 62144 sats hops: 3 ppm: 1362\n", + " p = 33.18% amt: 160000 sats hops: 3 ppm: 1388\n", + " p = 31.56% amt: 80000 sats hops: 3 ppm: 1338\n", + " p = 60.00% amt: 805904 sats hops: 3 ppm: 1351\n", + " p = 31.94% amt: 1280000 sats hops: 3 ppm: 1416\n", + " p = 43.39% amt: 9031 sats hops: 4 ppm: 1387\n", + " p = 24.68% amt: 213386 sats hops: 4 ppm: 1360\n", + " p = 8.41% amt: 180000 sats hops: 4 ppm: 1364\n", + " p = 54.16% amt: 158400 sats hops: 4 ppm: 1338\n", + " p = 21.53% amt: 640000 sats hops: 5 ppm: 1357\n", + " p = 17.07% amt: 512000 sats hops: 5 ppm: 1362\n", + " p = 0.00% amt: 97269 sats hops: 6 ppm: 1353\n", + " p = 59.72% amt: 57600 sats hops: 6 ppm: 1338\n", + " p = 67.06% amt: 57931 sats hops: 6 ppm: 1350\n", + " p = 52.59% amt: 96000 sats hops: 6 ppm: 1355\n", + " p = 53.40% amt: 162800 sats hops: 7 ppm: 1390\n", + " p = 52.29% amt: 144000 sats hops: 7 ppm: 1339\n", + " p = 48.05% amt: 93200 sats hops: 7 ppm: 1365\n", + " p = 64.05% amt: 6800 sats hops: 7 ppm: 1366\n", + " p = 71.75% amt: 114800 sats hops: 8 ppm: 1392\n", + " p = 49.71% amt: 100000 sats hops: 9 ppm: 1346\n", + " p = 0.00% amt: 220000 sats hops: 9 ppm: 1363\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 59.12% amt: 138240 sats hops: 2 ppm: 1341 \n", + " p = 0.00% amt: 4869520 sats hops: 2 ppm: 1359 \n", + " p = 5.27% amt: 4300664 sats hops: 3 ppm: 1365 \n", + " p = 28.66% amt: 850000 sats hops: 3 ppm: 1381 \n", + " p = 2.14% amt: 1400000 sats hops: 4 ppm: 1341 \n", + " p = 0.00% amt: 886321 sats hops: 4 ppm: 1378 \n", + " p = 51.42% amt: 192000 sats hops: 4 ppm: 1345 \n", + " p = 51.66% amt: 310000 sats hops: 4 ppm: 1345 \n", + " p = 0.00% amt: 2023904 sats hops: 5 ppm: 1352 \n", + " p = 9.86% amt: 400000 sats hops: 6 ppm: 1352 \n", + " p = 6.10% amt: 400000 sats hops: 6 ppm: 1353 \n", + " p = 0.02% amt: 1657931 sats hops: 6 ppm: 1361 \n", + " p = 62.00% amt: 48000 sats hops: 6 ppm: 1339 \n", + " p = 20.41% amt: 200000 sats hops: 6 ppm: 1341 \n", + " p = 44.51% amt: 147200 sats hops: 7 ppm: 1391 \n", + " p = 11.93% amt: 680000 sats hops: 9 ppm: 1392 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 23795045 sats\n", + "expected to deliver 3022756 sats \t(12.70%)\n", + "actually deliverd 5291265 sats \t(22.24%)\n", + "deviation: 1.75\n", + "planned_fee: 32457.783 sat\n", + "paid fees: 7263.967 sat\n", + "Runtime of flow computation: 0.68 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 4\n", + "Try to deliver 18503780 satoshi:\n", + "\n", + "Statistics about 42 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 98.80% amt: 48000 sats hops: 2 ppm: 1382\n", + " p = 80.00% amt: 32000 sats hops: 2 ppm: 1357\n", + " p = 78.74% amt: 49715 sats hops: 3 ppm: 1362\n", + " p = 30.02% amt: 64000 sats hops: 3 ppm: 1338\n", + " p = 75.45% amt: 46080 sats hops: 3 ppm: 1336\n", + " p = 55.57% amt: 340000 sats hops: 3 ppm: 1381\n", + " p = 77.50% amt: 38400 sats hops: 4 ppm: 1344\n", + " p = 51.91% amt: 573056 sats hops: 4 ppm: 1408\n", + " p = 58.33% amt: 195691 sats hops: 4 ppm: 1389\n", + " p = 51.14% amt: 220000 sats hops: 4 ppm: 1345\n", + " p = 77.26% amt: 47520 sats hops: 4 ppm: 1338\n", + " p = 98.19% amt: 5102 sats hops: 5 ppm: 1384\n", + " p = 45.44% amt: 512000 sats hops: 7 ppm: 1387\n", + " p = 41.48% amt: 3715 sats hops: 7 ppm: 1365\n", + " p = 53.82% amt: 80000 sats hops: 8 ppm: 1355\n", + " p = 30.57% amt: 37292 sats hops: 8 ppm: 1391\n", + " p = 1.18% amt: 1480639 sats hops: 10 ppm: 1368\n", + " p = 0.10% amt: 401195 sats hops: 11 ppm: 1359\n", + " p = 0.00% amt: 71285 sats hops: 12 ppm: 1365\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 0.00% amt: 4869520 sats hops: 2 ppm: 1359 \n", + " p = 0.00% amt: 4300661 sats hops: 3 ppm: 1365 \n", + " p = 31.47% amt: 128000 sats hops: 3 ppm: 1388 \n", + " p = 36.26% amt: 768000 sats hops: 3 ppm: 1416 \n", + " p = 30.59% amt: 98193 sats hops: 4 ppm: 1387 \n", + " p = 31.63% amt: 64016 sats hops: 4 ppm: 1360 \n", + " p = 18.37% amt: 1000000 sats hops: 4 ppm: 1392 \n", + " p = 0.00% amt: 1000000 sats hops: 4 ppm: 1341 \n", + " p = 10.41% amt: 46345 sats hops: 5 ppm: 1349 \n", + " p = 8.61% amt: 60000 sats hops: 5 ppm: 1345 \n", + " p = 7.49% amt: 76800 sats hops: 5 ppm: 1353 \n", + " p = 6.91% amt: 100000 sats hops: 5 ppm: 1394 \n", + " p = 3.23% amt: 275000 sats hops: 5 ppm: 1340 \n", + " p = 3.49% amt: 81749 sats hops: 6 ppm: 1390 \n", + " p = 3.87% amt: 43200 sats hops: 6 ppm: 1338 \n", + " p = 2.92% amt: 74898 sats hops: 6 ppm: 1365 \n", + " p = 1.06% amt: 125000 sats hops: 6 ppm: 1342 \n", + " p = 0.50% amt: 136000 sats hops: 7 ppm: 1392 \n", + " p = 0.00% amt: 50708 sats hops: 7 ppm: 1382 \n", + " p = 52.82% amt: 100000 sats hops: 7 ppm: 1358 \n", + " p = 25.48% amt: 400000 sats hops: 8 ppm: 1382 \n", + " p = 31.31% amt: 400000 sats hops: 8 ppm: 1368 \n", + " p = 70.66% amt: 60000 sats hops: 10 ppm: 1370 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 18503780 sats\n", + "expected to deliver 2172552 sats \t(11.74%)\n", + "actually deliverd 4245690 sats \t(22.94%)\n", + "deviation: 1.95\n", + "planned_fee: 25330.511 sat\n", + "paid fees: 5837.495 sat\n", + "Runtime of flow computation: 0.78 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 5\n", + "Try to deliver 14258090 satoshi:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Statistics about 43 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 79.76% amt: 27648 sats hops: 2 ppm: 1341\n", + " p = 75.73% amt: 36864 sats hops: 3 ppm: 1336\n", + " p = 69.26% amt: 156553 sats hops: 4 ppm: 1389\n", + " p = 66.20% amt: 229666 sats hops: 4 ppm: 1365\n", + " p = 76.74% amt: 35388 sats hops: 4 ppm: 1408\n", + " p = 90.39% amt: 43200 sats hops: 4 ppm: 1343\n", + " p = 88.11% amt: 22127 sats hops: 4 ppm: 1363\n", + " p = 44.52% amt: 200000 sats hops: 5 ppm: 1395\n", + " p = 75.78% amt: 136000 sats hops: 5 ppm: 1395\n", + " p = 90.28% amt: 80000 sats hops: 5 ppm: 1385\n", + " p = 74.40% amt: 2841 sats hops: 6 ppm: 1367\n", + " p = 72.37% amt: 43200 sats hops: 6 ppm: 1342\n", + " p = 72.69% amt: 56250 sats hops: 6 ppm: 1364\n", + " p = 60.91% amt: 136000 sats hops: 7 ppm: 1396\n", + " p = 59.36% amt: 152866 sats hops: 7 ppm: 1386\n", + " p = 2.27% amt: 134091 sats hops: 7 ppm: 1342\n", + " p = 28.40% amt: 225574 sats hops: 7 ppm: 1396\n", + " p = 72.42% amt: 100000 sats hops: 7 ppm: 1368\n", + " p = 73.49% amt: 46345 sats hops: 8 ppm: 1351\n", + " p = 71.67% amt: 19564 sats hops: 8 ppm: 1355\n", + " p = 78.64% amt: 57236 sats hops: 9 ppm: 1368\n", + " p = 3.01% amt: 622190 sats hops: 9 ppm: 1373\n", + " p = 47.37% amt: 35000 sats hops: 9 ppm: 1355\n", + " p = 59.06% amt: 20000 sats hops: 10 ppm: 1341\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 0.00% amt: 4869520 sats hops: 2 ppm: 1359 \n", + " p = 78.75% amt: 39772 sats hops: 3 ppm: 1362 \n", + " p = 66.49% amt: 102000 sats hops: 3 ppm: 1381 \n", + " p = 73.04% amt: 153600 sats hops: 3 ppm: 1415 \n", + " p = 57.15% amt: 1131278 sats hops: 3 ppm: 1380 \n", + " p = 2.12% amt: 2676690 sats hops: 4 ppm: 1374 \n", + " p = 77.48% amt: 38016 sats hops: 4 ppm: 1338 \n", + " p = 0.00% amt: 263027 sats hops: 5 ppm: 1365 \n", + " p = 40.60% amt: 256000 sats hops: 5 ppm: 1388 \n", + " p = 40.61% amt: 51200 sats hops: 5 ppm: 1337 \n", + " p = 44.89% amt: 98566 sats hops: 6 ppm: 1387 \n", + " p = 32.51% amt: 125191 sats hops: 6 ppm: 1360 \n", + " p = 55.18% amt: 2636 sats hops: 6 ppm: 1394 \n", + " p = 34.07% amt: 397159 sats hops: 6 ppm: 1347 \n", + " p = 68.18% amt: 74898 sats hops: 6 ppm: 1369 \n", + " p = 48.80% amt: 170334 sats hops: 7 ppm: 1358 \n", + " p = 6.11% amt: 400000 sats hops: 7 ppm: 1348 \n", + " p = 40.77% amt: 409600 sats hops: 7 ppm: 1391 \n", + " p = 66.72% amt: 60000 sats hops: 9 ppm: 1355 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 13938090 sats\n", + "expected to deliver 2844105 sats \t(20.41%)\n", + "actually deliverd 2618603 sats \t(18.79%)\n", + "deviation: 0.92\n", + "planned_fee: 19087.443 sat\n", + "paid fees: 3604.571 sat\n", + "Runtime of flow computation: 0.78 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 6\n", + "Try to deliver 11319487 satoshi:\n", + "\n", + "Statistics about 34 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 79.22% amt: 38400 sats hops: 2 ppm: 1381\n", + " p = 80.00% amt: 25600 sats hops: 2 ppm: 1356\n", + " p = 67.12% amt: 76032 sats hops: 3 ppm: 1338\n", + " p = 66.72% amt: 37076 sats hops: 3 ppm: 1346\n", + " p = 64.41% amt: 29491 sats hops: 3 ppm: 1336\n", + " p = 79.12% amt: 12134 sats hops: 3 ppm: 1436\n", + " p = 91.20% amt: 36581 sats hops: 4 ppm: 1441\n", + " p = 76.77% amt: 30720 sats hops: 4 ppm: 1344\n", + " p = 65.93% amt: 100000 sats hops: 5 ppm: 1402\n", + " p = 68.50% amt: 81600 sats hops: 5 ppm: 1394\n", + " p = 61.83% amt: 102400 sats hops: 5 ppm: 1344\n", + " p = 69.93% amt: 297031 sats hops: 5 ppm: 1372\n", + " p = 40.33% amt: 400000 sats hops: 5 ppm: 1370\n", + " p = 15.18% amt: 23419 sats hops: 6 ppm: 1370\n", + " p = 0.00% amt: 292247 sats hops: 7 ppm: 1370\n", + " p = 64.10% amt: 50939 sats hops: 7 ppm: 1392\n", + " p = 75.24% amt: 120000 sats hops: 7 ppm: 1388\n", + " p = 66.36% amt: 18939 sats hops: 7 ppm: 1383\n", + " p = 62.92% amt: 61175 sats hops: 8 ppm: 1375\n", + " p = 47.84% amt: 52613 sats hops: 8 ppm: 1355\n", + " p = 38.65% amt: 61440 sats hops: 9 ppm: 1368\n", + " p = 42.20% amt: 35666 sats hops: 10 ppm: 1359\n", + " p = 53.39% amt: 334 sats hops: 10 ppm: 1386\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 0.00% amt: 4869520 sats hops: 2 ppm: 1359 \n", + " p = 73.64% amt: 652283 sats hops: 4 ppm: 1385 \n", + " p = 40.00% amt: 1606014 sats hops: 4 ppm: 1374 \n", + " p = 56.05% amt: 50000 sats hops: 5 ppm: 1350 \n", + " p = 34.41% amt: 400000 sats hops: 6 ppm: 1376 \n", + " p = 11.94% amt: 400000 sats hops: 6 ppm: 1373 \n", + " p = 42.38% amt: 181061 sats hops: 7 ppm: 1389 \n", + " p = 52.32% amt: 268354 sats hops: 7 ppm: 1396 \n", + " p = 34.77% amt: 276666 sats hops: 8 ppm: 1402 \n", + " p = 30.84% amt: 91752 sats hops: 9 ppm: 1373 \n", + " p = 44.52% amt: 220000 sats hops: 10 ppm: 1341 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 10999487 sats\n", + "expected to deliver 2783834 sats \t(25.31%)\n", + "actually deliverd 1983837 sats \t(18.04%)\n", + "deviation: 0.71\n", + "planned_fee: 15060.928 sat\n", + "paid fees: 2723.147 sat\n", + "Runtime of flow computation: 0.72 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 7\n", + "Try to deliver 9015650 satoshi:\n", + "\n", + "Statistics about 21 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 79.81% amt: 22118 sats hops: 2 ppm: 1341\n", + " p = 72.17% amt: 60546 sats hops: 3 ppm: 1351\n", + " p = 79.92% amt: 9556 sats hops: 5 ppm: 1365\n", + " p = 72.39% amt: 65280 sats hops: 5 ppm: 1394\n", + " p = 94.13% amt: 57870 sats hops: 5 ppm: 1381\n", + " p = 80.01% amt: 92187 sats hops: 6 ppm: 1364\n", + " p = 85.05% amt: 25272 sats hops: 6 ppm: 1386\n", + " p = 70.37% amt: 274549 sats hops: 7 ppm: 1370\n", + " p = 57.54% amt: 196212 sats hops: 7 ppm: 1367\n", + " p = 17.55% amt: 776955 sats hops: 7 ppm: 1380\n", + " p = 17.30% amt: 54441 sats hops: 8 ppm: 1372\n", + " p = 6.76% amt: 248800 sats hops: 8 ppm: 1366\n", + " p = 0.00% amt: 171255 sats hops: 9 ppm: 1385\n", + " p = 77.99% amt: 165087 sats hops: 9 ppm: 1401\n", + " p = 51.97% amt: 45092 sats hops: 10 ppm: 1411\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 0.00% amt: 4869520 sats hops: 2 ppm: 1359 \n", + " p = 80.00% amt: 226255 sats hops: 3 ppm: 1380 \n", + " p = 77.38% amt: 53685 sats hops: 3 ppm: 1436 \n", + " p = 60.00% amt: 642404 sats hops: 4 ppm: 1374 \n", + " p = 75.60% amt: 400000 sats hops: 5 ppm: 1386 \n", + " p = 59.89% amt: 98566 sats hops: 10 ppm: 1407 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 8555650 sats\n", + "expected to deliver 1856308 sats \t(21.70%)\n", + "actually deliverd 2265220 sats \t(26.48%)\n", + "deviation: 1.22\n", + "planned_fee: 11710.258 sat\n", + "paid fees: 3121.630 sat\n", + "Runtime of flow computation: 0.84 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 8\n", + "Try to deliver 6290430 satoshi:\n", + "\n", + "Statistics about 6 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 84.62% amt: 60668 sats hops: 5 ppm: 1365\n", + " p = 55.41% amt: 219639 sats hops: 7 ppm: 1370\n", + " p = 11.82% amt: 136570 sats hops: 8 ppm: 1366\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 0.00% amt: 4869520 sats hops: 2 ppm: 1359 \n", + " p = 15.01% amt: 621563 sats hops: 7 ppm: 1380 \n", + " p = 62.40% amt: 62470 sats hops: 9 ppm: 1388 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 5970430 sats\n", + "expected to deliver 321472 sats \t(5.38%)\n", + "actually deliverd 416877 sats \t(6.98%)\n", + "deviation: 1.30\n", + "planned_fee: 8138.373 sat\n", + "paid fees: 570.683 sat\n", + "Runtime of flow computation: 0.69 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 9\n", + "Try to deliver 5553553 satoshi:\n", + "\n", + "Statistics about 11 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 83.11% amt: 62470 sats hops: 7 ppm: 1380\n", + " p = 67.70% amt: 36000 sats hops: 9 ppm: 1393\n", + " p = 69.60% amt: 42091 sats hops: 9 ppm: 1341\n", + " p = 69.27% amt: 15434 sats hops: 11 ppm: 1345\n", + " p = 64.58% amt: 34566 sats hops: 12 ppm: 1345\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 0.00% amt: 4869520 sats hops: 2 ppm: 1359 \n", + " p = 50.90% amt: 131526 sats hops: 7 ppm: 1380 \n", + " p = 80.03% amt: 98566 sats hops: 8 ppm: 1402 \n", + " p = 61.48% amt: 71471 sats hops: 8 ppm: 1406 \n", + " p = 73.38% amt: 127909 sats hops: 10 ppm: 1340 \n", + " p = 46.75% amt: 64000 sats hops: 13 ppm: 1347 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 5553553 sats\n", + "expected to deliver 452146 sats \t(8.14%)\n", + "actually deliverd 190561 sats \t(3.43%)\n", + "deviation: 0.42\n", + "planned_fee: 7560.947 sat\n", + "paid fees: 260.196 sat\n", + "Runtime of flow computation: 0.61 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 10\n", + "Try to deliver 5362992 satoshi:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Statistics about 7 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 84.60% amt: 98566 sats hops: 7 ppm: 1392\n", + " p = 92.80% amt: 64000 sats hops: 7 ppm: 1390\n", + " p = 79.85% amt: 29434 sats hops: 7 ppm: 1396\n", + " p = 53.13% amt: 131472 sats hops: 10 ppm: 1398\n", + " p = 67.23% amt: 106000 sats hops: 11 ppm: 1347\n", + " p = 46.01% amt: 64000 sats hops: 12 ppm: 1347\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 0.00% amt: 4869520 sats hops: 2 ppm: 1359 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 5362992 sats\n", + "expected to deliver 336841 sats \t(6.28%)\n", + "actually deliverd 493472 sats \t(9.20%)\n", + "deviation: 1.46\n", + "planned_fee: 7302.838 sat\n", + "paid fees: 680.292 sat\n", + "Runtime of flow computation: 0.69 sec \n", + "\n", + "================================================================\n", + "\n", + "SUMMARY:\n", + "========\n", + "Rounds of mcf-computations: 10\n", + "Number of onions sent: 276\n", + "Number of failed onions: 128\n", + "Failure rate: 46.38% \n", + "total runtime (including inefficient memory managment): 16.823 sec\n", + "Learnt entropy: 342.98 bits\n", + "Fees for successfull delivery: 47160.204 sat --> 1155 ppm\n", + "used mu: 1000\n" + ] + } + ], + "source": [ + "payment_session = PaymentSession(oracle_lightning_network, \n", + " uncertainty_network,\n", + " prune_network=False)\n", + "payment_session.forget_information()\n", + "\n", + "payment_session.pickhardt_pay(RENE,C_OTTO, AMT,mu=1000, base =0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Make highly reliable payment with the pruned zeroBaseFee network" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Round number: 1\n", + "Try to deliver 40803479 satoshi:\n", + "\n", + "Statistics about 16 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 75.20% amt: 600000 sats hops: 2 ppm: 2572\n", + " p = 52.92% amt: 2800000 sats hops: 3 ppm: 1897\n", + " p = 68.30% amt: 2020000 sats hops: 3 ppm: 1974\n", + " p = 69.25% amt: 630528 sats hops: 4 ppm: 3717\n", + " p = 65.76% amt: 1000000 sats hops: 4 ppm: 2187\n", + " p = 47.42% amt: 3355443 sats hops: 4 ppm: 2496\n", + " p = 96.83% amt: 61199 sats hops: 4 ppm: 2481\n", + " p = 71.04% amt: 640000 sats hops: 4 ppm: 2564\n", + " p = 59.67% amt: 200000 sats hops: 4 ppm: 21787\n", + " p = 43.95% amt: 3000000 sats hops: 5 ppm: 2580\n", + " p = 20.38% amt: 5046329 sats hops: 5 ppm: 2551\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 25.52% amt: 10066329 sats hops: 3 ppm: 2036 \n", + " p = 48.04% amt: 2000000 sats hops: 4 ppm: 2060 \n", + " p = 66.75% amt: 882941 sats hops: 4 ppm: 21456 \n", + " p = 23.08% amt: 3131238 sats hops: 5 ppm: 2057 \n", + " p = 15.80% amt: 5369472 sats hops: 6 ppm: 5317 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 40803479 sats\n", + "expected to deliver 14668352 sats \t(35.95%)\n", + "actually deliverd 19353499 sats \t(47.43%)\n", + "deviation: 1.32\n", + "planned_fee: 129089.913 sat\n", + "paid fees: 50520.602 sat\n", + "Runtime of flow computation: 0.08 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 2\n", + "Try to deliver 21449980 satoshi:\n", + "\n", + "Statistics about 7 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 69.76% amt: 3200000 sats hops: 4 ppm: 2603\n", + " p = 64.67% amt: 2873894 sats hops: 4 ppm: 3717\n", + " p = 79.52% amt: 289859 sats hops: 4 ppm: 21786\n", + " p = 71.38% amt: 2000000 sats hops: 5 ppm: 2060\n", + " p = 70.82% amt: 5562734 sats hops: 6 ppm: 9024\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 60.66% amt: 1342177 sats hops: 5 ppm: 2579 \n", + " p = 45.37% amt: 6181316 sats hops: 7 ppm: 9024 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 21449980 sats\n", + "expected to deliver 13306939 sats \t(62.04%)\n", + "actually deliverd 13926487 sats \t(64.93%)\n", + "deviation: 1.05\n", + "planned_fee: 138902.753 sat\n", + "paid fees: 79653.563 sat\n", + "Runtime of flow computation: 0.08 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 3\n", + "Try to deliver 7523493 satoshi:\n", + "\n", + "Statistics about 2 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 71.73% amt: 1342177 sats hops: 7 ppm: 3251\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 73.37% amt: 6181316 sats hops: 6 ppm: 2878 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 7523493 sats\n", + "expected to deliver 5497966 sats \t(73.08%)\n", + "actually deliverd 1342177 sats \t(17.84%)\n", + "deviation: 0.24\n", + "planned_fee: 22160.764 sat\n", + "paid fees: 4364.757 sat\n", + "Runtime of flow computation: 0.06 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 4\n", + "Try to deliver 6181316 satoshi:\n", + "\n", + "Statistics about 1 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 82.22% amt: 6181316 sats hops: 7 ppm: 2878\n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 6181316 sats\n", + "expected to deliver 5082291 sats \t(82.22%)\n", + "actually deliverd 6181316 sats \t(100.00%)\n", + "deviation: 1.22\n", + "planned_fee: 17796.007 sat\n", + "paid fees: 17796.007 sat\n", + "Runtime of flow computation: 0.04 sec \n", + "\n", + "================================================================\n", + "\n", + "SUMMARY:\n", + "========\n", + "Rounds of mcf-computations: 4\n", + "Number of onions sent: 26\n", + "Number of failed onions: 8\n", + "Failure rate: 30.77% \n", + "total runtime (including inefficient memory managment): 2.382 sec\n", + "Learnt entropy: 36.27 bits\n", + "Fees for successfull delivery: 152334.929 sat --> 3733 ppm\n", + "used mu: 0\n" + ] + } + ], + "source": [ + "payment_session = PaymentSession(oracle_lightning_network, \n", + " uncertainty_network,\n", + " prune_network=True)\n", + "payment_session.forget_information()\n", + "#payment_session.activate_network_wide_uncertainty_reduction(1)\n", + "\n", + "payment_session.pickhardt_pay(RENE,C_OTTO, AMT,mu=0,base=0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Make very cheap payment on the pruned zeroBaseFee Network\n", + "note that pruning still removes unreliable channels thus this method already provides a tradeoff between routing fees and realiability " + ] + }, + { + "cell_type": "code", + "execution_count": 41, "metadata": { "scrolled": false }, @@ -1373,289 +2368,348 @@ "name": "stdout", "output_type": "stream", "text": [ + "Round number: 1\n", + "Try to deliver 40803479 satoshi:\n", + "\n", + "Statistics about 31 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 16.00% amt: 3000000 sats hops: 2 ppm: 1360\n", + " p = 53.36% amt: 500000 sats hops: 4 ppm: 1694\n", + " p = 23.04% amt: 1000000 sats hops: 4 ppm: 1368\n", + " p = 25.75% amt: 1000000 sats hops: 5 ppm: 1357\n", + " p = 11.39% amt: 1862000 sats hops: 5 ppm: 1362\n", + " p = 14.20% amt: 323770 sats hops: 5 ppm: 1349\n", + " p = 41.83% amt: 948823 sats hops: 6 ppm: 1703\n", + " p = 25.28% amt: 800000 sats hops: 6 ppm: 1351\n", + " p = 25.61% amt: 262911 sats hops: 6 ppm: 1496\n", + " p = 20.22% amt: 1075089 sats hops: 7 ppm: 1696\n", + " p = 5.44% amt: 124911 sats hops: 8 ppm: 1696\n", + " p = 22.46% amt: 351177 sats hops: 8 ppm: 1701\n", + " p = 3.18% amt: 4329 sats hops: 11 ppm: 1358\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 25.37% amt: 2737089 sats hops: 3 ppm: 1487 \n", + " p = 26.97% amt: 3000000 sats hops: 3 ppm: 1352 \n", + " p = 14.13% amt: 1920000 sats hops: 3 ppm: 1416 \n", + " p = 14.94% amt: 4462911 sats hops: 3 ppm: 1365 \n", + " p = 21.02% amt: 3000000 sats hops: 4 ppm: 1687 \n", + " p = 29.67% amt: 1200000 sats hops: 4 ppm: 1354 \n", + " p = 30.47% amt: 1000000 sats hops: 4 ppm: 1357 \n", + " p = 16.99% amt: 1023770 sats hops: 4 ppm: 1366 \n", + " p = 16.51% amt: 1000000 sats hops: 5 ppm: 1352 \n", + " p = 10.03% amt: 1000000 sats hops: 5 ppm: 1352 \n", + " p = 7.15% amt: 1476230 sats hops: 5 ppm: 1341 \n", + " p = 21.15% amt: 727407 sats hops: 6 ppm: 1352 \n", + " p = 3.89% amt: 772593 sats hops: 6 ppm: 1344 \n", + " p = 11.56% amt: 1000000 sats hops: 8 ppm: 1350 \n", + " p = 1.52% amt: 3000000 sats hops: 8 ppm: 1687 \n", + " p = 15.75% amt: 848823 sats hops: 8 ppm: 1371 \n", + " p = 33.72% amt: 385975 sats hops: 9 ppm: 1681 \n", + " p = 2.83% amt: 995671 sats hops: 10 ppm: 1671 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 40803479 sats\n", + "expected to deliver 7377468 sats \t(18.08%)\n", + "actually deliverd 11253010 sats \t(27.58%)\n", + "deviation: 1.53\n", + "planned_fee: 59340.376 sat\n", + "paid fees: 16356.277 sat\n", + "Runtime of flow computation: 0.15 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 2\n", + "Try to deliver 29550469 satoshi:\n", + "\n", + "Statistics about 22 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 30.92% amt: 1800000 sats hops: 3 ppm: 1352\n", + " p = 40.00% amt: 2677746 sats hops: 3 ppm: 1365\n", + " p = 40.00% amt: 1800000 sats hops: 4 ppm: 1687\n", + " p = 38.56% amt: 1785165 sats hops: 4 ppm: 1374\n", + " p = 40.34% amt: 337832 sats hops: 4 ppm: 1367\n", + " p = 10.69% amt: 2400000 sats hops: 5 ppm: 1357\n", + " p = 37.93% amt: 1062168 sats hops: 5 ppm: 1838\n", + " p = 13.29% amt: 382204 sats hops: 6 ppm: 1851\n", + " p = 15.58% amt: 817796 sats hops: 7 ppm: 1701\n", + " p = 19.71% amt: 93469 sats hops: 8 ppm: 1693\n", + " p = 21.94% amt: 527118 sats hops: 8 ppm: 1365\n", + " p = 30.98% amt: 72882 sats hops: 9 ppm: 1364\n", + " p = 17.55% amt: 236295 sats hops: 11 ppm: 1363\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 45.52% amt: 1480000 sats hops: 3 ppm: 1381 \n", + " p = 39.40% amt: 356280 sats hops: 4 ppm: 1385 \n", + " p = 12.78% amt: 2822277 sats hops: 5 ppm: 1361 \n", + " p = 19.97% amt: 1762171 sats hops: 6 ppm: 1703 \n", + " p = 3.79% amt: 4857723 sats hops: 6 ppm: 1846 \n", + " p = 6.34% amt: 1689107 sats hops: 8 ppm: 1696 \n", + " p = 10.50% amt: 1099413 sats hops: 8 ppm: 1688 \n", + " p = 10.05% amt: 690823 sats hops: 10 ppm: 1672 \n", + " p = 3.44% amt: 800000 sats hops: 12 ppm: 1364 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 29550469 sats\n", + "expected to deliver 6238145 sats \t(21.11%)\n", + "actually deliverd 13992675 sats \t(47.35%)\n", + "deviation: 2.24\n", + "planned_fee: 45981.602 sat\n", + "paid fees: 20654.766 sat\n", + "Runtime of flow computation: 0.14 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 3\n", + "Try to deliver 15557794 satoshi:\n", + "\n", + "Statistics about 18 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 22.96% amt: 2700000 sats hops: 4 ppm: 1377\n", + " p = 13.94% amt: 151772 sats hops: 5 ppm: 1366\n", + " p = 14.79% amt: 178945 sats hops: 6 ppm: 1479\n", + " p = 40.77% amt: 385975 sats hops: 8 ppm: 1721\n", + " p = 32.65% amt: 34317 sats hops: 9 ppm: 1706\n", + " p = 31.05% amt: 351230 sats hops: 9 ppm: 1711\n", + " p = 14.48% amt: 114453 sats hops: 9 ppm: 1480\n", + " p = 31.43% amt: 385975 sats hops: 10 ppm: 1691\n", + " p = 15.67% amt: 1444 sats hops: 11 ppm: 1376\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 27.43% amt: 1514420 sats hops: 4 ppm: 1385 \n", + " p = 56.43% amt: 1720000 sats hops: 4 ppm: 1376 \n", + " p = 9.79% amt: 1693365 sats hops: 5 ppm: 1361 \n", + " p = 15.70% amt: 1000000 sats hops: 5 ppm: 1382 \n", + " p = 18.84% amt: 1306635 sats hops: 6 ppm: 1714 \n", + " p = 16.64% amt: 1368228 sats hops: 7 ppm: 1701 \n", + " p = 27.13% amt: 1000000 sats hops: 7 ppm: 1707 \n", + " p = 20.75% amt: 938454 sats hops: 7 ppm: 1493 \n", + " p = 16.40% amt: 712581 sats hops: 9 ppm: 1711 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 15557794 sats\n", + "expected to deliver 3848575 sats \t(24.74%)\n", + "actually deliverd 4304111 sats \t(27.67%)\n", + "deviation: 1.12\n", + "planned_fee: 23391.933 sat\n", + "paid fees: 6339.288 sat\n", + "Runtime of flow computation: 0.15 sec \n", "\n", + "================================================================\n", "\n", - "OTPTIMIZE MAINLY FOR FEES use global uncertainty reduction\n", - "\n", - "Try: 50000000 sats. Round number: 1\n", - "\\mu: 100 \n", - "Runtime of flow computation: 1.69 sec \n", - "Success: False \t fee: 15848.460msat \t p = 12.40% amt: 10870000sats path hops: 3\n", - "Success: True \t fee: 2060.480msat \t p = 23.93% amt: 1370000sats path hops: 3\n", - "Success: True \t fee: 1921.250msat \t p = 56.25% amt: 1250000sats path hops: 3\n", - "Success: True \t fee: 1484.580msat \t p = 28.97% amt: 1090000sats path hops: 3\n", - "Success: False \t fee: 231.030msat \t p = 75.48% amt: 170000sats path hops: 3\n", - "Success: False \t fee: 2353.120msat \t p = 24.39% amt: 1760000sats path hops: 3\n", - "Success: False \t fee: 1442.000msat \t p = 51.56% amt: 1000000sats path hops: 3\n", - "Success: True \t fee: 100.660msat \t p = 22.97% amt: 70000sats path hops: 4\n", - "Success: True \t fee: 499.500msat \t p = 56.27% amt: 370000sats path hops: 4\n", - "Success: True \t fee: 4674.330msat \t p = 14.77% amt: 3110000sats path hops: 4\n", - "Success: False \t fee: 512.240msat \t p = 40.68% amt: 380000sats path hops: 4\n", - "Success: False \t fee: 176.800msat \t p = 59.82% amt: 130000sats path hops: 4\n", - "Success: False \t fee: 2823.180msat \t p = 18.47% amt: 2110000sats path hops: 4\n", - "Success: True \t fee: 902.850msat \t p = 15.53% amt: 650000sats path hops: 4\n", - "Success: True \t fee: 344.750msat \t p = 65.31% amt: 250000sats path hops: 4\n", - "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", - "Success: True \t fee: 172.680msat \t p = 66.35% amt: 120000sats path hops: 4\n", - "Success: False \t fee: 991.600msat \t p = 39.26% amt: 740000sats path hops: 4\n", - "Success: False \t fee: 2277.000msat \t p = 58.12% amt: 1500000sats path hops: 4\n", - "Success: True \t fee: 890.940msat \t p = 9.35% amt: 620000sats path hops: 5\n", - "Success: True \t fee: 162.840msat \t p = 80.32% amt: 120000sats path hops: 5\n", - "Success: True \t fee: 354.250msat \t p = 86.43% amt: 250000sats path hops: 5\n", - "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", - "Success: True \t fee: 172.080msat \t p = 39.68% amt: 120000sats path hops: 5\n", - "Success: True \t fee: 726.240msat \t p = 37.74% amt: 510000sats path hops: 5\n", - "Success: True \t fee: 14.190msat \t p = 47.28% amt: 10000sats path hops: 5\n", - "Success: True \t fee: 333.600msat \t p = 69.49% amt: 240000sats path hops: 5\n", - "Success: True \t fee: 372.600msat \t p = 5.46% amt: 270000sats path hops: 5\n", - "Success: True \t fee: 539.090msat \t p = 19.96% amt: 370000sats path hops: 5\n", - "Success: False \t fee: 1101.000msat \t p = 63.84% amt: 750000sats path hops: 5\n", - "Success: True \t fee: 28.480msat \t p = 79.65% amt: 20000sats path hops: 5\n", - "Success: True \t fee: 249.560msat \t p = 64.93% amt: 170000sats path hops: 5\n", - "Success: False \t fee: 1541.400msat \t p = 32.09% amt: 1050000sats path hops: 5\n", - "Success: True \t fee: 1032.750msat \t p = 27.10% amt: 750000sats path hops: 5\n", - "Success: True \t fee: 13.800msat \t p = 63.04% amt: 10000sats path hops: 5\n", - "Success: False \t fee: 27.200msat \t p = 86.93% amt: 20000sats path hops: 5\n", - "Success: True \t fee: 95.830msat \t p = 42.71% amt: 70000sats path hops: 5\n", - "Success: True \t fee: 67.300msat \t p = 78.71% amt: 50000sats path hops: 5\n", - "Success: True \t fee: 28.180msat \t p = 67.55% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 13.690msat \t p = 64.06% amt: 10000sats path hops: 6\n", - "Success: True \t fee: 27.280msat \t p = 75.81% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 13.590msat \t p = 87.95% amt: 10000sats path hops: 6\n", - "Success: True \t fee: 968.100msat \t p = 6.90% amt: 700000sats path hops: 6\n", - "Success: True \t fee: 173.760msat \t p = 67.60% amt: 120000sats path hops: 6\n", - "Success: True \t fee: 166.680msat \t p = 53.11% amt: 120000sats path hops: 6\n", - "Success: True \t fee: 97.930msat \t p = 53.46% amt: 70000sats path hops: 6\n", - "Success: True \t fee: 56.760msat \t p = 54.58% amt: 40000sats path hops: 6\n", - "Success: True \t fee: 140.800msat \t p = 66.30% amt: 100000sats path hops: 6\n", - "Success: True \t fee: 258.230msat \t p = 45.01% amt: 170000sats path hops: 6\n", - "Success: True \t fee: 172.800msat \t p = 61.97% amt: 120000sats path hops: 6\n", - "Success: True \t fee: 15.020msat \t p = 73.97% amt: 10000sats path hops: 6\n", - "Success: True \t fee: 209.020msat \t p = 78.91% amt: 140000sats path hops: 6\n", - "Success: True \t fee: 68.000msat \t p = 42.73% amt: 50000sats path hops: 6\n", - "Success: True \t fee: 340.000msat \t p = 20.74% amt: 250000sats path hops: 6\n", - "Success: True \t fee: 339.500msat \t p = 56.36% amt: 250000sats path hops: 6\n", - "Success: True \t fee: 94.080msat \t p = 25.35% amt: 70000sats path hops: 6\n", - "Success: True \t fee: 26.880msat \t p = 73.73% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 373.250msat \t p = 27.69% amt: 250000sats path hops: 6\n", - "Success: True \t fee: 13.690msat \t p = 87.57% amt: 10000sats path hops: 7\n", - "Success: True \t fee: 214.200msat \t p = 38.47% amt: 150000sats path hops: 7\n", - "Success: True \t fee: 1488.900msat \t p = 19.20% amt: 1050000sats path hops: 7\n", - "Success: True \t fee: 1909.500msat \t p = 15.63% amt: 1340000sats path hops: 7\n", - "Success: True \t fee: 301.770msat \t p = 59.62% amt: 210000sats path hops: 7\n", - "Success: True \t fee: 855.000msat \t p = 43.54% amt: 600000sats path hops: 7\n", - "Success: True \t fee: 693.600msat \t p = 56.43% amt: 480000sats path hops: 7\n", - "Success: True \t fee: 1317.810msat \t p = 31.18% amt: 930000sats path hops: 7\n", - "Success: True \t fee: 1361.220msat \t p = 43.46% amt: 980000sats path hops: 7\n", - "Success: True \t fee: 124.830msat \t p = 88.73% amt: 90000sats path hops: 7\n", - "Success: True \t fee: 679.360msat \t p = 36.42% amt: 440000sats path hops: 7\n", - "Success: True \t fee: 75.700msat \t p = 41.73% amt: 50000sats path hops: 7\n", - "Success: True \t fee: 14.940msat \t p = 97.88% amt: 10000sats path hops: 7\n", - "Success: True \t fee: 746.000msat \t p = 36.23% amt: 500000sats path hops: 7\n", - "Success: False \t fee: 73.300msat \t p = 58.07% amt: 50000sats path hops: 7\n", - "Success: True \t fee: 1020.000msat \t p = 34.36% amt: 680000sats path hops: 7\n", - "Success: True \t fee: 13.760msat \t p = 95.38% amt: 10000sats path hops: 7\n", - "Success: True \t fee: 151.360msat \t p = 59.82% amt: 110000sats path hops: 8\n", - "Success: True \t fee: 161.370msat \t p = 72.01% amt: 110000sats path hops: 8\n", - "Success: True \t fee: 93.870msat \t p = 21.86% amt: 70000sats path hops: 8\n", - "Success: True \t fee: 95.270msat \t p = 9.51% amt: 70000sats path hops: 8\n", - "Success: False \t fee: 164.450msat \t p = 76.36% amt: 110000sats path hops: 8\n", - "Success: True \t fee: 179.520msat \t p = 43.82% amt: 120000sats path hops: 8\n", - "Success: True \t fee: 14.950msat \t p = 98.77% amt: 10000sats path hops: 8\n", - "Success: False \t fee: 14.410msat \t p = 63.12% amt: 10000sats path hops: 8\n", - "Success: True \t fee: 14.940msat \t p = 44.42% amt: 10000sats path hops: 9\n", - "Success: True \t fee: 14.080msat \t p = 86.65% amt: 10000sats path hops: 9\n", - "Success: True \t fee: 731.080msat \t p = 71.19% amt: 490000sats path hops: 9\n", - "Success: True \t fee: 269.280msat \t p = 58.32% amt: 180000sats path hops: 9\n", - "Success: True \t fee: 15.030msat \t p = 98.41% amt: 10000sats path hops: 9\n", - "Success: True \t fee: 2121.480msat \t p = 27.28% amt: 1420000sats path hops: 9\n", - "Success: True \t fee: 865.940msat \t p = 46.69% amt: 580000sats path hops: 9\n", - "Success: True \t fee: 179.140msat \t p = 66.57% amt: 130000sats path hops: 9\n", - "Success: True \t fee: 418.600msat \t p = 58.19% amt: 280000sats path hops: 9\n", - "Success: True \t fee: 233.760msat \t p = 55.87% amt: 160000sats path hops: 9\n", - "Success: True \t fee: 326.600msat \t p = 37.16% amt: 230000sats path hops: 9\n", - "Success: True \t fee: 149.930msat \t p = 60.66% amt: 110000sats path hops: 9\n", - "Success: True \t fee: 99.540msat \t p = 27.92% amt: 70000sats path hops: 9\n", - "Success: True \t fee: 28.880msat \t p = 91.35% amt: 20000sats path hops: 9\n", - "Success: True \t fee: 286.600msat \t p = 25.73% amt: 200000sats path hops: 10\n", - "Success: True \t fee: 118.480msat \t p = 55.98% amt: 80000sats path hops: 10\n", - "Success: True \t fee: 249.300msat \t p = 34.12% amt: 180000sats path hops: 10\n", - "Success: True \t fee: 67.900msat \t p = 63.60% amt: 50000sats path hops: 10\n", - "Success: True \t fee: 70.050msat \t p = 40.18% amt: 50000sats path hops: 10\n", - "Success: True \t fee: 29.900msat \t p = 95.17% amt: 20000sats path hops: 10\n", - "Success: True \t fee: 102.340msat \t p = 53.99% amt: 70000sats path hops: 10\n", - "Success: True \t fee: 54.840msat \t p = 91.63% amt: 40000sats path hops: 10\n", - "Success: True \t fee: 181.350msat \t p = 64.18% amt: 130000sats path hops: 10\n", - "Success: True \t fee: 350.000msat \t p = 8.12% amt: 250000sats path hops: 10\n", - "Success: True \t fee: 68.900msat \t p = 35.41% amt: 50000sats path hops: 11\n", - "Success: True \t fee: 332.350msat \t p = 31.39% amt: 230000sats path hops: 11\n", - "Success: True \t fee: 101.150msat \t p = 50.67% amt: 70000sats path hops: 11\n", - "Success: True \t fee: 71.300msat \t p = 58.72% amt: 50000sats path hops: 11\n", - "Success: True \t fee: 513.740msat \t p = 24.29% amt: 340000sats path hops: 11\n", - "Success: True \t fee: 374.920msat \t p = 12.23% amt: 260000sats path hops: 12\n", - "Success: True \t fee: 174.120msat \t p = 46.73% amt: 120000sats path hops: 12\n", - "Success: True \t fee: 76.200msat \t p = 34.17% amt: 50000sats path hops: 14\n", - "Success: True \t fee: 29.940msat \t p = 88.08% amt: 20000sats path hops: 14\n", - "Success: True \t fee: 28.840msat \t p = 93.74% amt: 20000sats path hops: 14\n", - "Success: True \t fee: 72.750msat \t p = 14.02% amt: 50000sats path hops: 15\n", - "Success: True \t fee: 28.860msat \t p = 92.67% amt: 20000sats path hops: 16\n", - "Success: True \t fee: 14.050msat \t p = 90.19% amt: 10000sats path hops: 17\n", - "Success: True \t fee: 14.020msat \t p = 84.74% amt: 10000sats path hops: 17\n", - "Success: True \t fee: 135.900msat \t p = 37.13% amt: 90000sats path hops: 17\n", - "Success: True \t fee: 30.200msat \t p = 66.28% amt: 20000sats path hops: 17\n", - "Success: True \t fee: 70.250msat \t p = 32.81% amt: 50000sats path hops: 17\n", - "Success: True \t fee: 287.470msat \t p = 34.45% amt: 190000sats path hops: 17\n", - "Success: True \t fee: 30.260msat \t p = 57.76% amt: 20000sats path hops: 17\n", - "Success: True \t fee: 71.100msat \t p = 41.04% amt: 50000sats path hops: 18\n", - "total_fee: 71998.910 msat \t paid fees: 42421.720 msat\n", - "\n", - "Try: 20650000 sats. Round number: 2\n" + "Round number: 4\n", + "Try to deliver 11253683 satoshi:\n", + "\n", + "Statistics about 16 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 66.61% amt: 800000 sats hops: 6 ppm: 1735\n", + " p = 81.63% amt: 189855 sats hops: 6 ppm: 1729\n", + " p = 35.18% amt: 609357 sats hops: 6 ppm: 1870\n", + " p = 86.50% amt: 367455 sats hops: 7 ppm: 1871\n", + " p = 27.87% amt: 1555350 sats hops: 8 ppm: 1721\n", + " p = 18.94% amt: 236320 sats hops: 9 ppm: 1726\n", + " p = 53.07% amt: 129645 sats hops: 12 ppm: 1509\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 25.55% amt: 3101233 sats hops: 4 ppm: 1393 \n", + " p = 51.03% amt: 600000 sats hops: 5 ppm: 1725 \n", + " p = 11.80% amt: 1097676 sats hops: 5 ppm: 1385 \n", + " p = 76.00% amt: 310145 sats hops: 7 ppm: 1872 \n", + " p = 14.89% amt: 812878 sats hops: 9 ppm: 1721 \n", + " p = 27.77% amt: 476261 sats hops: 9 ppm: 1712 \n", + " p = 41.83% amt: 123739 sats hops: 12 ppm: 1500 \n", + " p = 14.79% amt: 243769 sats hops: 13 ppm: 1514 \n", + " p = 3.68% amt: 600000 sats hops: 15 ppm: 1503 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 11253683 sats\n", + "expected to deliver 3594151 sats \t(31.94%)\n", + "actually deliverd 3887982 sats \t(34.55%)\n", + "deviation: 1.08\n", + "planned_fee: 17959.450 sat\n", + "paid fees: 6826.617 sat\n", + "Runtime of flow computation: 0.15 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 5\n", + "Try to deliver 7365701 satoshi:\n", + "\n", + "Statistics about 15 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 31.95% amt: 2321413 sats hops: 4 ppm: 1393\n", + " p = 70.35% amt: 503082 sats hops: 5 ppm: 1431\n", + " p = 63.20% amt: 337361 sats hops: 6 ppm: 1720\n", + " p = 67.09% amt: 136918 sats hops: 7 ppm: 1540\n", + " p = 75.15% amt: 183727 sats hops: 8 ppm: 1726\n", + " p = 55.70% amt: 354517 sats hops: 8 ppm: 1416\n", + " p = 41.98% amt: 168149 sats hops: 8 ppm: 1424\n", + " p = 19.97% amt: 954874 sats hops: 10 ppm: 1401\n", + " p = 5.92% amt: 474071 sats hops: 11 ppm: 1388\n", + " p = 6.02% amt: 40706 sats hops: 11 ppm: 1401\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 49.64% amt: 812878 sats hops: 6 ppm: 1728 \n", + " p = 44.37% amt: 84776 sats hops: 6 ppm: 1733 \n", + " p = 40.78% amt: 230590 sats hops: 7 ppm: 1542 \n", + " p = 21.04% amt: 162639 sats hops: 10 ppm: 1392 \n", + " p = 1.94% amt: 600000 sats hops: 14 ppm: 1497 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 7365701 sats\n", + "expected to deliver 2609062 sats \t(35.42%)\n", + "actually deliverd 5474818 sats \t(74.33%)\n", + "deviation: 2.10\n", + "planned_fee: 10894.582 sat\n", + "paid fees: 7861.570 sat\n", + "Runtime of flow computation: 0.14 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 6\n", + "Try to deliver 1890883 satoshi:\n", + "\n", + "Statistics about 5 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 65.93% amt: 122427 sats hops: 8 ppm: 1734\n", + " p = 63.63% amt: 103706 sats hops: 9 ppm: 1734\n", + " p = 69.50% amt: 251872 sats hops: 12 ppm: 1522\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 70.45% amt: 812878 sats hops: 8 ppm: 1729 \n", + " p = 14.29% amt: 600000 sats hops: 15 ppm: 1507 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 1890883 sats\n", + "expected to deliver 980189 sats \t(51.84%)\n", + "actually deliverd 478005 sats \t(25.28%)\n", + "deviation: 0.49\n", + "planned_fee: 3086.407 sat\n", + "paid fees: 775.931 sat\n", + "Runtime of flow computation: 0.14 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 7\n", + "Try to deliver 1412878 satoshi:\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "\\mu: 100 \n", - "Runtime of flow computation: 1.13 sec \n", - "Success: True \t fee: 1484.580msat \t p = 28.97% amt: 1090000sats path hops: 3\n", - "Success: True \t fee: 217.440msat \t p = 76.84% amt: 160000sats path hops: 3\n", - "Success: False \t fee: 2179.310msat \t p = 29.13% amt: 1630000sats path hops: 3\n", - "Success: True \t fee: 100.660msat \t p = 22.97% amt: 70000sats path hops: 4\n", - "Success: True \t fee: 499.500msat \t p = 56.27% amt: 370000sats path hops: 4\n", - "Success: True \t fee: 350.480msat \t p = 56.01% amt: 260000sats path hops: 4\n", - "Success: False \t fee: 2542.200msat \t p = 24.06% amt: 1900000sats path hops: 4\n", - "Success: True \t fee: 93.660msat \t p = 70.58% amt: 70000sats path hops: 4\n", - "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", - "Success: True \t fee: 172.680msat \t p = 66.35% amt: 120000sats path hops: 4\n", - "Success: False \t fee: 938.000msat \t p = 41.95% amt: 700000sats path hops: 4\n", - "Success: True \t fee: 804.720msat \t p = 13.16% amt: 560000sats path hops: 5\n", - "Success: True \t fee: 474.950msat \t p = 50.35% amt: 350000sats path hops: 5\n", - "Success: True \t fee: 566.800msat \t p = 78.90% amt: 400000sats path hops: 5\n", - "Success: True \t fee: 886.600msat \t p = 13.82% amt: 650000sats path hops: 5\n", - "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", - "Success: True \t fee: 28.460msat \t p = 45.04% amt: 20000sats path hops: 5\n", - "Success: True \t fee: 512.640msat \t p = 52.20% amt: 360000sats path hops: 5\n", - "Success: True \t fee: 67.300msat \t p = 78.71% amt: 50000sats path hops: 5\n", - "Success: True \t fee: 27.400msat \t p = 79.00% amt: 20000sats path hops: 5\n", - "Success: True \t fee: 27.680msat \t p = 70.69% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 27.280msat \t p = 75.81% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 54.400msat \t p = 52.94% amt: 40000sats path hops: 6\n", - "Success: True \t fee: 340.000msat \t p = 20.74% amt: 250000sats path hops: 6\n", - "Success: True \t fee: 968.100msat \t p = 6.90% amt: 700000sats path hops: 6\n", - "Success: True \t fee: 173.760msat \t p = 67.60% amt: 120000sats path hops: 6\n", - "Success: True \t fee: 141.500msat \t p = 49.79% amt: 100000sats path hops: 6\n", - "Success: True \t fee: 215.100msat \t p = 72.66% amt: 150000sats path hops: 6\n", - "Success: True \t fee: 14.000msat \t p = 47.45% amt: 10000sats path hops: 6\n", - "Success: True \t fee: 94.080msat \t p = 25.35% amt: 70000sats path hops: 6\n", - "Success: True \t fee: 68.050msat \t p = 76.63% amt: 50000sats path hops: 6\n", - "Success: True \t fee: 1040.250msat \t p = 18.68% amt: 750000sats path hops: 6\n", - "Success: True \t fee: 13.990msat \t p = 92.20% amt: 10000sats path hops: 6\n", - "Success: True \t fee: 26.880msat \t p = 73.73% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 544.050msat \t p = 46.97% amt: 390000sats path hops: 7\n", - "Success: True \t fee: 13.710msat \t p = 43.05% amt: 10000sats path hops: 7\n", - "Success: True \t fee: 114.240msat \t p = 64.00% amt: 80000sats path hops: 7\n", - "Success: True \t fee: 27.380msat \t p = 75.72% amt: 20000sats path hops: 7\n", - "Success: True \t fee: 470.250msat \t p = 67.28% amt: 330000sats path hops: 7\n", - "Success: True \t fee: 855.000msat \t p = 43.54% amt: 600000sats path hops: 7\n", - "Success: True \t fee: 510.480msat \t p = 62.17% amt: 360000sats path hops: 7\n", - "Success: True \t fee: 165.360msat \t p = 57.92% amt: 120000sats path hops: 7\n", - "Success: False \t fee: 2569.650msat \t p = 17.54% amt: 1850000sats path hops: 7\n", - "Success: True \t fee: 226.720msat \t p = 88.00% amt: 160000sats path hops: 7\n", - "Success: True \t fee: 707.500msat \t p = 48.74% amt: 500000sats path hops: 7\n", - "Success: True \t fee: 95.270msat \t p = 9.51% amt: 70000sats path hops: 8\n", - "Success: True \t fee: 212.250msat \t p = 86.65% amt: 150000sats path hops: 8\n", - "Success: True \t fee: 327.980msat \t p = 63.79% amt: 230000sats path hops: 8\n", - "Success: True \t fee: 28.340msat \t p = 98.23% amt: 20000sats path hops: 8\n", - "Success: True \t fee: 1232.790msat \t p = 35.71% amt: 870000sats path hops: 8\n", - "Success: True \t fee: 651.360msat \t p = 48.47% amt: 460000sats path hops: 8\n", - "Success: True \t fee: 93.940msat \t p = 21.06% amt: 70000sats path hops: 8\n", - "Success: True \t fee: 164.160msat \t p = 26.66% amt: 120000sats path hops: 9\n", - "Success: True \t fee: 68.100msat \t p = 37.01% amt: 50000sats path hops: 9\n", - "Success: True \t fee: 179.140msat \t p = 66.57% amt: 130000sats path hops: 9\n", - "Success: True \t fee: 83.340msat \t p = 44.50% amt: 60000sats path hops: 9\n", - "Success: True \t fee: 70.450msat \t p = 35.18% amt: 50000sats path hops: 9\n", - "Success: True \t fee: 355.000msat \t p = 33.25% amt: 250000sats path hops: 9\n", - "Success: True \t fee: 99.540msat \t p = 27.92% amt: 70000sats path hops: 9\n", - "Success: True \t fee: 27.240msat \t p = 89.33% amt: 20000sats path hops: 10\n", - "Success: True \t fee: 13.620msat \t p = 95.64% amt: 10000sats path hops: 10\n", - "Success: True \t fee: 490.320msat \t p = 16.43% amt: 360000sats path hops: 10\n", - "Success: True \t fee: 67.900msat \t p = 63.60% amt: 50000sats path hops: 10\n", - "Success: True \t fee: 249.300msat \t p = 34.12% amt: 180000sats path hops: 10\n", - "Success: True \t fee: 286.600msat \t p = 25.73% amt: 200000sats path hops: 10\n", - "Success: True \t fee: 178.230msat \t p = 74.95% amt: 130000sats path hops: 10\n", - "Success: True \t fee: 288.960msat \t p = 17.44% amt: 210000sats path hops: 10\n", - "Success: True \t fee: 27.400msat \t p = 81.30% amt: 20000sats path hops: 11\n", - "Success: True \t fee: 55.040msat \t p = 70.06% amt: 40000sats path hops: 11\n", - "Success: True \t fee: 42.030msat \t p = 57.56% amt: 30000sats path hops: 11\n", - "Success: True \t fee: 67.700msat \t p = 34.09% amt: 50000sats path hops: 12\n", - "Success: True \t fee: 85.260msat \t p = 72.16% amt: 60000sats path hops: 12\n", - "Success: True \t fee: 369.720msat \t p = 6.48% amt: 260000sats path hops: 13\n", - "Success: True \t fee: 142.300msat \t p = 61.87% amt: 100000sats path hops: 14\n", - "Success: True \t fee: 13.650msat \t p = 78.28% amt: 10000sats path hops: 14\n", - "Success: True \t fee: 94.780msat \t p = 37.30% amt: 70000sats path hops: 14\n", - "Success: True \t fee: 40.950msat \t p = 79.93% amt: 30000sats path hops: 14\n", - "Success: True \t fee: 13.650msat \t p = 61.84% amt: 10000sats path hops: 14\n", - "Success: True \t fee: 28.080msat \t p = 82.16% amt: 20000sats path hops: 15\n", - "Success: True \t fee: 40.860msat \t p = 71.38% amt: 30000sats path hops: 15\n", - "Success: True \t fee: 70.200msat \t p = 33.78% amt: 50000sats path hops: 15\n", - "Success: True \t fee: 27.240msat \t p = 65.31% amt: 20000sats path hops: 15\n", - "Success: True \t fee: 27.060msat \t p = 55.86% amt: 20000sats path hops: 15\n", - "Success: True \t fee: 99.470msat \t p = 33.11% amt: 70000sats path hops: 16\n", - "Success: True \t fee: 71.050msat \t p = 42.26% amt: 50000sats path hops: 16\n", - "total_fee: 28528.620 msat \t paid fees: 20299.460 msat\n", - "\n", - "Try: 6080000 sats. Round number: 3\n", - "\\mu: 100 \n", - "Runtime of flow computation: 1.18 sec \n", - "Success: True \t fee: 108.720msat \t p = 88.09% amt: 80000sats path hops: 3\n", - "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", - "Success: True \t fee: 499.500msat \t p = 56.27% amt: 370000sats path hops: 4\n", - "Success: True \t fee: 2180.940msat \t p = 31.99% amt: 1630000sats path hops: 4\n", - "Success: True \t fee: 93.660msat \t p = 70.58% amt: 70000sats path hops: 4\n", - "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", - "Success: True \t fee: 108.720msat \t p = 56.07% amt: 80000sats path hops: 5\n", - "Success: True \t fee: 284.970msat \t p = 67.44% amt: 210000sats path hops: 5\n", - "Success: True \t fee: 335.250msat \t p = 16.30% amt: 250000sats path hops: 5\n", - "Success: True \t fee: 27.180msat \t p = 76.38% amt: 20000sats path hops: 6\n", - "Success: True \t fee: 189.980msat \t p = 70.77% amt: 140000sats path hops: 6\n", - "Success: True \t fee: 348.400msat \t p = 59.16% amt: 260000sats path hops: 6\n", - "Success: True \t fee: 93.870msat \t p = 22.20% amt: 70000sats path hops: 6\n", - "Success: True \t fee: 635.910msat \t p = 48.72% amt: 470000sats path hops: 7\n", - "Success: True \t fee: 378.840msat \t p = 55.62% amt: 280000sats path hops: 8\n", - "Success: True \t fee: 93.870msat \t p = 23.85% amt: 70000sats path hops: 8\n", - "Success: True \t fee: 26.820msat \t p = 72.44% amt: 20000sats path hops: 8\n", - "Success: True \t fee: 27.180msat \t p = 83.23% amt: 20000sats path hops: 9\n", - "Success: True \t fee: 67.850msat \t p = 63.39% amt: 50000sats path hops: 9\n", - "Success: True \t fee: 67.650msat \t p = 37.37% amt: 50000sats path hops: 10\n", - "Success: True \t fee: 67.400msat \t p = 40.44% amt: 50000sats path hops: 11\n", - "Success: True \t fee: 26.960msat \t p = 61.88% amt: 20000sats path hops: 11\n", - "Success: True \t fee: 27.000msat \t p = 57.58% amt: 20000sats path hops: 12\n", - "Success: True \t fee: 67.200msat \t p = 25.49% amt: 50000sats path hops: 12\n", - "total_fee: 8166.750 msat \t paid fees: 8166.750 msat\n", + "\n", + "Statistics about 6 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 96.79% amt: 59535 sats hops: 6 ppm: 1734\n", + " p = 88.68% amt: 300878 sats hops: 7 ppm: 1731\n", + " p = 87.79% amt: 59535 sats hops: 12 ppm: 1713\n", + " p = 79.95% amt: 66401 sats hops: 12 ppm: 1718\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 69.88% amt: 452465 sats hops: 8 ppm: 1727 \n", + " p = 18.98% amt: 474064 sats hops: 15 ppm: 1506 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 1412878 sats\n", + "expected to deliver 835933 sats \t(59.17%)\n", + "actually deliverd 486349 sats \t(34.42%)\n", + "deviation: 0.58\n", + "planned_fee: 2336.861 sat\n", + "paid fees: 840.593 sat\n", + "Runtime of flow computation: 0.13 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 8\n", + "Try to deliver 926529 satoshi:\n", + "\n", + "Statistics about 3 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 70.49% amt: 420981 sats hops: 7 ppm: 1726\n", + " p = 68.96% amt: 53083 sats hops: 10 ppm: 1519\n", + " p = 34.73% amt: 452465 sats hops: 15 ppm: 1508\n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 926529 sats\n", + "expected to deliver 490492 sats \t(52.94%)\n", + "actually deliverd 926529 sats \t(100.00%)\n", + "deviation: 1.89\n", + "planned_fee: 1490.479 sat\n", + "paid fees: 1490.479 sat\n", + "Runtime of flow computation: 0.15 sec \n", + "\n", + "================================================================\n", "\n", "SUMMARY:\n", - "Rounds of mcf-computations: 3\n", - "Number of onions sent: 236\n", - "Number of failed onions: 19 failure rate: 8.05% \n", - "total runtime (including inefficient memory managment): 4.032 sec\n", - "Learnt entropy: 169.60 bits\n", - "Fees for successfull delivery: 70887.930 sat --> 1417 ppm\n" + "========\n", + "Rounds of mcf-computations: 8\n", + "Number of onions sent: 116\n", + "Number of failed onions: 54\n", + "Failure rate: 46.55% \n", + "total runtime (including inefficient memory managment): 4.760 sec\n", + "Learnt entropy: 172.38 bits\n", + "Fees for successfull delivery: 61145.521 sat --> 1498 ppm\n", + "used mu: 1000\n" ] } ], "source": [ - " \n", - "print(\"\\n\\nOTPTIMIZE MAINLY FOR FEES use global uncertainty reduction\")\n", - "oracle.reset_uncertainty_network()\n", - "oracle.activate_network_wide_uncertainty_reduction(2)\n", - "run_pickhardt_payments_experiment(oracle,RENE,C_OTTO,AMT,mu=100,base=0)\n", - "\n" + "payment_session = PaymentSession(oracle_lightning_network, \n", + " uncertainty_network,\n", + " prune_network=True)\n", + "payment_session.forget_information()\n", + "payment_session.pickhardt_pay(RENE,C_OTTO, AMT,mu=1000,base=0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Test the effect of network wide probing and using that information for cheap payments" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 44, "metadata": { "scrolled": false }, @@ -1664,114 +2718,493 @@ "name": "stdout", "output_type": "stream", "text": [ + "Round number: 1\n", + "Try to deliver 40803479 satoshi:\n", + "\n", + "Statistics about 61 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 25.00% amt: 3750000 sats hops: 2 ppm: 1360\n", + " p = 100.00% amt: 950000 sats hops: 3 ppm: 1687\n", + " p = 73.38% amt: 869527 sats hops: 3 ppm: 1365\n", + " p = 55.07% amt: 1000000 sats hops: 3 ppm: 1488\n", + " p = 60.51% amt: 500000 sats hops: 3 ppm: 1438\n", + " p = 43.28% amt: 1417904 sats hops: 3 ppm: 1351\n", + " p = 64.00% amt: 500000 sats hops: 4 ppm: 1357\n", + " p = 100.00% amt: 2500000 sats hops: 4 ppm: 1368\n", + " p = 40.00% amt: 188642 sats hops: 5 ppm: 1367\n", + " p = 75.00% amt: 3125000 sats hops: 5 ppm: 1357\n", + " p = 100.00% amt: 800000 sats hops: 5 ppm: 1359\n", + " p = 80.00% amt: 500000 sats hops: 5 ppm: 1354\n", + " p = 75.18% amt: 332363 sats hops: 5 ppm: 1351\n", + " p = 25.03% amt: 1102233 sats hops: 5 ppm: 1366\n", + " p = 88.77% amt: 561358 sats hops: 6 ppm: 1368\n", + " p = 68.33% amt: 250000 sats hops: 6 ppm: 1445\n", + " p = 64.84% amt: 63642 sats hops: 6 ppm: 1354\n", + " p = 77.56% amt: 240000 sats hops: 6 ppm: 1553\n", + " p = 98.58% amt: 343981 sats hops: 6 ppm: 1501\n", + " p = 72.39% amt: 187500 sats hops: 7 ppm: 1453\n", + " p = 73.72% amt: 500000 sats hops: 7 ppm: 1496\n", + " p = 93.64% amt: 122500 sats hops: 7 ppm: 1487\n", + " p = 45.46% amt: 500000 sats hops: 7 ppm: 1496\n", + " p = 75.00% amt: 500000 sats hops: 7 ppm: 1367\n", + " p = 76.84% amt: 500000 sats hops: 7 ppm: 1371\n", + " p = 52.65% amt: 104305 sats hops: 8 ppm: 1375\n", + " p = 50.58% amt: 186142 sats hops: 8 ppm: 1373\n", + " p = 67.41% amt: 175000 sats hops: 8 ppm: 1366\n", + " p = 46.39% amt: 5411 sats hops: 9 ppm: 1365\n", + " p = 66.21% amt: 263858 sats hops: 9 ppm: 1371\n", + " p = 61.92% amt: 125000 sats hops: 9 ppm: 1377\n", + " p = 14.99% amt: 60889 sats hops: 10 ppm: 1377\n", + " p = 21.31% amt: 71142 sats hops: 10 ppm: 1368\n", + " p = 80.00% amt: 131358 sats hops: 10 ppm: 1345\n", + " p = 70.00% amt: 236142 sats hops: 10 ppm: 1351\n", + " p = 40.27% amt: 444589 sats hops: 10 ppm: 1372\n", + " p = 18.75% amt: 37500 sats hops: 11 ppm: 1355\n", + " p = 50.92% amt: 150000 sats hops: 11 ppm: 1379\n", + " p = 50.00% amt: 50000 sats hops: 12 ppm: 1384\n", + " p = 37.50% amt: 312500 sats hops: 14 ppm: 1369\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 27.13% amt: 375000 sats hops: 3 ppm: 1338 \n", + " p = 80.00% amt: 1000000 sats hops: 3 ppm: 1381 \n", + " p = 83.18% amt: 2920385 sats hops: 4 ppm: 1686 \n", + " p = 19.71% amt: 666831 sats hops: 4 ppm: 1360 \n", + " p = 15.96% amt: 4800000 sats hops: 5 ppm: 1362 \n", + " p = 42.57% amt: 250000 sats hops: 6 ppm: 1447 \n", + " p = 78.77% amt: 500000 sats hops: 6 ppm: 1669 \n", + " p = 25.98% amt: 386358 sats hops: 6 ppm: 1362 \n", + " p = 75.27% amt: 158450 sats hops: 6 ppm: 1362 \n", + " p = 40.00% amt: 500000 sats hops: 6 ppm: 1452 \n", + " p = 91.34% amt: 750000 sats hops: 7 ppm: 1488 \n", + " p = 30.68% amt: 510000 sats hops: 7 ppm: 1537 \n", + " p = 29.30% amt: 533519 sats hops: 7 ppm: 1486 \n", + " p = 46.24% amt: 250000 sats hops: 8 ppm: 1438 \n", + " p = 26.00% amt: 706481 sats hops: 8 ppm: 1365 \n", + " p = 43.39% amt: 367969 sats hops: 8 ppm: 1370 \n", + " p = 34.72% amt: 632031 sats hops: 8 ppm: 1371 \n", + " p = 18.65% amt: 617969 sats hops: 9 ppm: 1377 \n", + " p = 25.00% amt: 375000 sats hops: 9 ppm: 1378 \n", + " p = 14.59% amt: 500000 sats hops: 11 ppm: 1345 \n", + " p = 14.73% amt: 345000 sats hops: 11 ppm: 1345 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 40803479 sats\n", + "expected to deliver 22177499 sats \t(54.35%)\n", + "actually deliverd 23658486 sats \t(57.98%)\n", + "deviation: 1.07\n", + "planned_fee: 57793.458 sat\n", + "paid fees: 32979.821 sat\n", + "Runtime of flow computation: 0.39 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 2\n", + "Try to deliver 17144993 satoshi:\n", + "\n", + "Statistics about 29 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 72.45% amt: 501250 sats hops: 3 ppm: 1365\n", + " p = 38.18% amt: 312500 sats hops: 3 ppm: 1337\n", + " p = 100.00% amt: 2500000 sats hops: 4 ppm: 1687\n", + " p = 27.94% amt: 555693 sats hops: 4 ppm: 1360\n", + " p = 100.00% amt: 2250000 sats hops: 4 ppm: 1377\n", + " p = 38.92% amt: 195655 sats hops: 5 ppm: 1353\n", + " p = 25.66% amt: 375000 sats hops: 6 ppm: 1452\n", + " p = 78.83% amt: 249843 sats hops: 6 ppm: 1563\n", + " p = 32.20% amt: 385157 sats hops: 6 ppm: 1552\n", + " p = 55.84% amt: 90456 sats hops: 7 ppm: 1701\n", + " p = 37.50% amt: 312500 sats hops: 7 ppm: 1367\n", + " p = 93.79% amt: 248750 sats hops: 8 ppm: 1713\n", + " p = 60.19% amt: 691725 sats hops: 8 ppm: 1696\n", + " p = 49.37% amt: 158450 sats hops: 8 ppm: 1372\n", + " p = 90.00% amt: 250000 sats hops: 9 ppm: 1506\n", + " p = 91.66% amt: 296481 sats hops: 10 ppm: 1368\n", + " p = 68.73% amt: 43519 sats hops: 10 ppm: 1363\n", + " p = 65.04% amt: 6250 sats hops: 11 ppm: 1354\n", + " p = 37.60% amt: 370000 sats hops: 14 ppm: 1500\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 21.27% amt: 2880000 sats hops: 5 ppm: 1362 \n", + " p = 45.68% amt: 500000 sats hops: 5 ppm: 1668 \n", + " p = 19.75% amt: 1213330 sats hops: 5 ppm: 1366 \n", + " p = 45.65% amt: 115703 sats hops: 6 ppm: 1373 \n", + " p = 80.66% amt: 706481 sats hops: 7 ppm: 1385 \n", + " p = 71.83% amt: 437500 sats hops: 8 ppm: 1687 \n", + " p = 25.20% amt: 796481 sats hops: 8 ppm: 1370 \n", + " p = 59.23% amt: 203519 sats hops: 9 ppm: 1385 \n", + " p = 52.40% amt: 368750 sats hops: 11 ppm: 1377 \n", + " p = 50.00% amt: 130000 sats hops: 12 ppm: 1387 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 17144993 sats\n", + "expected to deliver 10043380 sats \t(58.58%)\n", + "actually deliverd 9793229 sats \t(57.12%)\n", + "deviation: 0.98\n", + "planned_fee: 25131.930 sat\n", + "paid fees: 14777.606 sat\n", + "Runtime of flow computation: 0.23 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 3\n", + "Try to deliver 7351764 satoshi:\n", + "\n", + "Statistics about 15 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 40.10% amt: 950475 sats hops: 5 ppm: 1361\n", + " p = 33.27% amt: 1929525 sats hops: 7 ppm: 1696\n", + " p = 70.99% amt: 110087 sats hops: 7 ppm: 1701\n", + " p = 79.85% amt: 273680 sats hops: 9 ppm: 1405\n", + " p = 75.00% amt: 204563 sats hops: 9 ppm: 1373\n", + " p = 86.71% amt: 751250 sats hops: 10 ppm: 1385\n", + " p = 77.19% amt: 367969 sats hops: 10 ppm: 1388\n", + " p = 70.16% amt: 142057 sats hops: 10 ppm: 1389\n", + " p = 100.00% amt: 203519 sats hops: 11 ppm: 1692\n", + " p = 91.60% amt: 172320 sats hops: 12 ppm: 1687\n", + " p = 100.00% amt: 124161 sats hops: 13 ppm: 1678\n", + " p = 20.53% amt: 231556 sats hops: 19 ppm: 1375\n", + " p = 20.00% amt: 13033 sats hops: 22 ppm: 1375\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 88.96% amt: 1213408 sats hops: 4 ppm: 1375 \n", + " p = 29.37% amt: 664161 sats hops: 11 ppm: 1378 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 7351764 sats\n", + "expected to deliver 4318528 sats \t(58.74%)\n", + "actually deliverd 5474195 sats \t(74.46%)\n", + "deviation: 1.27\n", + "planned_fee: 10937.931 sat\n", + "paid fees: 8352.407 sat\n", + "Runtime of flow computation: 0.18 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 4\n", + "Try to deliver 1877569 satoshi:\n", + "\n", + "Statistics about 6 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 72.25% amt: 375000 sats hops: 6 ppm: 1418\n", + " p = 92.88% amt: 285934 sats hops: 6 ppm: 1387\n", + " p = 84.09% amt: 239974 sats hops: 6 ppm: 1382\n", + " p = 29.89% amt: 687500 sats hops: 7 ppm: 1371\n", + " p = 45.15% amt: 62841 sats hops: 11 ppm: 1411\n", + " p = 38.48% amt: 226320 sats hops: 11 ppm: 1410\n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 1877569 sats\n", + "expected to deliver 1059255 sats \t(56.42%)\n", + "actually deliverd 1877569 sats \t(100.00%)\n", + "deviation: 1.77\n", + "planned_fee: 2611.819 sat\n", + "paid fees: 2611.819 sat\n", + "Runtime of flow computation: 0.18 sec \n", + "\n", + "================================================================\n", + "\n", + "SUMMARY:\n", + "========\n", + "Rounds of mcf-computations: 4\n", + "Number of onions sent: 111\n", + "Number of failed onions: 33\n", + "Failure rate: 29.73% \n", + "total runtime (including inefficient memory managment): 3.206 sec\n", + "Learnt entropy: 91.33 bits\n", + "Fees for successfull delivery: 58721.653 sat --> 1439 ppm\n", + "used mu: 1000\n" + ] + } + ], + "source": [ + "payment_session = PaymentSession(oracle_lightning_network, \n", + " uncertainty_network,\n", + " prune_network=True)\n", + "payment_session.forget_information()\n", + "payment_session.activate_network_wide_uncertainty_reduction(1)\n", + "\n", + "payment_session.pickhardt_pay(RENE,C_OTTO, AMT,mu=1000,base=0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Make a payment that optimizes for both reliability and fees with no probing" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Round number: 1\n", + "Try to deliver 40803479 satoshi:\n", + "\n", + "Statistics about 18 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 74.60% amt: 600000 sats hops: 3 ppm: 2092\n", + " p = 52.92% amt: 2800000 sats hops: 3 ppm: 1897\n", + " p = 96.81% amt: 61199 sats hops: 3 ppm: 1681\n", + " p = 77.71% amt: 1371238 sats hops: 3 ppm: 2379\n", + " p = 45.91% amt: 3355443 sats hops: 3 ppm: 1750\n", + " p = 61.96% amt: 2020000 sats hops: 3 ppm: 1974\n", + " p = 67.71% amt: 640000 sats hops: 3 ppm: 1564\n", + " p = 36.50% amt: 3200000 sats hops: 4 ppm: 2603\n", + " p = 27.71% amt: 1800000 sats hops: 4 ppm: 2118\n", + " p = 25.68% amt: 1200000 sats hops: 4 ppm: 1844\n", + " p = 68.50% amt: 1000000 sats hops: 4 ppm: 2187\n", + " p = 30.61% amt: 4000000 sats hops: 4 ppm: 1552\n", + " p = 30.60% amt: 1628762 sats hops: 5 ppm: 2579\n", + " p = 22.81% amt: 1046329 sats hops: 5 ppm: 1709\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 25.52% amt: 10066329 sats hops: 3 ppm: 2036 \n", + " p = 44.78% amt: 2000000 sats hops: 4 ppm: 2060 \n", + " p = 57.54% amt: 882941 sats hops: 4 ppm: 1513 \n", + " p = 24.40% amt: 3131238 sats hops: 5 ppm: 2057 \n", "\n", + "Attempt Summary:\n", + "=================\n", "\n", - "OTPTIMIZE MAINLY FOR FEES use foaf uncertainty reduction\n", - "channels with full knowlege: 215\n", - "channels with 2 Bits of less entropy: 8750\n", - "\n", - "Try: 50000000 sats. Round number: 1\n", - "\\mu: 1 \n", - "Runtime of flow computation: 0.91 sec \n", - "Success: True \t fee: 13180.320msat \t p = 21.27% amt: 9040000sats path hops: 3\n", - "Success: True \t fee: 2060.480msat \t p = 23.93% amt: 1370000sats path hops: 3\n", - "Success: True \t fee: 2197.910msat \t p = 50.98% amt: 1430000sats path hops: 3\n", - "Success: True \t fee: 1511.820msat \t p = 28.04% amt: 1110000sats path hops: 3\n", - "Success: True \t fee: 217.440msat \t p = 76.84% amt: 160000sats path hops: 3\n", - "Success: True \t fee: 2152.570msat \t p = 29.87% amt: 1610000sats path hops: 3\n", - "Success: True \t fee: 5971.980msat \t p = 49.35% amt: 3540000sats path hops: 3\n", - "Success: True \t fee: 1225.700msat \t p = 57.83% amt: 850000sats path hops: 3\n", - "Success: True \t fee: 289.180msat \t p = 78.79% amt: 190000sats path hops: 4\n", - "Success: True \t fee: 129.420msat \t p = 6.99% amt: 90000sats path hops: 4\n", - "Success: True \t fee: 390.690msat \t p = 38.52% amt: 270000sats path hops: 4\n", - "Success: True \t fee: 100.170msat \t p = 84.19% amt: 70000sats path hops: 4\n", - "Success: True \t fee: 472.500msat \t p = 58.24% amt: 350000sats path hops: 4\n", - "Success: True \t fee: 2057.680msat \t p = 57.80% amt: 1360000sats path hops: 4\n", - "Success: True \t fee: 205.050msat \t p = 88.90% amt: 150000sats path hops: 4\n", - "Success: True \t fee: 5270.290msat \t p = 2.22% amt: 3530000sats path hops: 4\n", - "Success: True \t fee: 465.930msat \t p = 89.42% amt: 310000sats path hops: 4\n", - "Success: True \t fee: 350.480msat \t p = 56.01% amt: 260000sats path hops: 4\n", - "Success: True \t fee: 696.540msat \t p = 39.41% amt: 470000sats path hops: 4\n", - "Success: True \t fee: 95.200msat \t p = 76.94% amt: 70000sats path hops: 4\n", - "Success: True \t fee: 685.730msat \t p = 36.73% amt: 470000sats path hops: 4\n", - "Success: True \t fee: 1980.240msat \t p = 36.78% amt: 1480000sats path hops: 4\n", - "Success: True \t fee: 215.800msat \t p = 89.80% amt: 130000sats path hops: 4\n", - "Success: True \t fee: 902.850msat \t p = 15.53% amt: 650000sats path hops: 4\n", - "Success: True \t fee: 386.120msat \t p = 61.62% amt: 280000sats path hops: 4\n", - "Success: True \t fee: 184.680msat \t p = 93.91% amt: 120000sats path hops: 4\n", - "Success: True \t fee: 256.310msat \t p = 19.19% amt: 190000sats path hops: 4\n", - "Success: True \t fee: 187.070msat \t p = 63.82% amt: 130000sats path hops: 4\n", - "Success: True \t fee: 2113.370msat \t p = 26.47% amt: 1330000sats path hops: 4\n", - "Success: True \t fee: 897.800msat \t p = 44.01% amt: 670000sats path hops: 4\n", - "Success: True \t fee: 48.540msat \t p = 99.23% amt: 30000sats path hops: 4\n", - "Success: True \t fee: 548.640msat \t p = 74.31% amt: 360000sats path hops: 4\n", - "Success: True \t fee: 115.760msat \t p = 76.88% amt: 80000sats path hops: 5\n", - "Success: True \t fee: 28.760msat \t p = 92.73% amt: 20000sats path hops: 5\n", - "Success: True \t fee: 1278.400msat \t p = 19.31% amt: 800000sats path hops: 5\n", - "Success: True \t fee: 783.200msat \t p = 34.37% amt: 550000sats path hops: 5\n", - "Success: True \t fee: 1896.570msat \t p = 28.04% amt: 1170000sats path hops: 5\n", - "Success: True \t fee: 603.540msat \t p = 25.46% amt: 420000sats path hops: 5\n", - "Success: True \t fee: 180.240msat \t p = 94.86% amt: 120000sats path hops: 5\n", - "Success: True \t fee: 1800.960msat \t p = 51.40% amt: 1120000sats path hops: 5\n", - "Success: True \t fee: 1025.440msat \t p = 64.67% amt: 680000sats path hops: 5\n", - "Success: True \t fee: 1244.700msat \t p = 0.71% amt: 900000sats path hops: 6\n", - "Success: True \t fee: 274.930msat \t p = 53.50% amt: 190000sats path hops: 6\n", - "Success: True \t fee: 981.760msat \t p = 32.78% amt: 640000sats path hops: 6\n", - "Success: True \t fee: 809.460msat \t p = 59.73% amt: 540000sats path hops: 6\n", - "Success: True \t fee: 641.340msat \t p = 70.18% amt: 420000sats path hops: 6\n", - "Success: True \t fee: 416.880msat \t p = 48.97% amt: 270000sats path hops: 6\n", - "Success: True \t fee: 949.770msat \t p = 20.51% amt: 610000sats path hops: 7\n", - "Success: True \t fee: 527.680msat \t p = 34.64% amt: 340000sats path hops: 7\n", - "Success: True \t fee: 321.310msat \t p = 65.85% amt: 230000sats path hops: 7\n", - "Success: True \t fee: 125.730msat \t p = 90.13% amt: 90000sats path hops: 7\n", - "Success: True \t fee: 436.790msat \t p = 45.01% amt: 310000sats path hops: 7\n", - "Success: True \t fee: 138.900msat \t p = 85.38% amt: 100000sats path hops: 7\n", - "Success: True \t fee: 1089.660msat \t p = 33.08% amt: 780000sats path hops: 7\n", - "Success: True \t fee: 43.440msat \t p = 91.82% amt: 30000sats path hops: 7\n", - "Success: True \t fee: 14.700msat \t p = 85.67% amt: 10000sats path hops: 7\n", - "Success: True \t fee: 116.960msat \t p = 13.21% amt: 80000sats path hops: 7\n", - "Success: True \t fee: 1893.480msat \t p = 16.80% amt: 1240000sats path hops: 8\n", - "Success: True \t fee: 599.640msat \t p = 53.89% amt: 380000sats path hops: 8\n", - "Success: True \t fee: 449.500msat \t p = 53.89% amt: 290000sats path hops: 8\n", - "Success: True \t fee: 14.410msat \t p = 94.41% amt: 10000sats path hops: 8\n", - "Success: False \t fee: 14.210msat \t p = 94.41% amt: 10000sats path hops: 8\n", - "Success: True \t fee: 254.150msat \t p = 26.89% amt: 170000sats path hops: 8\n", - "Success: True \t fee: 14.800msat \t p = 47.84% amt: 10000sats path hops: 8\n", - "Success: True \t fee: 1344.600msat \t p = 61.55% amt: 900000sats path hops: 8\n", - "Success: True \t fee: 288.230msat \t p = 68.52% amt: 190000sats path hops: 8\n", - "Success: True \t fee: 805.680msat \t p = 53.61% amt: 540000sats path hops: 8\n", - "Success: True \t fee: 150.500msat \t p = 82.16% amt: 100000sats path hops: 9\n", - "Success: True \t fee: 45.450msat \t p = 82.45% amt: 30000sats path hops: 9\n", - "Success: True \t fee: 14.500msat \t p = 63.10% amt: 10000sats path hops: 9\n", - "Success: True \t fee: 1232.460msat \t p = 20.52% amt: 820000sats path hops: 9\n", - "Success: True \t fee: 2748.960msat \t p = 17.37% amt: 1840000sats path hops: 9\n", - "Success: True \t fee: 804.010msat \t p = 24.76% amt: 530000sats path hops: 9\n", - "Success: True \t fee: 395.280msat \t p = 4.86% amt: 270000sats path hops: 9\n", - "Success: True \t fee: 138.600msat \t p = 5.81% amt: 90000sats path hops: 10\n", - "total_fee: 74503.840 msat \t paid fees: 74489.630 msat\n", - "\n", - "Try: 10000 sats. Round number: 2\n", - "\\mu: 1 \n", - "Runtime of flow computation: 0.89 sec \n", - "Success: True \t fee: 13.370msat \t p = 99.28% amt: 10000sats path hops: 5\n", - "total_fee: 13.370 msat \t paid fees: 13.370 msat\n", + "Tried to deliver 40803479 sats\n", + "expected to deliver 15636894 sats \t(38.32%)\n", + "actually deliverd 24722971 sats \t(60.59%)\n", + "deviation: 1.58\n", + "planned_fee: 81944.292 sat\n", + "paid fees: 49538.325 sat\n", + "Runtime of flow computation: 0.08 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 2\n", + "Try to deliver 16080508 satoshi:\n", + "\n", + "Statistics about 6 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 69.15% amt: 994281 sats hops: 3 ppm: 1896\n", + " p = 63.45% amt: 1342177 sats hops: 4 ppm: 1551\n", + " p = 73.53% amt: 2000000 sats hops: 5 ppm: 2060\n", + " p = 48.17% amt: 5980051 sats hops: 6 ppm: 2878\n", + "\n", + "failed attempts:\n", + "----------------\n", + " p = 80.00% amt: 2013265 sats hops: 3 ppm: 2036 \n", + " p = 78.08% amt: 3750734 sats hops: 4 ppm: 1944 \n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 16080508 sats\n", + "expected to deliver 10429552 sats \t(64.86%)\n", + "actually deliverd 10316509 sats \t(64.16%)\n", + "deviation: 0.99\n", + "planned_fee: 36701.967 sat\n", + "paid fees: 25305.771 sat\n", + "Runtime of flow computation: 0.08 sec \n", + "\n", + "================================================================\n", + "\n", + "Round number: 3\n", + "Try to deliver 5763999 satoshi:\n", + "\n", + "Statistics about 2 candidate onions:\n", + "\n", + "successful attempts:\n", + "--------------------\n", + " p = 73.14% amt: 2400000 sats hops: 6 ppm: 1888\n", + " p = 58.32% amt: 3363999 sats hops: 6 ppm: 2878\n", + "\n", + "Attempt Summary:\n", + "=================\n", + "\n", + "Tried to deliver 5763999 sats\n", + "expected to deliver 3717271 sats \t(64.49%)\n", + "actually deliverd 5763999 sats \t(100.00%)\n", + "deviation: 1.55\n", + "planned_fee: 14216.149 sat\n", + "paid fees: 14216.149 sat\n", + "Runtime of flow computation: 0.06 sec \n", + "\n", + "================================================================\n", "\n", "SUMMARY:\n", - "Rounds of mcf-computations: 2\n", - "Number of onions sent: 76\n", - "Number of failed onions: 1 failure rate: 1.32% \n", - "total runtime (including inefficient memory managment): 1.796 sec\n", - "Learnt entropy: 53.58 bits\n", - "Fees for successfull delivery: 74503.000 sat --> 1490 ppm\n" + "========\n", + "Rounds of mcf-computations: 3\n", + "Number of onions sent: 26\n", + "Number of failed onions: 6\n", + "Failure rate: 23.08% \n", + "total runtime (including inefficient memory managment): 1.250 sec\n", + "Learnt entropy: 29.27 bits\n", + "Fees for successfull delivery: 89060.245 sat --> 2182 ppm\n", + "used mu: 1\n" ] } ], "source": [ - "print(\"\\n\\nOTPTIMIZE MAINLY FOR FEES use foaf uncertainty reduction\")\n", - "oracle.reset_uncertainty_network()\n", - "oracle.arcs_to_networkx(0)\n", - "oracle.activate_foaf_uncertainty_reduction(RENE,C_OTTO)\n", - "run_pickhardt_payments_experiment(oracle,RENE,C_OTTO,AMT,mu=1,base=0)\n" + "payment_session = PaymentSession(oracle_lightning_network, \n", + " uncertainty_network,\n", + " prune_network=True)\n", + "payment_session.forget_information()\n", + "payment_session.pickhardt_pay(RENE,C_OTTO, AMT,mu=1,base=0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "# Backup code\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Probably depricated functions and todos for refactoring from old code base" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + " def __init__(self,filename:str):\n", + " \"\"\"\n", + " It starts by importing the channel_graph from c-lightning listchannels command and then \n", + " \"\"\"\n", + " self._network = nx.MultiDiGraph()\n", + " channels = self.get_channel_json(filename)\n", + " for channel in channels:\n", + " oracle_channel = OracleChannel(channel)\n", + " self._channel_graph.add_edge(oracle_channel.src, \n", + " oracle_channel.dest, \n", + " key=oracle_channel.short_channel_id, \n", + " channel=oracle_channel)\n", + " \n", + " \n", + " def get_all_parallel_channels(self, src: str, dest: str):\n", + " \"\"\"\n", + " FIXME: depricate? It's\n", + " \"\"\"\n", + " if self.network.has_edge(src,dest):\n", + " return {short_channel_id : self.network[src][dest][short_channel_id][\"channel\"] \n", + " for short_channel_id in self.network[src][dest].keys()}\n", + "\n", + " \n", + " def __init__(self,filename:str, base_threshold : int = DEFAULT_BASE_THRESHOLD):\n", + " \"\"\"\n", + " It starts by importing the channel_graph from c-lightning listchannels command and then \n", + " \"\"\"\n", + " self._channel_graph = nx.MultiDiGraph()\n", + " channels = self.get_channel_json(filename)\n", + " for channel in channels:\n", + " uncertainty_channel = UncertaintyChannel(channel)\n", + " if channel.base_fee <= base_threshold:\n", + " self._channel_graph.add_edge(oracle_channel.src, \n", + " oracle_channel.dest, \n", + " key=oracle_channel.short_channel_id, \n", + " channel=oracle_channel)\n", + "\n", + " \n", + " \"\"\"\n", + " #allocate amounts for probability computation\n", + " for i, onion in enumerate(paths):\n", + " path, amount = onion\n", + " fee, probability = uncertainty_network.allocate_path(path,amount)\n", + " payments[i] = {\"routing_fee\": fee, \"probability\": probability, \"path\": path, \"amount\": amount}\n", + "\n", + " #remove allocated amounts for all onions ---#failed onions\n", + " for key, attempt in payments.items():\n", + " #if attempt[\"success\"] == False:\n", + " self._uncertainty_network.allocate_path(attempt[\"path\"],-attempt[\"amount\"])\n", + "\n", + " #test actual payment attempts\n", + " for key, attempt in payments.items():\n", + " payments[key][\"success\"] = uncertainty_network.probe_path(attempt[\"path\"],attempt[\"amount\"])\n", + " \"\"\"\n", + "\n", + " def __init__(self,filename:str):\n", + " channel_graph = ChannelGraph(filename)\n", + " oracle = OracleLightningNetwork(self._channel_graph)\n", + " uncertainty_network = UncertaintyNetwork(self._channel_graph)\n", + " self.__init__(channel_graph,oracle, uncertainty_network)\n", + "\n", + " \n", + " def __init__(self,cln_jsn : dict,actual_liquidity : int = None):\n", + " super().__init__(cln_jsn)\n", + " self._actual_liquidity=actual_liquidity\n", + " if actual_liquidity is None or actual_liquidity >= self.capacity or actual_liquidity < 0:\n", + " self._actual_liquidity = random.randint(0,self.capacity)\n" ] }, { @@ -1779,7 +3212,72 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "\n", + "\n", + " \"\"\"\n", + " #FIXME: Needs this method in ChannelGraph\n", + " def get_next_channel(self,src:str,dest:str):\n", + " \n", + " if self.network.has_edge(src,dest):\n", + " for k,channel in self.network[src][dest].items():\n", + " print(k)\n", + " yield channel[\"channel\"]\n", + " \"\"\"\n", + "\n", + "\n", + "for channel in channel_graph.get_next_channel(src,dest):\n", + " print(channel.short_channel_id)\n", + " print(channel)\n", + " \n", + " print(channel.entropy())\n", + " print(channel.success_probability(20000))\n", + " print(channel.uncertainty_cost(20000))\n", + " print()\n", + " channel.min_liquidity=10000\n", + " print(channel.success_probability(20000))\n", + " print(channel.uncertainty_cost(20000))\n", + " print()\n", + " channel.max_liquidity=30000\n", + " print(channel.success_probability(20000))\n", + " print(channel.uncertainty_cost(20000))\n", + " print(\"ppm: {} base: {}\".format(channel.ppm, channel.base_fee))\n", + " print(channel.routing_cost_msat(20000))\n", + " \n", + " print(channel.success_probability(20000))\n", + " print(channel.combined_linearized_unit_cost())\n", + " print(channel.linearized_integer_uncertainty_unit_cost())\n", + " \n", + " print(\"ppm: {} base: {}\".format(channel.ppm, channel.base_fee))\n", + " print(channel.routing_cost_msat(20000))\n", + " channel.forget_information()\n", + " channel.min_liquidity=120000\n", + " \n", + " MU = UncertaintyChannel.TOTAL_NUMBER_OF_SATS / 21_000_000\n", + " for p in channel.get_piecewise_linearized_costs(number_of_pieces=5,quantization=100000,mu=MU*1):\n", + " print(p)\n", + " \n", + " for p in channel.get_piecewise_linearized_costs(number_of_pieces=5,quantization=100000,mu=MU*10):\n", + " print(p)\n", + " \n", + " for p in channel.get_piecewise_linearized_costs(number_of_pieces=5,quantization=100000,mu=MU*100):\n", + " print(p)\n", + " print(log(p[1])+ log(UncertaintyChannel.TOTAL_NUMBER_OF_SATS/100_000/100))\n", + " break" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [], + "source": [ + "#via: https://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/\n", + "#and: https://developers.google.com/optimization/install\n", + "import sys\n", + "!{sys.executable} -m pip install --upgrade --user ortools\n", + "#!conda install --yes --prefix {sys.prefix} -c conda-forge ortools-python" + ] } ], "metadata": { @@ -1802,5 +3300,5 @@ } }, "nbformat": 4, - "nbformat_minor": 4 + "nbformat_minor": 2 }