Chapter 8. Routing on a Network of Payment Channels

In this chapter we will finally unpack how payment channels can be connected to form a network of payment channels via a process called routing. Specifically, we will look at the first part of the routing layer, the “Atomic and trustless multihop contracts” protocol. This is highlighted by an outline in the protocol suite, shown in Figure 8-1.

Atomic payment routing in the Lightning protocol suite
Figure 8-1. Atomic payment routing in the Lightning protocol suite

Routing a Payment

In this section we will examine routing from the perspective of Dina, a gamer who receives donations from her fans while she streams her game sessions.

The innovation of routed payment channels allows Dina to receive tips without maintaining a separate channel with every one of her fans who want to tip her. As long as there exists a path of well-funded channels from that viewer to Dina, she will be able to receive payment from that fan.

In Figure 8-2 we see a possible network layout created by various payment channels between Lightning nodes. Everyone in this diagram can send Dina a payment by constructing a path. Imagine that Fan 4 wants to send Dina a payment. Do you see the path that could allow that to happen? Fan 4 could route a payment to Dina via Fan 3, Bob, and Chan. Similarly, Alice could route a payment to Dina via Bob and Chan.

Figure 8-2. Fans connected (in)directly to Dina on the Lightning ...

Get Mastering the Lightning Network now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.