The Lightning Network: Packets to Circuits
There are three problems that developers see in regards to scaling Bitcoin:
- Micropayments are not exactly cheap to make
- the size of blocks/the blockchain over time
The Lightning Network aims to solve these problems by creating hash-locked payment channels facilitating instant off-chain real bitcoin transactions.
Before we can understand what the Lightning network enables, we need to have a baseline understanding of what exactly a hash and payment channel is.
A cryptographic hash function is a way to encrypt data and verify that data has not changed. The SHA256 hash function will take any input and output a 64 character string output. In order to produce a certain hash output you must know the secret input. The Sha256 hash will always produce the same output for a given data input.
domsteil –> SHA256 –> 1773a0ebb54be6bbc0c6be79fae0799046b7ecb089b11460e0070a62c6e319af
A payment channel is an off blockchain P2P payment where confirmation is done by the parties involved and does not need to be announced to the network.
By combining these two technolgies we can create the hash-locked smart contracts between multiple parties to facilitate a counterparty-risk free transaction layer on top off the Bitcoin protocol.
T+3 an existing method in the financial system was created as a settlement period. The Lightning Network also creates a similar T+time settlement system using a hash-locked smart contract and appending a transaction to the resulting hash output.
Trustless Transaction Example:
Alice, Bob, Carol, and Dave.
Alice wants to pay Dave .01 BTC, but does not have a direct route.
Alice pays Bob, Bob pays Carol, Carol Pays Dave.
Dave has R, a preimage which produces cryptographic hash H within n blocks.
Dave can now get 0.01 BTC if she discloses R to Carol.
Carol discloses R to Bob.
Bob discloses R to Alice.
Pure P2P offchain settlement.
For more information read about the Lightning Network here.