2023 Jan 21
Asked a question about failure messages in the LDK discord
Some notes from Saylor academy:
The bullish case for bitcoin
4 stages of a monetary good serving as money: collectible, store of value, medium of exchange, unit of account
The price is uncorrelated to its utility, but just to its adoption (which you could argue is it’s utility) - generally it seems like a bubble, but monetary goods are just priced very differently.
After there is wide consensus of Bitcoin as a store of value, volatility decreases and makes it easier to use as a medium of exchange.
New helix things:
space+a
pulls up actions on diagnostics, in file pickerC-v
opens and vertical splitsHow LDK does payment preimages: the user can supply a hash, and then they’re responsible for storing and providing it, however if they don’t supply it, LDK can create one. I noticed the return value for their function
create_inbound_payment
only hadResult<(PaymentHash, PaymentSecret)
. Where wasPaymentPreimage
? I realized, the preimage is just an HMAC of some metadata, so they don’t have to store anything, yet are able to verify the preimage when a payment is received. Clever!Started to review using Mastering Lightning. Got pretty distracted heh.
Creating a channel is composed of 6 messages: open_channel, accept_channel, funding_created, funding_signed, funding_locked, funding_locked.
LDK exposes a
create_channel
function that makes opening a channel easy. I was trying to find where it actually sends messages like open_channel, so I did some digging. When creating a channel, it actually just creates the channel state in channelmanager, then pushes a msg event to signal to the peer handler to send the message. The peer handler has a function poll_events (or something like that) that either the user or some nicely packaged language bindings will need to call, that spawns some thread that actually handles the events and sends bytes over the TCP socket. Events are everywhere in LDK.Review: SegWit was important for lightning because txids need to be known in order to create commitment transactions to sign before opening the channel!
Did another cryptopals challenge, number 9. Struggled a lot for no good reason on challenge 10, think its an issue with openssl versioning. Going to try to switch to a different package or something next time I work on it. Ugh.