Analysis of the channel funding transaction
Some steps to search the funding output of a Lightning Channel from the short channel ID
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.
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:
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.
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.
Ottimo Prof, ma perchè non non incolli un QR code lnurl ... cosi ti possiamo offrire una birretta?