The Lightning Network is an off-chain network, offering numerous benefits to Bitcoin. The Lightning Network will debut in 2018. Yet, it has been in development since 2016. First, we will explain what the Lightning Network is. Then, we will explain the benefits of the Lightning Network. Last, we will cover the counter arguments and attack risks.
What is an off-chain transaction?
An off-chain transaction is any bitcoin transaction which does not use
the Bitcoin Network, and thus pays no Bitcoin transaction fees to
miners. Buying and selling on exchanges, for example, occurs off
chain. However, withdrawing from on exchange to a bitcoin address
occurs “on-chain.”
All transactions that occur on the Lightning Network will be “off-chain” transactions.
How does the Lightning Network, work?
Lightning has three ingredients:
Payment channels
Hashed-time-locked-contracts (smart contracts)
The Lightning protocol
We enter the Lightning Network by opening a payment channel. This
entry requires an on-chain Bitcoin transaction. Payment channels have
existed since the beginning of Bitcoin.
Payment channels allow two parties to send bitcoin back and forth. The
only limit is the amount of bitcoin in the payment channel.
Think of a payment channel like Paypal. Once you deposit money into
Paypal, you can send that money to anyone else who uses Paypal. But
you can only send up to the amount you deposited in Paypal.
To enter or exit Paypal, you must do a bank transaction. Similarly, to
open or close a payment channel, you must do a Bitcoin transaction.
Hashed time locked contracts (HTLC) are simple smart contracts. They
basically say “payee will immediately get paid (some amount of)
bitcoin, if payee can produce a secret code. If you cannot produce the
secret code within (some number of) blocks, then payor can revoke
payor’s offer and have their bitcoins refunded.”
The Lightning Network uses a series of HTLC’s with the same secret
hash. This process can be repeated as many times as necessary.
Here is a step-by-step of how the HTLC works with four parties: A
(customer) B, C, and D (merchant)
- D Merchant creates a secret string (Key)
- D hashes the Key, using a hash function such as SHA-256
- D shares that Hash with everyone: A, B and C
This Hash is the lock, the Key is the code to unlock the HTLC’s (steps 5-7)
A creates a HTLC with B, with a lock time of 3 days.
B creates a HTLC with C, with a lock time of 2 days.
C creates a HTLC with D, with a lock time of 1 day.
D discloses Key to C, within 1 day, and D gets paid by C.
C discloses Key to B, within 2 days, and C gets paid by B.
B discloses Key to A within 3 days, and B gets paid by A.
If everyone cooperates, all of these transactions occur outside of the
Bitcoin Blockchain. No one needs to publish the transactions, unless
other parties are not cooperating. Ideally, users’ software will keep
track of each step automatically. For example, the software should
keep track of every step above, without the user being aware of every
step.
Everyone gets paid in a mechanical manner. The Lightning Network is
almost atomic in nature, meaning that either everyone gets paid, or
nobody gets paid.
Is Lightning a token or ICO?
No, the Lightning Network uses real bitcoins and smart contracts to allow
participants to aggregate many transactions into one, final,
settlement transaction. Lightning is a “layer two” protocol which
operates on top of the Bitcoin Network.
Example: A and B have lunch together often. A and B take turns paying
for lunch with fiat (dollars). Whoever pays for lunch is refunded by
the other in bitcoins. After a few weeks, each friend has paid
eachother many Bits. Lightning allows both friends to pay eachother,
without paying transaction fees every week. Instead, A and B only pay
transaction fees at their first and last lunch.
An ordinary bitcoin transaction is broadcasted to all bitcoin full
nodes in the world. The Bitcoin Miners take these transactions, and
compile them into blocks. That bitcoin transaction will now live on
the Bitcoin Blockchain, forever.
Lightning transactions, on the other hand, are not broadcasted to
every node. Although Lightning uses real bitcoins, transactions are
withheld from the Bitcoin Network.
Instead, Lightning Nodes keep
transactions secret, except in three circumstances:
- Entering the Lightning Network
- Exiting the Lightning Network
- Settling a dispute on the Bitcoin Blockchain
Source/More: The 7 Benefits of the Bitcoin Lightning Network – The Bitcoin Chain