LN Capital Profile picture
Dec 20 13 tweets 4 min read
The magic of the Lightning Network is built on HTLCs

But most Bitcoiners don't know how they work.

Quick thread:
HTLC stands for “Hash Time-Lock Contract”

In short, HTLCs are programmable smart contracts that create atomic trustless transactions between peers on the Lightning Network.
HTLCs are conditional payments that say “I will pay you [x+1] satoshis if you prove you’ve forwarded [x] satoshis”.

(the +1 would be the routing fee in this scenario)
HTLCs have two main components:

1. The Secret (also called a preimage)
2. The Payment Hash (a SHA-256 hash of the secret)
Here are some visuals to help you understand:

Alice, Bob, Carol, and Dave all have channels with each other.

But how do we ensure that a payment will get from Alice to Dave?
1/

Alice requests an invoice from Dave.

Dave generates a random secret (the preimage), and sends a SHA-256 hash of the secret to Alice (the payment hash).
2/

Alice sends a Hash Time-Lock Contract containing the payment hash to Bob.
3/

Bob creates a new HTLC and forwards it to Carol.

Each HTLC contains the original payment hash, the hash of Dave's secret.

Carol repeats the process, forwarding a new HTLC to Dave.
4/

Dave then reveals the secret to Carol, which unlocks the funds from Carol to Dave.
5/

Carol sends the secret to Bob, then Bob sends it to Alice, unlocking funds along the rest of the chain.
If any disputes arise in this process, the transaction is broadcasted on-chain, and the funds are settled that way.

This settlement mechanism was programmed into the HTLC from the start.

This is what makes Lightning Network trustless.
That’s it!

Now you know what an HTLC is and how they work on LN😄

HTLCs are quite complex, so we had to simplify a lot here. Let us know if you want part 2!

Like & retweet if this was valuable!
Psssst... If you’re running a #LightningNetwork node you should take a look at Torq.

github.com/lncapital/torq

• • •

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

Keep Current with LN Capital

LN Capital 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 @LN_Capital

Dec 18
Pickhardt Payments will supercharge the Lightning Network.

Here's how:
Payments over LN can happen in two ways:

1. Direct (node to node)
2. Indirect (node THROUGH node)

When sending an indirect payment, i.e, you don’t have a channel open with the recipient, your payment is ‘routed’ through an intermediate node or nodes.
But with 75,000 channels & 15,000 nodes, how do we choose the best route to send the payment?

@lightning’s LND implementation currently uses Dijkstra's algorithm for pathfinding (not the exact algo, but similar).
Read 19 tweets
Dec 11
“Lightning Node Operator” is the most important job title of this decade.

But when it comes to running a node, 99% of bitcoiners have no idea where to start.

Here are 10 routing tips for beginners:
1. Start small, build slowly.

Low👏Time👏Preference👏

Running a node is about building relationships & reputation.

Take your time finding good peers that won’t close a channel on you.
2. Inbound liquidity is essential.

@lncyberhub wrote a great guide on how to get it:

cyberhubnode.notion.site/cyberhubnode/H…
Read 12 tweets
Dec 8
Awesome space today w/ @dannydiekroeger @LNcyberhub @1sats_ln @c_otto83 @renepickhardt

Here's a quick summary in case you missed it:

(thread)
@LNcyberhub ran into performance issues with his raspi (page refresh and reports were super slow), switched to a ryzen 7🔥
@dannydiekroeger suggested that nodes could offer individual bonds as opposed to a singular Lightning Reference Rate.

More info on LNRR here:
Read 10 tweets
Dec 8
The Lightning Network will revolutionize capital markets.

But first it needs to develop its own.

Let’s take a quick look at the idea of a Lightning Network Reference Rate (LNRR):
The Lightning Network Reference Rate is a term coined by Nik Bhatia (@timevalueofbtc) in an article of the same name.

It outlines a protocol for determining the risk-free rate for off-chain bitcoin lending.

I’ll link his article at the end of this thread for those interested.
In short, the LNRR is an average of multiple Node Accrual Rates (NARs)

A node accrual rate is simply the annual rate of interest that a particular node generates from routing sats over Lightning.

NARs can be calculated with the following formula from @timevalueofbtc’s article:
Read 10 tweets
Dec 6
Onion Routing is a revolutionary cypherpunk technology.

But most Bitcoiners have no idea how it works or why it’s important.

Quick thread: Image
Onion routing is a method for anonymous communication over a computer network.

It’s called "onion routing" because it uses a layered approach to encrypting and transmitting data, similar to the layers of an onion.
The main idea behind onion routing is to protect the privacy of users by making it difficult for anyone to trace the origin or destination of a message.
Read 8 tweets
Dec 4
Lightning is the future. But it’s not perfect yet.

One well-known issue on LN is called “channel jamming”

But what is channel jamming and how can we fix it?

Thread:
Channel jamming is a type of Denial of Service (DoS) attack.

The goal of the attack is to make a Lightning channel unusable.

The attacker accomplishes this goal by sending fake payments to themselves, and allowing the payments to fail.
How do they let the payment fail?

LN transactions happen in two phases:

1. The sender locks funds along a route

2. The receiver releases their “secret” (pre-image), and funds are shifted to the receiver as the secret travels back across the route
Read 20 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

Don't want to be a Premium member but still want to support us?

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!

:(