Gossip Network
2 min read
For nodes along the network to successfully send and receive payments from each other, they must first know where their counterparties are, and how to create paths to one another.
Generally speaking, a gossip protocol is a process of computer peer-to-peer communication via information diffusion to such an extent that data is disseminated to every peer in the network.
Lightning nodes have two main roles: establishing payment channels with other nodes, and gossiping about those channels. To accomplish the second part, the Lightning network leverages its own gossip protocol to share information about peer nodes and their positions.
Other information communicated through Lightning’s gossip network:
- Details about each public channel in the network
- How the channel can be verified on the blockchain – e.g. location of the funding transaction
- Proof that channel counterparties control the bitcoin locked in the channel
- Node Alias – its public name, e.g. “River Financial 1”
- Features the node supports
- The fees associated with routing payments through that particular channel
Nodes typically broadcast one of three distinct messages to the network, these are called announcements. Each announcement is signed and then forwarded to the announcer’s peers who validate the message and pass it along until the information is disseminated across the network.
channel_announcement
: This announcement is done (or not done) cooperatively by both peers, it proves that the channel exists on the blockchain by referencing the funding transaction, and establishes which nodes own the funds associated.channel_update
: Once a channel is open, each party can update it unilaterally. This enables counterparties to adjust terms or disable a channel when its peer is offline. Fees and HTLC rules are some parameters that can be changed here.node_announcement
: These can only be made by nodes that have previously announced a channel. The node will include information like its alias, how to reach it, and the features it supports.
Image source: https://lnrouter.app/graph
All of the information passed around the Lightning Network’s gossip protocol is crucial for nodes to draw themselves a map of the network. The visualization of nodes and their channels is referred to as the Lightning Network Graph and is how payment routes are established.