🧙‍♂️
Did you know it’s technically possible for your lightning channel partner to attempt to steal money that is supposed to belong to you?

Let me explain how that’s possible and why they likely won’t try it 👇
To understand why this is possible we need to understand how payments are made over lightning channels.

Let’s imagine Alice opens a 100,000 sat channel with Bob by funding a 2-of-2 multisig address that can only be spent from using both Alice and Bob’s signature.
Before Alice locks her funds in the multisig they create a commitment tx that spends from the multisig address sending Alice her 100,000 sats and 0 sats to Bob.

She gets Bob to sign it but doesn't broadcast it so she can get her money out of the multisig if Bob disappears.
As payments are made over the channel, these commitment transactions are how the balance of who is owed what is maintained.

This means at any time either party can broadcast the latest commitment tx to the chain and both parties will receive exactly what they are owed.
Whenever a payment is made over the channel they need to agree on a new commitment transaction that reflects the new state.

For example, if Alice wants to send 10,000 sats to Bob they will construct and sign a new commitment tx that has 90,000 to Alice and 10,000 to Bob.
If Alice then wants to send another 15,000 sats to Bob they construct yet another commitment transaction that has 75,000 to Alice and 25,000 to Bob.

This process continues until the channel is closed.

So how can Alice try to take money that is supposed to be owned by Bob?
Because each of these commitment transactions are signed and can be broadcast at any time to the network, Alice could try to broadcast any of the old commitment transactions where she had more money than she does now. These are all valid transactions the network would accept.
So how does the lightning network prevent Alice from doing this?

Each commitment tx includes an extra spending condition that allows the other party to take ALL of the funds in the channel if they know the revocation secret.
Before signing a new commitment tx you must make sure to obtain your channel partner's revocation secret for the previous transaction.

Once obtained you know that if your counter-party broadcasts the previous state you will be able to use the secret to take all of their funds.
The risk of losing all of their funds keeps someone from trying to broadcast an old state that pays them more money than they are truly owed.

I hope this helps you better understand the mechanics of the lightning network. Please let me know if you have any questions below!

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with John Cantrell

John Cantrell Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @JohnCantrell97

11 Jan
You’ve decided it makes sense to own some Bitcoin, congrats! You took an important step but you might be wondering…

What do I really own?
Where and what exactly are the coins?

I’ve been working on Bitcoin for years, let me help explain it in simple terms 👇
First things first, if your Bitcoin is still on an exchange or some other custodial service then you don’t really own any Bitcoin. You own a promise or an IOU that will hopefully be redeemable for Bitcoin some day.

Not your keys, not your coins. A thread for another day.
Ok so you have your keys but what coins do you actually have?

There’s not some record in a database that says “Alice owns X Bitcoins”.

Technically, you have keys that can sign a transaction that spends an unspent transaction output (UTXO).

Let’s further break that down:
Read 8 tweets
9 Jan
1/13
Bitcoin Mining and Proof of Work Explained

Mining is often talked about in the media as some dark art that involves ‘solving complicated math problems’ but in reality it’s pretty easy to understand.

Let me break it down for you 👇
2/ Miners need to show proof that they’ve done a certain amount of work in order for the block they are mining to be valid. When you mine a block you earn the current period’s mining reward (currently 6.25 BTC) and all of the fees from the transactions they include in the block.
3/ So how can one prove they’ve done a certain amount of work without anyone there to watch them do it? Well, they can find the answer to a problem that we know takes them a certain amount of work to solve. There are lots of things that could be used to prove someone did work.
Read 13 tweets
8 Jan
You’ve probably heard Bitcoin lets you send money for free. You’ve also probably heard Bitcoin transactions are too expensive.

What’s going on here and why is there so much confusion around the cost to send Bitcoin? It’s kind of complicated, so let me break it down for you 👇
Technically it’s possible to make a Bitcoin transaction for free but in practice it’s really difficult. There’s nothing stopping miners from including transactions that do not pay a fee but most nodes on the network won’t relay transactions with a fee under a certain amount.
This means you either need to be a miner or somehow send your transaction directly to a miner. The latter case is still unlikely to work unless the miner is your friend because miner’s are incentivized to include transactions that pay them the most in fees.
Read 15 tweets
7 Jan
If you’ve spent any time researching Bitcoin then you’ve probably heard about the Lightning Network but…

Why does it exist?
What is it?
How does it help Bitcoin scale?

I’ve been working with it for years, let me help explain it in simple terms 👇
Bitcoin produces blocks every 10 mins and they can hold a limited number of transactions. This limited space creates a fee market where users can bid for their transactions to be included in a block. This means transactions take at least 10 minutes and must pay fees to miners.
The Lightning Network is a p2p network of payment channels

A payment channel is a contract between two people where they commit funds using a single onchain tx. Once the funds are committed they can make an unlimited amount of instant & free payments over the channel.
Read 14 tweets
6 Jan
The Fundamental Trade-Off Between Scalability and Decentralization And Why I’m Focused On Bitcoin

A core principle in Bitcoin is that every participant keeps a copy of the ledger and is able to verify every change made to that ledger. Without this we must trust someone else.
Decentralization is not a binary value but more of a sliding scale. It’s closely related to the number of participants in a system that can keep a copy of the ledger and are able to verify it. More participants, more decentralization. Less participants, less decentralization.
Like decentralization, scalability is also not a binary value. In monetary systems like Bitcoin, most people refer to scalability in terms of the number of transactions it can handle per time period. The more transactions it can process per second, the more scalable the system
Read 12 tweets
5 Jan
How Will We Onboard Earth’s 7.753 Billion People To The Lightning Network?

I ran the numbers, let’s see how we can onboard the entire population of Earth onto the Lightning Network, how long it might take, and what we can do to speed the process up 👇
To onboard onto the lightning network it requires sending btc into a 2-of-2 multisig funding transaction with your channel partner. To optimize space in this transaction we want 1 native segwit input and a single channel funding output. This produces a tx of roughly 121vbytes.
If 100% of the transactions in a block were these channel opening txs we could onboard about 8,264 people to lightning per block. With a global population of 7.753 billion people it would take roughly 938,166 blocks or 17.8 YEARS for everyone on Earth to have a channel.
Read 10 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(