# Probabilistic Logic Models for the Lightning Network

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Related Work

## 3. Blockchain and Lightning Network

#### Lightning Network

`A`is connected to a node

`B`, and node

`B`is connected to node

`C`,

`A`can send a multi-hop payment to

`C`, with

`B`forwarding to

`C`the payment received from

`A`. In this case,

`B`collects some fees, composed of a fixed part (base fee) and a variable part (fee rate) that depends on the size of the payment. Thus, the more payments a node routes, the higher will be its earnings. There can be an arbitrary number of intermediate nodes. In addition, here HTLCs manage scenarios where an intermediate node refuses to forward a payment.

`A`opens a channel with

`B`and

`A`locks in 5 and

`B`2 satoshi, where 1 satoshi = ${10}^{-8}$ bitcoin (These are very small quantities that are unlikely to be realistic but are used here only to explain the process); the total capacity of the channel visible from the outside is $5+2=7$, but, from

`A`, we can route towards

`B`at most 5 satoshi, while from

`B`we can route at most 2 satoshi towards

`A`. After, for example, a payment of size 4 from

`A`to

`B`, the total capacity of the channel is unchanged, but the funds distribution is updated:

`A`has 1 satoshi left while

`B`has 6.

## 4. Logic Programming Languages

#### 4.1. Logic Programming

`:-`). The meaning of a clause is: if the body is true, the head is also true. Variables start with uppercase letters while constants start with lowercase letters. With the symbol

`_`, we denote the anonymous variable, i.e., a variable with no name. If a term or clause does not contain variables, we call it ground. The operation that consists of replacing variables with terms is called substitution and it is usually indicated with the Greek letter $\theta $. A substitution that makes a term ground is called grounding. If we consider a term

`t(A,B)`, and a substitution $\theta $ =

`A/a,B/b`indicating that we replace

`A`with

`a`and

`B`with

`b`, the result of the application of $\theta $ to

`t(A,B)`, denoted with

`t`$\theta $, is

`t`$\theta $ =

`t(a,b)`. In this case, the substitution $\theta $ is also grounding since the term, after applying the substitution, does not contain variables.

`f(a,b)`, where

`a`and

`b`are terms. Here,

`f(a,b)`can be considered as a fact since it indicates what is known to be true. The second line represents a clause where the head is

`q(A)`and the body is

`f(A,b)`. The number of arguments of a term is called arity. The functor of a term is the combination of the name and the number of arguments, often compactly indicated with the notation name/arity. For this example, the two terms can be indicated with

`f/2`and

`q/1`. A predicate is a set of clauses with the same functor.

`q(A)`is true. The answer will be

`yes`with the substitution A = a. The basic mechanism adopted in Prolog to answer queries is called SLD resolution.

**Example**

**1**

`edge/2`facts, as shown in Figure 1a. The first rule of Figure 1a (line 5) states that there is certainly a path between

`X`and

`X`(the source and destination nodes coincide). The second rule (line 6) states that there is a path between

`X`and

`Z`if there is an edge between

`X`and an intermediate node

`Y`and there is a path between

`Y`and

`Z`. For this example, the graph does not contain closed loops and edges are directed. We can ask whether there is a path between node

`a`and node

`e`with the query

`path(a,e)`. The answer will be

`yes`twice: the first path passes from node

`c`and the second from node

`d`. Alternatively, we can collect all the possible reachable nodes starting from

`a`by asking

`path(a,X)`. In this case, the solutions will be

`X = a`,

`X = b`,

`X = c`,

`X = e`,

`X = d`,

`X = e`. Node

`e`is present twice since it can be reachable from two different paths, as previously shown.

#### 4.2. Probabilistic Logic Programming

`sunny`, which is true with probability 0.7, and

`cloudy`, which is true with probability 0.4.

`sunny`and

`cloudy`are true, with an associated probability of $0.7\times 0.4=0.28$; the second (${w}_{2}$) where

`sunny`is true and

`cloudy`is false, with an associated probability of $0.7\times (1-0.4)=0.42$; the third (${w}_{3}$) where

`sunny`is false and

`cloudy`is true, with an associated probability of $(1-0.7)\times 0.4=0.12$; the fourth (${w}_{4}$) where both

`sunny`and

`cloudy`are false, with an associated probability of $(1-0.7)\times (1-0.4)=0.18$. The query

`dry`is true in ${w}_{1}$, ${w}_{2}$, and ${w}_{3}$, and its probability is $0.28+0.42+0.12=0.82$. In general, the computation of the probability of a query is a #P-complete task [33] since it involves counting all the possible solutions. To solve inference in practice, a probabilistic logic program can be converted into a different language, through knowledge compilation [34], in which the inference is easier. Here, we consider Binary Decision Diagrams (BDDs) as a target for the compilation.

**Example**

**2**

`edge/2`facts of the program shown in Figure 1a. For example:

`path/2`are unchanged. Now, all the edges have an associated probability, and thus the routing is probabilistic. Note that probabilistic and deterministic edges may coexist in the same program. We can compute the probability of the query

`path(a,e)`using, for example, PITA [35], obtaining 0.3128.

`P`of

`q/1`depends on the value of the argument

`A`.

#### 4.3. Probabilistic Abductive Logic Programming

**Example**

**3**

`a`and

`b`. The last line represents a deterministic integrity constraint ($\Pi =1$) imposing that

`a`and

`b`cannot be both true at the same time. Given the query

`q`, the two sets ${\mathsf{\Delta}}_{1}$ =

`{a}`and ${\mathsf{\Delta}}_{2}$ =

`{b}`represent the solution of the abductive problem, both yielding a probability of 0.2 for

`q`. Note that, if we remove the integrity constraint, the set Δ =

`{a,b}`would have been the abductive explanation, with $P(q\mid \mathsf{\Delta})=0.36$, but is forbidden by the IC.

#### 4.4. Probabilistic Optimizable and Probabilistic Reducible Logic Programs

`e`starting from

`a`above a certain threshold.

**Example**

**4**

`a`and

`b`, each with a probability range between 0.3 and 0.9. If the goal is to minimize the sum of the probabilities of the two optimizable facts with the constraint that the probability of

`q`must be greater than 0.3, a possible probability assignment for both facts is approximately 0.817, yielding a probability of

`q`of 0.3.

`e`starting from

`a`above a certain threshold while removing as may edge facts as possible.

**Example**

**5**

`a`and

`b`, with an associated probability of 0.8 and 0.7, respectively. If the goal is to keep the probability of

`q`above 0.15, the reducible fact

`b`can be removed from the program: in this case, the probability of

`q`becomes 0.16.

## 5. Lightning Network Models

**Example**

**6**

`edge/2`facts, as in [16]. To obtain the path success probability for a given path and a given payment size, the whole program of Figure 1a can be modified as follows:

`path/6`are the following: in

`path(Source,Destination,PaymentSize,NodesInPath,InitialProbability,FinalProbability)`,

`Source`is the source node,

`Destination`is the destination node, and

`PaymentSize`is the size of the payment that should be routed from

`Source`to

`Destination`;

`NodesInPath`is a list containing the nodes encountered in a path,

`InitialProbability`is an accumulator for the probability (that starts from 1), and

`FinalProbability`is the computed path success probability. In the first clause for

`path/6`(line 9), the source and destination nodes (

`Node`) coincide, the list of nodes contains only one the current node

`Node`, and the path success probability is the probability

`P`accumulated so far. Logic programming predicates are often recursive: in this example, the second clause for the

`path/6`predicate is the general case while the first is the base case (a path is found). The

`path/6`predicate works as follows: first, it checks whether there is an edge between the current node

`Source`and an intermediate node

`Intermediate`(line 11). The predicate

`channelSuccessProbability/3`checks whether the capacity

`Capacity`of the selected channel is sufficient to route a payment of size

`Size`(line 6) and then computes the channel success probability

`ChProb`. After this, the computed path probability is updated to account for the current value (line 13). Finally, the predicate is recursively called to find a path that connects the intermediate node

`Intermediate`and the destination

`Dest`.

`a`to

`e`, with an associated probability of ${((10-2)/10)}^{3}=0.512$ each. We can retrieve these by asking the query

`path(a,e,2,Path,1,Prob)`. We can likewise collect all the paths and associated probabilities in a list using the standard Prolog predicate

`findall/3`:

`e`starting from

`a`, we get 0.69632 since both paths could route the payment.

`a`and

`e`is ${0.5}^{3}=0.125$. However, the PEP between

`a`and

`e`is 0.21875 (given by, in compact form, $0.5\times (0.25+0.25-0.{25}^{2})$) and thus greater than the PSP of every individual path since both paths may route the same amount. This may be useful information in the context of Multi Path Payments, where payments are split and routed through multiple channels or in the case we try to route multiple times simultaneously the same amount. In these scenarios, the PEP represents the probability that at least one of the payments succeeds. Overall, the PEP is an upper bound for the PSP: if there is only one path between two nodes, the PEP coincides with the PSP; otherwise, it is greater since it considers multiple paths together, and not only one. Finally, the computation of the PEP is more complex than the computation of the PSP since we cannot simply multiply the probability of the edges and sum the results. We now show a possible model to compute the PEP.

`connected/3`whose probability is defined using flexible probabilities. Its structure is:

`P`is the associated probability computed with the

`channelSuccessProbability/3`predicate of Example 6. The definition of the

`path/2`predicate shown in Figure 1a is modified in:

`a`and

`e`that can route a payment of size 5 with the query

`path(a,e,5)`, obtaining 0.21875. If we try to route instead a payment of size 7, with the query

`path(a,e,7)`, we obtain 0.05157, a smaller value.

`p`is a fixed number in $]0,1]$. As before, we can adapt this fact to consider different probabilities for different nodes, by using flexible probabilities. The

`connected/3`predicate is further extended as

`active`to 0.99, the probability of successful routing reduces: P(

`path(a,e,5)`) = 0.21255 and P(

`path(a,e,7)`) = 0.05006.

`path/3`predicate, as shown in Example 7.

**Example**

**7**

`NMaxSteps`that can route a payment of size

`Size`between two nodes

`X`and

`Y`.

`path/5`predicate counts the number

`NSteps`of encountered edges and compares it against the maximum number

`NMaxSteps`of allowed steps. For example, if we add the following

`edge/3`facts

`a`and

`e`by considering only the paths with length at most 3 with

`path(a,e,5,3,0)`, obtaining 0.12128 (one of the two possible paths is discarded). However, if we set the maximum length to 4, the probability of the query

`path(a,e,5,4,0)`is 0.166465. For this example, if the maximum length is greater than 4, the probability does not increase.

#### 5.1. Abductive Model

`a`and

`b`and

`c`and

`e`cannot be selected at the same time. With this program, the set of abducibles that maximizes the joint probability of the query

`path(a,e,2,5,0)`and the constraint is

`{edge(a,b,10)}`, which yields a probability of 0.2133. If we associate a probability of, for example, 0.3, to the constraint, indicating that we are unsure about the information it provides, we get the set

`{edge(a,b,10),edge(c,e,10)}`, yielding a probability of 0.3957. From a user perspective, identifying the most important edges can be of interest since he/she may decide whether to insert more connections to provide possible alternatives in case of attacks or nodes that decide to not forward a payment. From an attacker perspective, he/she can identify the most important edges for a given target node and try to block them, for example, with “lockdown attacks” [12].

`:- e(A,B), e(A,C), B \= C`, imposing that there must not be two edges that share the same source node and set all the edges as abducible to compute the PSP. However, this constraint is computationally very expensive since it requires the generation of all the possible triples of nodes.

#### 5.2. Optimizable Model

`edge/3`facts related to nodes as optimizable. Consider the following edges:

`active/1`facts is set to 1. Suppose that the goal is to optimize the probability of the query

`path(a,e,2,5,0)`. The objective function requires minimizing the sum of the probabilities of

`edge(b,d,3)`and

`edge(d,e,10)`(i.e., the objective function is P(

`edge(b,d,3)`) + P(

`edge(d,e,10)`)). At the same time, the probabilities of the two optimizable facts must be close (for example, with a difference less than 0.1). Furthermore, the probability of the query

`path(a,e,2,5,0)`should be above or equal to 0.5. With all the

`edge/3`facts deterministic, the probability of the query is 0.565. The solution of the optimizable problem consists of assigning probability 0.4841 to both optimizable facts. As discussed before, the channel success probability $P\left(c\right)$ is given by $P\left(c\right)=(C-S)/C$, where C is the capacity of the channel and S is the size of the payment. By considering some of the

`edge/3`facts as optimizable, we assign to them a second probability value, call it ${P}^{*}\left(c\right)$, that will be computed with the model. We can use this new value to find the optimal capacity ${C}^{*}$ of a channel by solving the following equation in terms of ${C}^{*}$: $P\left(c\right)\xb7{P}^{*}\left(c\right)=({C}^{*}-S)/{C}^{*}$. In this way, we get ${C}^{*}=S/(1-P\left(c\right)\xb7{P}^{*}\left(c\right))$. For this example, the new funds will be $2/(1-((3-2)/3)\times 0.4841)=2.3849$ for the edge between

`b`and

`d`and $2/(1-((10-2)/10)\times 0.4841)=3.264$ for the edge between

`d`and

`e`, obtaining a probability of 0.5 for the query.

`active/1`facts as optimizable, we can compute the optimal probability to accept or reject a payment while guaranteeing, at the same time, some probability bounds for certain paths. From the perspective of a node, this may be useful to prevent, for example, a possible subsequent imbalance in the distribution of funds in the involved channels. An imbalance in a channel requires the adoption of some mechanisms such as “rebalancing” to restore its funds to one of the two ends. Moreover, if a channel is unbalanced, a node may not be able to route payments through it, possibly reducing its earnings, and this can be a possible target for an attacker.

#### 5.3. Reducible Model

`e`from

`a`must be greater than 0.4. With all the facts included, and the probability of the

`active/1`facts set to 1, the probability of the query

`path(a,e,2,5,0)`is 0.5653. However, by removing

`edge(b,d,3)`, we obtain a probability for the same query of 0.48, satisfying the constraint. Thus, the identified edge can be removed. From an attacker perspective, this can be interesting since he/she can identify the edges that a target user must preserve to route a payment of a given size, and consequently try to attack them, to disclose, for example, the balance distribution in the edges.

## 6. Experiments

^{®}Xeon

^{®}E5-2630v3 running at 2.40 GHz to illustrate some possible statistics obtainable with our models.

`edge/3`facts) using the method

`scale_free_graph`from the “networkx” Python package [43,44] and averaged the results. We used the default parameters for the generation of the networks: $\alpha $, the probability for adding a new node connected to a randomly existing node according to the in degree distribution, set to 0.41, $\beta $, the probability for adding an edge between two existing nodes, set to 0.54, and $\gamma $ the probability for adding a new node connected to an existing randomly chosen node according to the out-degree distribution, set to 0.05. The biases for choosing nodes from in-degree and out-degree distribution are, respectively, set to 0.2 and 0. We discarded the edges with the same source and destination. The average number of edges for every experiment is shown in Table 1 and Table 2.

`edge (A,B,Capacity)`,

`B`>

`A`, to ensure acyclicity. To associate capacities to edges, we selected random capacities from a snapshot of the LN from the 12 April 2021 [17] composed of 14,734 nodes and 44,349 channels. In this snapshot, approximately 80% of edges have less than the average capacity (2,837,035 satoshi), 72% have less than half of the average capacity, and 59% have less than a quarter of the average capacity. We tested the routing of payments of sizes 4651, 11,629, 22,258, 46,516, and 116,296 satoshi, which correspond, at the moment of writing, to approximately 2, 5, 10, 20, and 50 dollars, between 10 random pairs of nodes for every experiment. The paths go from

`A`to

`B`, with

`B`>

`A`to account for the order imposed in the generation of the edges. Note that, as in the real LN, there can be nodes connected by multiple edges.

## 7. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## Abbreviations

ALP | Abductive Logic Programming |

BDD | Binary Decision Diagram |

DS | Distribution Semantics |

HTLC | Hashed Timelock Contract |

IC | Integrity Constraint |

LN | Lightning Network |

LP | Logic Programming |

PALP | Probabilistic Abductive Logic Program |

PEP | Path Existence Probability |

PLP | Probabilistic Logic Programming |

POLP | Probabilistic Optimizable Logic Programs |

PRLP | Probabilistic Reducible Logic Programs |

PSP | Path Success Probability |

## References

- Nakamoto, S. Bitcoin: A Peer-to-Peer Electronic Cash System. 2008. Available online: https://bitcoin.org/bitcoin.pdf (accessed on 20 October 2021).
- Chaudhry, N.; Yousaf, M. Consensus Algorithms in Blockchain: Comparative Analysis, Challenges and Opportunities. In Proceedings of the 12th International Conference on Open Source Systems and Technologies (ICOSST), Lahore, Pakistan, 19–21 December 2018; pp. 54–63. [Google Scholar] [CrossRef]
- Poon, J.; Dryja, T. The Bitcoin Lightning Network: Scalable Off-Chain Instant Payments. 2016. Available online: https://lightning.network/lightning-network-paper.pdf (accessed on 1 June 2022).
- Riguzzi, F. Foundations of Probabilistic Logic Programming: Languages, Semantics, Inference and Learning; River Publishers: Gistrup, Denmark, 2018. [Google Scholar]
- De Raedt, L.; Kimmig, A. Probabilistic (Logic) Programming Concepts. Mach. Learn.
**2015**, 100, 5–47. [Google Scholar] [CrossRef] [Green Version] - Azzolini, D.; Riguzzi, F.; Lamma, E. Studying Transaction Fees in the Bitcoin Blockchain with Probabilistic Logic Programming. Information
**2019**, 10, 335. [Google Scholar] [CrossRef] [Green Version] - Azzolini, D.; Riguzzi, F.; Lamma, E. A Semantics for Hybrid Probabilistic Logic Programs with Function Symbols. Artif. Intell.
**2021**, 294, 103452. [Google Scholar] [CrossRef] - Seres, I.; Gulyás, L.; Nagy, D.; Burcsi, P. Topological Analysis of Bitcoin’s Lightning Network. In Mathematical Research for Blockchain Economy; Springer: Berlin/Heidelberg, Germany, 2020; pp. 1–12. [Google Scholar] [CrossRef] [Green Version]
- Martinazzi, S. The evolution of Lightning Network’s Topology during its first year and the influence over its core values. arXiv
**2019**, arXiv:1902.07307. [Google Scholar] - Rohrer, E.; Malliaris, J.; Tschorsch, F. Discharged Payment Channels: Quantifying the Lightning Network’s Resilience to Topology-Based Attacks. In Proceedings of the 2019 IEEE European Symposium on Security and Privacy Workshops (EuroS&PW), Stockholm, Sweden, 17–19 June 2019; IEEE: Piscataway, NJ, USA, 2019; pp. 347–356. [Google Scholar] [CrossRef] [Green Version]
- Tochner, S.; Schmid, S.; Zohar, A. Hijacking Routes in Payment Channel Networks: A Predictability Tradeoff. arXiv
**2019**, arXiv:1909.06890. [Google Scholar] - Pérez-Solà, C.; Ranchal-Pedrosa, A.; Herrera-Joancomartí, J.; Navarro-Arribas, G.; García-Alfaro, J. LockDown: Balance Availability Attack Against Lightning Network Channels. In Proceedings of the Financial Cryptography and Data Security—24th International Conference, FC 2020, Kota Kinabalu, Malaysia, 10–14 February 2020; Bonneau, J., Heninger, N., Eds.; Revised Selected Papers. Springer: Berlin/Heidelberg, Germany, 2020; Volume 12059, pp. 245–263. [Google Scholar] [CrossRef]
- Kumble, S.P.; Epema, D.; Roos, S. How Lightning’s Routing Diminishes Its Anonymity. In Proceedings of the 16th International Conference on Availability, Reliability and Security, Vienna, Austria, 17–20 August 2021; Association for Computing Machinery: New York, NY, USA, 2021. [Google Scholar] [CrossRef]
- Herrera-Joancomartí, J.; Navarro-Arribas, G.; Ranchal-Pedrosa, A.; Pérez-Solà, C.; Garcia-Alfaro, J. On the Difficulty of Hiding the Balance of Lightning Network Channels. In Proceedings of the 2019 ACM Asia Conference on Computer and Communications Security, Auckland, New Zeland, 7–12 July 2019; Association for Computing Machinery: New York, NY, USA, 2019; pp. 602–612. [Google Scholar] [CrossRef] [Green Version]
- Pickhardt, R.; Tikhomirov, S.; Biryukov, A.; Nowostawski, M. Security and Privacy of Lightning Network Payments with Uncertain Channel Balances. arXiv
**2021**, arXiv:2103.08576. [Google Scholar] - Azzolini, D.; Bellodi, E.; Brancaleoni, A.; Riguzzi, F.; Lamma, E. Modeling Bitcoin Lightning Network by Logic Programming. In Proceedings of the 36th International Conference on Logic Programming (Technical Communications), Rende, Italy, 18–24 September 2020; Ricca, F., Russo, A., Greco, S., Leone, N., Artikis, A., Friedrich, G., Fodor, P., Kimmig, A., Lisi, F., Maratea, M., et al., Eds.; Open Publishing Association: Waterloo, Australia, 2020; pp. 258–260. [Google Scholar] [CrossRef]
- Azzolini, D.; Riguzzi, F.; Bellodi, E.; Lamma, E. A Probabilistic Logic Model of Lightning Network. In Proceedings of the Business Information Systems Workshops, Virtual Event, 14–17 June 2021; Abramowicz, W., Auer, S., Stróżyna, M., Eds.; Lecture Notes in Business Information Processing (LNBIP). Springer: Cham, Switzerland, 2022; pp. 321–333. [Google Scholar] [CrossRef]
- Bartolucci, S.; Caccioli, F.; Vivo, P. A percolation model for the emergence of the Bitcoin Lightning Network. Sci. Rep.
**2020**, 10, 4488. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Callaway, D.S.; Newman, M.E.J.; Strogatz, S.H.; Watts, D.J. Network Robustness and Fragility: Percolation on Random Graphs. Phys. Rev. Lett.
**2000**, 85, 5468–5471. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Béres, F.; Seres, I.A.; Benczúr, A.A. A Cryptoeconomic Traffic Analysis of Bitcoins Lightning Network. arXiv
**2019**, arXiv:1911.09432. [Google Scholar] - Varma, S.M.; Maguluri, S.T. Throughput Optimal Routing in Blockchain-Based Payment Systems. IEEE Trans. Control. Netw. Syst.
**2021**, 8, 1859–1868. [Google Scholar] [CrossRef] - Azzolini, D.; Riguzzi, F.; Lamma, E.; Bellodi, E.; Zese, R. Modeling Bitcoin Protocols with Probabilistic Logic Programming. In Proceedings of the 5th International Workshop on Probabilistic Logic Programming, PLP 2018, Co-Located with the 28th International Conference on Inductive Logic Programming (ILP 2018), Ferrara, Italy, 1 September 2018; Volume 2219, pp. 49–61. [Google Scholar]
- Schnorr, C.P. Efficient signature generation by smart cards. J. Cryptol.
**1991**, 4, 161–174. [Google Scholar] [CrossRef] [Green Version] - Maxwell, G.; Poelstra, A.; Seurin, Y.; Wuille, P. Simple Schnorr multi-signatures with applications to Bitcoin. Des. Codes Cryptogr.
**2019**, 87, 2139–2164. [Google Scholar] [CrossRef] - Kowalski, R.A. Predicate Logic as Programming Language. In Proceedings of the IFIP Congress, Stockholm, Sweden, 5–10 August 1974; pp. 569–574. [Google Scholar]
- Colmerauer, A.; Kanoui, H.; Pasero, R.; Roussel, P. Un Systeme de Communication Homme-Machine en Français; Technical Report; Groupe de Recherche en Intelligence Artificielle, Université d’Aix-Marseille: Marseille, France, 1973. [Google Scholar]
- Sterling, L.; Shapiro, E. The Art of Prolog: Advanced Programming Techniques; Logic Programming; MIT Press: Cambridge, MA, USA, 1994. [Google Scholar]
- Lloyd, J.W. Foundations of Logic Programming, 2nd ed.; Springer: Berlin/Heidelberg, Germany, 1987. [Google Scholar]
- De Raedt, L.; Kimmig, A.; Toivonen, H. ProbLog: A Probabilistic Prolog and Its Application in Link Discovery. In Proceedings of the 20th International Joint Conference on Artificial Intelligence (IJCAI 2007), Hyderabad, India, 6–12 January 2007; Veloso, M.M., Ed.; AAAI Press/IJCAI: Palo Alto, CA, USA, 2007; Volume 7, pp. 2462–2467. [Google Scholar]
- Vennekens, J.; Verbaeten, S.; Bruynooghe, M. Logic Programs With Annotated Disjunctions. In Proceedings of the 20th International Conference on Logic Programming (ICLP 2004), Saint-Malo, France, 6–10 September 2004; Demoen, B., Lifschitz, V., Eds.; Lecture Notes in Computer Science. Springer: Berlin/Heidelberg, Germany, 2004; Volume 3131, pp. 431–445. [Google Scholar] [CrossRef]
- Sato, T. A Statistical Learning Method for Logic Programs with Distribution Semantics. In Proceedings of the Logic Programming: Twelfth International Conference on Logic Programming, Tokyo, Japan, 13–16 June 1995; Sterling, L., Ed.; MIT Press: Cambridge, MA, USA, 1995; pp. 715–729. [Google Scholar] [CrossRef] [Green Version]
- Sato, T.; Kameya, Y. PRISM: A language for symbolic-statistical modeling. In Proceedings of the 15th International Joint Conference on Artificial Intelligence (IJCAI 1997), Aichi, Japan, 23–29 August 1997; Volume 97, pp. 1330–1339. [Google Scholar]
- Koller, D.; Friedman, N. Probabilistic Graphical Models: Principles and Techniques; Adaptive Computation and Machine Learning; MIT Press: Cambridge, MA, USA, 2009. [Google Scholar]
- Darwiche, A.; Marquis, P. A Knowledge Compilation Map. J. Artif. Intell. Res.
**2002**, 17, 229–264. [Google Scholar] [CrossRef] - Riguzzi, F.; Swift, T. The PITA System: Tabling and Answer Subsumption for Reasoning under Uncertainty. Theor. Pract. Log. Prog.
**2011**, 11, 433–449. [Google Scholar] [CrossRef] [Green Version] - Riguzzi, F.; Bellodi, E.; Lamma, E.; Zese, R.; Cota, G. Probabilistic Logic Programming on the Web. Softw. Pract. Exper.
**2016**, 46, 1381–1396. [Google Scholar] [CrossRef] - Kakas, A.C.; Mancarella, P. Abductive logic programming. In Proceedings of the NACLP Workshop on Non-Monotonic Reasoning and Logic Programming, Austin, TX, USA, 1–2 November 1990. [Google Scholar]
- Eiter, T.; Gottlob, G. The Complexity of Logic-based Abduction. J. ACM
**1995**, 42, 3–42. [Google Scholar] [CrossRef] - Azzolini, D.; Bellodi, E.; Ferilli, S.; Riguzzi, F.; Zese, R. Abduction with probabilistic logic programming under the distribution semantics. Int. J. Approx. Reason.
**2022**, 142, 41–63. [Google Scholar] [CrossRef] - Azzolini, D.; Riguzzi, F. Optimizing Probabilities in Probabilistic Logic Programs. Theory Pract. Log. Program.
**2021**, 21, 543–556. [Google Scholar] [CrossRef] - Azzolini, D.; Riguzzi, F. Reducing Probabilistic Logic Programs. In Proceedings of the 15th International Rule Challenge, 7th Industry Track, and 5th Doctoral Consortium at RuleML+RR 2021 Co-Located with 17th Reasoning Web Summer School (RW 2021) and 13th DecisionCAMP 2021 as Part of Declarative AI 2021; Soylu, A., Nezhad, A.T., Nikolov, N., Toma, I., Fensel, A., Vennekens, J., Eds.; CEUR Workshop Proceedings; Sun SITE Central Europe: Aachen, Germany, 2021; Volume 2956, pp. 1–13. [Google Scholar]
- Humphries, M.D.; Gurney, K. Network ’Small-World-Ness’: A Quantitative Method for Determining Canonical Network Equivalence. PLoS ONE
**2008**, 3, e0002051. [Google Scholar] [CrossRef] [PubMed] - Hagberg, A.A.; Schult, D.A.; Swart, P.J. Exploring Network Structure, Dynamics, and Function using NetworkX. In Proceedings of the 7th Python in Science Conference, Pasadena, CA, USA, 19–24 August 2008; Varoquaux, G., Vaught, T., Millman, J., Eds.; Los Alamos National Lab.: Los Alamos, NM, USA, 2008; pp. 11–15. [Google Scholar]
- Bollobás, B.; Borgs, C.; Chayes, J.T.; Riordan, O. Directed scale-free graphs. In Proceedings of the Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, Baltimore, MD, USA, 12–14 January 2003; ACM/SIAM: Philadelphia, PA, USA, 2003; pp. 132–139. [Google Scholar]

**Figure 1.**Program and represented graph for Example 1. (

**a**) Program for deterministic path finding; (

**b**) graph representation.

**Figure 2.**Probabilistic logic program and correspondent BDD representation. (

**a**) probabilistic logic program; (

**b**) binary decision diagram.

**Figure 3.**Results for PEP experiment for nodes with active probability 1 and 0.95. Different lines represent different payment sizes. (

**a**) results for the PEP experiment with active probability set to 1; (

**b**) results for the PEP experiment with active probability set to 0.95.

**Figure 4.**Results for abductive experiments. Different lines represent different payment sizes Amt. (

**a**) variation of the PEP by increasing the number of nodes; (

**b**) variation of the ratio between selected abducibles to maximize the PEP and total abducibles by increasing the number of nodes.

**Figure 5.**Results for optimizable experiments with PEP > 0.6 and PEP > 0.7 for different payment sizes. (

**a**) results for PEP > 0.6; (

**b**) results for PEP > 0.7.

**Figure 6.**Results for optimizable experiments with PEP > 0.8 and PEP > 0.9 for different payment sizes. (

**a**) results for PEP > 0.8; (

**b**) results for PEP > 0.9.

**Figure 7.**Results for reducible experiments with PEP > 0.6 and PEP > 0.7 for different payment sizes. (

**a**) results for PEP > 0.6; (

**b**) results for PEP > 0.7.

**Figure 8.**Results for reducible experiments with PEP > 0.8 and PEP > 0.9 for different payment sizes. (

**a**) results for PEP > 0.8; (

**b**) results for PEP > 0.9.

**Table 1.**Average number of total edges for the path existence probability and abductive experiments.

Size | Abductive | Size | PEP |
---|---|---|---|

5 | 6.6 | 10 | 31.68 |

6 | 8.5 | 15 | 53.96 |

7 | 3.22 | 20 | 72.84 |

8 | 13.12 | 25 | 94.12 |

9 | 14.02 | 30 | 114.96 |

10 | 16.44 | 35 | 136.08 |

11 | 18.64 | 40 | 156.44 |

12 | 20.44 | 45 | 173.12 |

13 | 21.64 | 50 | 194.36 |

14 | 24.58 | 55 | 220.2 |

15 | 26.88 | 60 | 238.4 |

16 | 28.52 | 65 | 263.72 |

17 | 31.34 | 70 | 281.68 |

18 | 32.58 | 75 | 306.04 |

19 | 34.16 | 80 | 328.04 |

- | - | 85 | 351.2 |

- | - | 90 | 363.84 |

- | - | 95 | 397.44 |

Size | Optimizable | Reducible |
---|---|---|

5 | 6.62 | 6.64 |

6 | 8.66 | 8.52 |

7 | 10.44 | 9.9 |

8 | 12.2 | 12.38 |

9 | 13.64 | 14.64 |

10 | 16.24 | 15.74 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Azzolini, D.; Riguzzi, F.
Probabilistic Logic Models for the Lightning Network. *Cryptography* **2022**, *6*, 29.
https://doi.org/10.3390/cryptography6020029

**AMA Style**

Azzolini D, Riguzzi F.
Probabilistic Logic Models for the Lightning Network. *Cryptography*. 2022; 6(2):29.
https://doi.org/10.3390/cryptography6020029

**Chicago/Turabian Style**

Azzolini, Damiano, and Fabrizio Riguzzi.
2022. "Probabilistic Logic Models for the Lightning Network" *Cryptography* 6, no. 2: 29.
https://doi.org/10.3390/cryptography6020029