Is there a way to retrieve the Channel_ID knowing the Short_Channel_ID without using any lightning network explorer?

How is the Short_Channel_ID calculated? Is this operation reversible?


The short_channel_id points to the funding transaction of the payment channel by the format blockheightxtransaction_indexxoutput where the x is used to seperate the 3 values and the three values are depicted in decimal. This is at least the BOLT 1.1 agreed format for the short channel id. Previously the shortchannel id might have been encoded and depicted differently depending on the implementation. For example c-lightning used a colon instead of an x to separate these fields.

According to BOLT02 the channel_id is created as follows:

This message introduces the channel_id to identify the channel. It's derived from the funding transaction by combining thefunding_txidand thefunding_output_index, using big-endian exclusive-OR (i.e.funding_output_index` alters the last 2 bytes).

as the funding_txid is a hash of its fields this has no relation with the short channel id. So without looking at the blockchain data I believe it is impossible transfer the short_channel_id to the channel_id or back.

  • Thanks Rene for your answer and pointing to the Bolt. It's still unclear to me. A channel id looks something like: "channel_id":"565048921200525312" (a random node token from a recent snapshot). If you XOR a transaction hash and a 2 byte number how could you get a channel id like that one? It's too long to be a 2 byte number and too short to be a number derived from a 32-byte hash. Sep 19 '19 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.