<p>It is worth to point out that depending on the implementations of the nodes in the route, the path lenght limit could be lower than 20. This is due to the cltv_expiry_delta reduction at each hop that could become negative before the 20 hops.</p>

CC BY-SA 4.0
2019-12-18T16:40:48.450Z
2019-12-18T16:40:48.450Z
jordi
<p>The onion routing in Lightning is based on the Sphinx Mix Format <a href="https://cypherpunks.ca/~iang/pubs/Sphinx_Oakland09.pdf" rel="nofollow noreferrer">described in this paper</a>. The situation is different from Tor </p>

<ul>
<li>We don't have entry and exit nodes in Lightning as all nodes are inside the Network. </li>
<li>In Tor a new connection along the path is as easy as creating a TCP socket between the tor routing nodes. In Lightning a payment channel with enough liquidity would have to be available and can't be spawn instantaneously.</li>
</ul>

<p>The latter argument already calls for longer paths as nodes cannot just ask routing nodes to make certain hops. (That might change though if the trampoline network is coming to Lightning with which your Tor argument might hold.) Let us additionally assume I would always have paths of length 3 in Lightning. A routing node would basically see who paid whom as there are the incoming and outgoing HTLCs.</p>

<p>The main reasons for the Sphinx packet to be 20 hops are - as far as I understand - the following:</p>

<ol>
<li>The per hop data is 65 Byte and with 20 hops it will always fit into a small TCP/IP package giving no clues for traffic analysis and timing attacks. </li>
<li>We assume that the Lightning Network will still somehow be a small world network with a rather small diameter, so 20 hops should be sufficient. </li>
</ol>

CC BY-SA 4.0
2019-12-03T10:58:46.507Z
Has anyone done any calculations on whether a smaller number of hops would also be sufficient?
Sergei Tikhomirov
CC BY-SA 4.0
2019-12-03T12:03:49.763Z
if you look at 41m twitter users with more than a billion edges http://konect.uni-koblenz.de/networks/twitter you will see that the diameter is 23. in that case not everyone would be able to pay everyone. However looking at https://en.wikipedia.org/wiki/Six_degrees_of_separation which has been validated even by facebook https://research.fb.com/blog/2016/02/three-and-a-half-degrees-of-separation/ also in a lightning network it seems safe to assume that you should be able to reach about anyone with 6 hops. https://bitcoinvisuals.com/ln-eccentricity shows  the diameter was always below 10
Rene Pickhardt
CC BY-SA 4.0
2019-12-02T18:09:48.570Z
2019-12-03T10:48:07.960Z
2019-12-03T10:48:07.960Z
Rene Pickhardt
<p>A sender in the Lightning network can choose a path with up to 20 intermediaries (<a href="https://github.com/lightningnetwork/lightning-rfc/blob/6e1bea0d4868cb55fae7590975ae593a228ad3fe/04-onion-routing.md#requirements-2" rel="nofollow noreferrer">BOLT4</a>).</p>

<p>Tor is another network that uses onion routing for anonymity. However, in Tor all paths have 3 intermediaries, and longer paths are explicitly advised against (<a href="https://2019.www.torproject.org/docs/faq.html.en#ChoosePathLength" rel="nofollow noreferrer">source 1</a>, <a href="https://tor.stackexchange.com/questions/103/is-it-possible-to-make-the-tor-onion-routing-path-longer">source 2</a>). The sources make a point that attacks mostly rely on compromising the first and the last nodes, and increasing the number of nodes in between doesn't improve anonymity, but increases latency. </p>

<p>Do similar arguments apply to Lightning (maybe for path of slightly higher lengths but still under 20 hops)? Where does the number 20 come from? Would it be a good idea to decrease it?</p>

<lightning-network><privacy><lightning-routing><tor>
What is the rationale for the Lightning network's path length limit (20 hops)?
Sergei Tikhomirov
# What is the rationale for the Lightning network's path length limit (20 hops)?

(Asked by: username_0 on 2019-12-02)

A sender in the Lightning network can choose a path with up to 20 intermediaries ([BOLT4](https://github.com/lightningnetwork/lightning-rfc/blob/6e1bea0d4868cb55fae7590975ae593a228ad3fe/04-onion-routing.md#requirements-2)).

Tor is another network that uses onion routing for anonymity. However, in Tor all paths have 3 intermediaries, and longer paths are explicitly advised against ([source 1](https://2019.www.torproject.org/docs/faq.html.en#ChoosePathLength), [source 2](https://tor.stackexchange.com/questions/103/is-it-possible-to-make-the-tor-onion-routing-path-longer)). The sources make a point that attacks mostly rely on compromising the first and the last nodes, and increasing the number of nodes in between doesn't improve anonymity, but increases latency.

Do similar arguments apply to Lightning (maybe for path of slightly higher lengths but still under 20 hops)? Where does the number 20 come from? Would it be a good idea to decrease it?

**Tags:** lightning-network, privacy, lightning-routing, tor


---

## 2 answers

### Answer by username_2 on 2019-12-02. Score: 6 | Accepted answer

The onion routing in Lightning is based on the Sphinx Mix Format [described in this paper](https://cypherpunks.ca/~iang/pubs/Sphinx_Oakland09.pdf). The situation is different from Tor

* We don't have entry and exit nodes in Lightning as all nodes are inside the Network.
* In Tor a new connection along the path is as easy as creating a TCP socket between the tor routing nodes. In Lightning a payment channel with enough liquidity would have to be available and can't be spawn instantaneously.

The latter argument already calls for longer paths as nodes cannot just ask routing nodes to make certain hops. (That might change though if the trampoline network is coming to Lightning with which your Tor argument might hold.) Let us additionally assume I would always have paths of length 3 in Lightning. A routing node would basically see who paid whom as there are the incoming and outgoing HTLCs.

The main reasons for the Sphinx packet to be 20 hops are - as far as I understand - the following:

1. The per hop data is 65 Byte and with 20 hops it will always fit into a small TCP/IP package giving no clues for traffic analysis and timing attacks.
2. We assume that the Lightning Network will still somehow be a small world network with a rather small diameter, so 20 hops should be sufficient.

> **Comments:**
> **username_0**: Has anyone done any calculations on whether a smaller number of hops would also be sufficient?  
> **username_2**: if you look at 41m twitter users with more than a billion edges http://konect.uni-koblenz.de/networks/twitter you will see that the diameter is 23. in that case not everyone would be able to pay everyone. However looking at https://en.wikipedia.org/wiki/Six_degrees_of_separation which has been validated even by facebook https://research.fb.com/blog/2016/02/three-and-a-half-degrees-of-separation/ also in a lightning network it seems safe to assume that you should be able to reach about anyone with 6 hops. https://bitcoinvisuals.com/ln-eccentricity shows  the diameter was always below 10  

---

### Answer by username_1 on 2019-12-18. Score: 0

It is worth to point out that depending on the implementations of the nodes in the route, the path lenght limit could be lower than 20. This is due to the cltv\_expiry\_delta reduction at each hop that could become negative before the 20 hops.


---

