GO! massmux.org

Share this post

Analysis of the channel funding transaction

massmux.org

Discover more from GO! massmux.org

Tips, Snippets, Notes, Code and more about Bitcoin, Lightning Network and Nostr
Continue reading
Sign in

Analysis of the channel funding transaction

Some steps to search the funding output of a Lightning Channel from the short channel ID

Massimo Musumeci
Jun 5, 2023
4
Share this post

Analysis of the channel funding transaction

massmux.org
3
Share

I recently made a video (just in italian) where i showed a simple analysis of a funding transaction using chain and gossip data. In particular i used the channel ID to find the output on the Bitcoin blockchain.

Let’s do these steps here again.

Thanks for reading GO! massmux! Subscribe for free to receive new posts and support my work.

First of all, in the Lightning gossip, we have to consider the “channel_announcement” message. This message, in general, looks like as follow:

<blockheight>x<transaction index>x<output>

So let’s check this out in a real existing channel. for example let’s consider this big channel between ACINQ and Wallet of Satoshi:

short channel id: 777477x916x0. On amboss, we can search the channel by that ID or we can reach the channel-id by searching on the Acinq public channels’ topology. This is what you finally get:

Amboss channel page

Now let’s remember what we described above. So we are searching for an output which is in block 777477, transaction 916 and output index 0. We can use a Bitcoin code node to search it.

Get the block hash

root@go:~/# bitcoin-cli.sh getblockhash 777477

00000000000000000003a351f919494fb60c649a989056e3a95ff6a8bfc179c5

Now we can search the tx in this block:

root@go:~/# ./bitcoin-cli.sh getblock 00000000000000000003a351f919494fb60c649a989056e3a95ff6a8bfc179c5 |jq .tx |awk 'FNR==918'              

 "496f3c8459b024ded53ecf2652bbe7a1ac05403f3268a4901152035e9e094924",

Please bear in mind that we search the line 918 because we start from 0 and there is also an unwanted line. So we got:

496f3c8459b024ded53ecf2652bbe7a1ac05403f3268a4901152035e9e094924

Now just search this txid in a blockchain explorer like blockstream.info . This is the transaction.

Exploring the transaction through blockstream explorer

Now just find the output with index 0, and you can see a 2 bitcoin output, which is infact the output we were searching for. Infact if you give a look at amboss (first image above) you can see that the output shown matches.

I hope this was useful to understand how it really works. Normally seeing practical steps may be really helpful.

Subscribe to this newsletter in order not to lose the next articles, snippets and info we pulish here and on my blog: https://massmux.com . Stay tuned.

Thanks for reading GO! massmux! Subscribe for free to receive new posts and support my work.

4
Share this post

Analysis of the channel funding transaction

massmux.org
3
Share
3 Comments
Share this discussion

Analysis of the channel funding transaction

massmux.org
Gubinelli Simone
Writes Gubinelli’s Substack
Jun 6Liked by Massimo Musumeci

Ottimo Prof, ma perchè non non incolli un QR code lnurl ... cosi ti possiamo offrire una birretta?

Expand full comment
Reply
Share
2 replies by Massimo Musumeci and others
2 more comments...
Top
New
Community

No posts

Ready for more?

© 2023 Massimo Musumeci
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing