ellemouton / website

https://ellemouton.com/
0 stars 1 forks source link

posts/htlc-deep-dive/ #13

Open utterances-bot opened 6 months ago

utterances-bot commented 6 months ago

LN Things Part 5: HTLC Deep Dive | Elle Mouton

Day 7 of #7DaysOfBitcoin

https://www.ellemouton.com/posts/htlc-deep-dive/

st4rgut24 commented 6 months ago

Excellent explanation. In the last diagram, both the sender and receiver have their own versions of the HTLC success and timeout transactions right?

Also, I believe there is a typo in this line ('change' instead of 'chance') : Bob knows the pre-image but now has to wait to_self_delay blocks in order to spend from the hash-locked path then there is a change that this to_self_delay

ellemouton commented 4 months ago

both the sender and receiver have their own versions of the HTLC success and timeout transactions right?

yes - this post is just an overview. See the next post (https://ellemouton.com/posts/htlc-deep-dive/) for a deep dive into the structure of the two commitment transactions.

Thanks for pointing out the typo! Fixed :)

tlulu commented 1 month ago

This is the best explanation on HTLCs that I've seen! Very easy to understand.

If there are say 100 in-flight HTLCs, would there be 100 additional outputs in the commitment transaction? How does the commitment transaction look like after the HTLCs are successful or times out? Would the commitment transaction still have 100 additional outputs or just two (to_local & to_remote)?

ellemouton commented 1 month ago

Glad you liked it @tlulu !

I think a good follow up post that would help you understand what the commitment transaction looks like after HTLC successes/failures would be this one: https://ellemouton.com/posts/normal-operation-pre-taproot/

To quickly answer your question: yes, if there are 100 in-flight HTLCs, there will be 100 outputs on the tx. These can be removed though once the htlc fails/succeeds as long as both sides commit to the new state that commits/discards the htlcs