Explain mSats to me like I'm a hungover computer science undergrad

#asknostr

Reply to this note

Please Login to reply.

Discussion

Divide a sat by 1000. That’s an msat.

Gee thanks!

You know how the price of gas/petrol seems to include a fraction of a cent/penny?

There is no half pence anymore but your petrol bill can go: 1.5p, 3p, 4.5p... and then get rounded up or down at the end. If you didn't have the fractional penny, then you couldn't go from 1p to 3p, it would go 1p, 2p. So petrol stations benefit when batching fractional units of a good and consumers do too, because without fractional units, the price would just be 2p, 4p, 6p...

So bitcoin only has sats, but in lightning, you are going to make lots of incoming and outgoing payments and when you ever close the channel, you will settle to sats then.

Until then, we can be a little more expressive and allow for subunits of bitcoin which we find useful for keeping routing fees low and accurate.

1sat = 1000msats.

Is it like a second UTXO?

How is the msat expressed cryptographic ly

No. A lightning channel is 1 UTXO, lets say it is 1BTC.

Then we have 2 computers (Lightning nodes) that have copies of pre-signed transactions that will divvy up the balance based on what we agree, so let's say:

Me: 0.49999999BTC

You: 0.49999999BTC

fees: 0.00000002BTC

(Obv 2sat fee is unrealistic but small numbers help me math)

We also have an unofficially agreed balance between us, so actually, the balance is:

Me: 0.49999999,400BTC

You: 0.49999999,600BTC

Note that millisats always get rounded down even when it is more than 500msats

So it becomes useful when I make a payment to someone for 1000 sats and the fee you charge is 600msats

New balance becomes:

Me: 0.49998998,800BTC

You: 0.50001000,200BTC

Without the fee, it would be:

0.49998999,400

0.50000999,600

Keeping in mind that we always drop the msats when we settle, you just got an extra sat from the transaction. If the balances were different, then I might have saved a sat.

My point is, that while the channel is open, the msats add up in either direction but until the msats you see in your balance add up to a sat, you really don't have any extra money other than a subunit that will help get you the next sat in the next transaction.

After the 1000sat with 600msat fee transaction, we both have a new set of pre-signed transactions:

Me: 0.49998998BTC

You: 0.50001000BTC

fees: 0.00000002BTC

After every transaction, we both have enough data to just exit if we ever disagree on something.

So the msats aren't technically cryptographically secure, but we can both do maths, and if we disagree about the result balance after a transaction, like I believe I should have 1 sat more and you disagree, then the payment just fails and whoever feels cheated can just exit using the last agreed balance.

Nothing lost except a relationship between you and I. You will most likely no longer trust my node and you'll open a channel with someone else and you can always make the payment again through another channel or wallet or whatever because the transaction never completes unless we both agree... we keep each other accountable.

We don't find many (if any) nodes trying to cheat this way in the wild because it hardly benefits anyone.

So, msats don't exist on chain. I agree with the utility, but is this contrary to the fungability and public ledger that makes Bitcoin so Bitcoin? Could be LN is just one step on a slippery slope. Are msats the second step?

I agree that msats are not as clear to most people as it should be, but LN is not on any slippery slope afaik.

The reason is that every payment on LN is atomic, meaning it can't fail half way, while at the same time, all completed payments will result in "close transactions" that basically give either participant to unilaterally exit on chain without the need for any coordination with their peer and without permission.

The nature of LN using co-signed bitcoin transactions to back its state at all times means that LN is BTC.

With the caveat that msats are not.

Fungibility: satoshis are fungible. On the lightning network, if I send bob 1 sat to give alice to give you, then bob will get my sat, but you will technically get yours from alice. Sounds pretty fungible to me if Alice's sat is equivalent to mine.

Public ledger: the purpose of having a public ledger is for one reason alone: how do we know that there are no extra units of Bitcoin being produced in a block? Bitcoin data has a massive amount of integrity, transactions are signed, blocks provide order backed by energy.

A transaction on chain must always balance out, N BTC in, N BTC out (when including fees). Not only that, but we must ensure that signatures match utxos so that you can't spend my bitcoin ans vice versa.

But a utxo can belong to multiple people, and a transaction can simply represent a settlement of many economic transactions. LN allows us to perform many economic transactions over time and settle only when necessary due to its technical assurances that ensure you cannot get rugged even if you keep a channel open for a long time.

This is a performance optimisation that leads to cheaper more affordable use of bitcoin. In this model: while the base layer will enforce with 100% scrutiny that settlements are sound, a transaction backed state and a protocol that requires coordination to change the state with a 2-party system (not as easy for 3 or more), is how the intermediate transactions are kept sound.

In a 2 party system, I keep you accountable, you keep me accountable, and there is no majority voting system to game. And in the global scale, Bitcoin itself ensures that even if we work together, we cannot cheat the base layer.