The specification of the
short_channel_id describes the format as follows:
short_channel_id is the unique description of the funding transaction. It is constructed as follows:
- the most significant 3 bytes: indicating the block height
- the next 3 bytes: indicating the transaction index within the block
- the least significant 2 bytes: indicating the output index that pays to the channel.
Hence to convert between the two formats you can use the following python snippets:
block = s >> 40
tx = s >> 16 & 0xFFFFFF
output = s & 0xFFFF
return (block, tx, output)
s = [int(i) for i in s.split('x')]
return (s << 40) | (s << 16) | s
The reason we (c-lightning) use the dotted format is because it allows us to look up the funding TX without having to do a conversion (and it usually is shorter than the
xas a separator instead of
:while colon was very readable the short channel ids that use x as a separator are doubleclickable.