In this article we will dive into what Lightning Network is, the advantages of using it and why it performs much better than Bitcoin.
Here is a simple guide!
LET’S START WITH BITCOIN FIRST: SCALABILITY ISSUES (AND MORE)
Bitcoin is a set of technologies and concepts put together in decades of studies and researches on cryptography and distributes systems. Such notions are able to define the basis of the modern ecosystem of digital values. When we talk about blockchain, we need to remember its fundamental elements which are decentralisation, transactions, consensus and smart contract.
The main challenge blockchain faces is scalability: how easy it is to adapt when there are remarkable changes of workload. Bitcoin also suffers from long transactional lead times and growing costs.
Since 2009 (when Bitcoin started), its original protocol has been modified a number of times so it can be safer and more efficient.
Lightning Network, a proposal that has recently become reality, aims to overcome all the issues analysed so far.
THE SOLUTION: LIGHTNING NETWORK
Lightning Network is a payment protocol which operates “on top of” Bitcoin (Layer 2). It implements specific types of contracts called Hashed Timelock Contracts (HTLCs) which safely directs transactions through peer to peer bidirectional payment channels using an onion-routed protocol.
Its importance is the ability of scaling Bitcoin, recording on its blockchain only some specific transactions, the opening and the channel closing ones. All the other transactions are left to flow with fewer fees and without having to go through a ledger.
LIGHTING NETWORK: SOME FURTHER CONSIDERATIONS
Let’s try to understand more by looking at some fundamental concepts:
- The payment channels are a metaphor to describe a trustless mechanism which doesn’t require trust from the participants. Such mechanism is used for bitcoin transactions between two sides which are outside the Blockchain. The transactions are managed off-chains, as if they were bill of exchanges. They would have had full value if carried out on the Bitcoin ledger. Their strength is to allow transactions to happen in a cheaper and faster way. There are one directional and bidirectional payment channels. Each one has its own features. We will analyse the bi-directional channels.
- The Hash Time Lock Contract (HTLC) is fundamental to understand Lightning Network protocol.
Smart Contracts can be added to the payment channels. These are programmes written using a very specific programming language (Script for Bitcoin) and they work in the exact same way in which they are written. There are no options of censorship nor manipulation.
Hash Time Lock Contracts (HTLCs) occur when Smart Contracts are programmed to allow participants to earmark funds through a redeemable secret with an expiration date. The beneficiary of such payment creates a secret (S) and subsequently calculates its hash (H). Smart Contract then follows the rule “Whoever knows the secret S can then collect the payment”.
This obviously exploits the intrinsic functionalities of hash. So for hash it becomes computationally expensive (basically impossible with the current resources) to search the value S that creates H. In this way, only the recipient (and whoever knows S) will be able to redeem it, without any malicious agents discovering the secret. This feature is also known as hashlock whilst timelock allows the payment to be credited back to the sender if it hasn’t been redeemed within a specific timeframe. The timeframe is agreed on the Smart Contract and blocks are mined for a specific amount of time.
Lightning Network, which Joseph Poons and Thadeus Dryja analysed in 2015, is a protocol that defines a specific network of bidirectional payment channels which are connected via an end-to-end system. The protocol doesn’t need to use any intermediaries because of Segwit and to its malleability-fix. It was initially released for testnet (an alternative blockchain to Bitcoin, used for testing purposes) and since March 2018 is also available for mainnet.
OUR IMPLEMENTATION: LN.INTERLOGICA.IT NODE
Interlogica has recently realised its first node on the main network, the so-called mainnet. What developers have created opened one of the 3600 existing nodes in the whole world.
The alias ln.interlogica.it identifies the node and its public key is 0202b1f1a4a74876e6c03bc135541ab89ad555bff38cc8984e6ba8cab1a16db4ed
ALICE, BOB AND ZOE: AN EDUCATIONAL EXAMPLE TO UNDERSTAND HOW TRANSACTIONS WORK ON LIGHTNING NETWORK
Use the images to understand how a transaction works using Lightning Network and have fun with Alice, Bob and Zoe!
Do let me underline that there can be more than two intermediaries between two nodes. Let’s imagine Zoe is connected with Alice and Charlie but not with Bob. If Charlie is connected with Bob the path of the transaction will follow that route. The method will be the same with the slight difference that Alice will need to pay a tiny amount of more taxes, according to how many nodes are between her and the recipient. Please be aware that the only transactions carried out using Blockchain technology are channels opening and closing. However, the payment was carried out off-chain rapidly and cost-effectively.