Lightning Network Basics — Part 6

uenohiro4
Nayuta Engineering Blog
3 min readOct 31, 2022

I will present the basic technical details of the Lightning Network over the course of several articles.

In this article, I will explain the messages that discover nodes and channels.

Overview

In Lightning Network, the forwarding source node creates a route to the destination node. This means that the forwarding LN node needs to know the channels on the network. Channel information is often updated as channels are closed or transfer fees change.

BOLT#7 explains how to communicate LN nodes and channels.

There are three main messages:

  • channel_announcement : channel information
  • channel_update : channel update information
  • node_announcement : node information

Channel

channel_announcement is a message that informs about the channel itself. The main information is as follows:

  • The chain it belongs to (Bitcoin mainnet/testnet, etc.)
  • Channel ID
  • LN nodes at both ends of the channel

The message size is relatively large, as it is signed by a number of signatures to prevent forgery.

Information that is updated after channel creation, such as fees, is notified in the channel_updatemessage.

  • Channel ID
  • Update date
  • CLTV Expiration
  • Minimum Transfer Amount
  • Base commission
  • Fee per million sat

Below is an example of these data as they appear in 1ML.

NayutaHub01 — NayutaHub03 channel

Public/Private channel

channel_announcementis exposed throughout the Lightning Network and may be used for routing transfers.

On the other hand, channels that are not expected to be routed are not expanded in channel_announcement. For example, mobile Lightning wallets are most likely to be private.

If you want a transfer to be routed through a private channel, you can put the routing information on the invoice data you create in the transfer request and tell the transfer source.

Channel ID

There are two types of channel IDs.

  • channel_id : made from the TXID of the funding transaction and the output index (32 bytes). It is used for inter-channel messages.
  • short_channel_id : made from the block number where the funding transaction was confirmed, the index in the block, and the output index (8 bytes). It is used for routing and other purposes.

In this article, “channel id” is short_channel_id, and so is the Channel Id shown in 1ML and so on.

Recently, alias of short_channel_idcan be used under certain conditions, in which case a value that is not associated with a block or the like is used.

Node

LN node information is expanded in the node_announcementmessage. In the case of private channels, either LN node will often be private as well.

Advertising channel information

In order to have their channels forwarded to them in the Lightning Network, LN nodes need to advertise their channel information widely in the Lightning Network. And channel information is often updated and advertised each time.

--

--