Stakenet’s vision: Part III — The Lightning Network
What is the Lightning Network? Why will it be the future of scalable decentralized trading? Why has Stakenet integrated the Lightning Network into their DEX for trading? If you’re new to the crypto-sphere then these questions might not be easy to answer. So with this in mind, we’ve put together this article to give you a better understanding.
What problems does Bitcoin currently have?
The Bitcoin (BTC) blockchain has a limit of only about 7 transactions per second (tps). This limitation means that transactions on the BTC chain are not fast or cheap enough to suit small and frequent payments (the “coffee problem” — use BTC to pay for your morning coffee at your favourite barista, and wait for an hour for the transaction to confirm, as the coffee slowly cools.) In times of high demand, we see this capacity limit quickly exceeded, and as a result, transactions becoming extremely expensive.
Towards the end of 2017 and also early 2021, for example, the on-chain fee reached over 40$ per transaction — and after payment you still had to wait hours for your transaction to be confirmed. For a cryptocurrency that has set its sights on global adoption, this is a serious weakness — Bitcoin’s Achilles’ heel.
Enter the Lightning Network, developed specifically to address the on-chain congestion that comes with heavy traffic by providing a faster “off-chain” solution.
The Lightning Network (shorthand: LN, the ⚡ as a symbol) is a second layer built on top of the Bitcoin chain. It uses off-chain payment channels between LN Nodes to make micro-payments cheap and instant, with a degree of privacy and minimal interaction with the base BTC chain. You can read more about lightning channels here.
LN on BTC went live in 2018 and has since been accepted and adopted by a growing community and merchants. This also includes several prominent exchanges (Bitfinex, Kraken, Okex, Paxful..) as they offer Bitcoin deposits and withdrawals via LN. Current estimates suggest that, if implemented correctly, the Lightning Network could support around 50,000 transactions per second and even more, a figure comparable to VISA today. The Lightning Network website highlights the technology’s potential to scale to “millions to billions” of transactions per second, which, in terms of transaction speed, leaves any competition in the dust.
Implementing the Lightning Network will not only drastically increase transaction speeds for payments, but also significantly reduce traffic on the overloaded blockchain. Transaction speed is increased by offloading transactions onto LN nodes (you will later learn how this works). As a result the actual traffic on the overloaded blockchain with 300,000 average daily transactions currently cluttering the Bitcoin blockchain will hopefully be less.
What are the advantages of the Lightning Network?
Now that we have touched on Bitcoin’s scaling problems and how Lightning Network greatly extends its capabilities, we will now aim to explain four major advantages that the Lightning Network brings with it and why we have built our decentralized exchange (DEX) on it over the last years.
The core benefits of the Lightning Network (LN) are most prominent in these areas: speed, data protection, fees, and interchain operability. We will explain why these areas are all so critical and how the Lightning Network as a second layer will connect and advance the entire cryptocurrency ecosystem.
Every BTC transaction needs some certain storage space in the blockchain. But as the maximum space is 1 MB per block, there are currently no more than ~2000 transactions per block possible. As one bitcoin block gets produced every ~ ten minutes, the maximum throughput is 7 transactions per second.
With the implementation of the LN, transaction size or block size are now no longer causes of concern: LN transactions are sent off-chain, so they don’t need the miners’ confirmations nor rely on the average 10 min bitcoin blocktime. The Lightning node* broadcasts the balance change of the associated channel state directly to the involved nodes: they are now only limited to how fast electronic data can be submitted. Transactions are now ~ instant, with minuscule fees.
An exchange built on the LN allows for high-frequency trades — millions of trades can be done for fees that are almost negligible compared to those charged by regular exchanges.
*A Lightning node can be compared to a small CPU which is simply calculating channel/TX balances, instead of decoding hashes like miners do and therefore bundle huge amounts of TXs until the final balance is written on the underlying blockchain. Every Stakenet DEX wallet will be its own Lightning node.
II. Privacy/data protection
All transactions on the Bitcoin blockchain are clearly traceable to anyone, via an explorer. Anyone who chooses to look up one of your transactions would know your bitcoin balance and all your previous transactions (eg by Chain analysis some reconstructions are possible).
With LN, however, you enjoy a drastically increased level of privacy. All transactions are only recorded in the protocol between the two parties (peers) involved. This means that only the opening and closing balances of the channels are written onto the main chain, and thus are visible on the public explorer. No other details are disclosed to the public eye. In addition, the TOR network is used to prevent IP decryption when accessing the Lightning Network, thus allowing for even more privacy.
III. Incredibly low transaction fees
Transactions on the Bitcoin blockchain tend to be expensive. Since every on-chain transaction has to be confirmed by every miner, they need to get rewarded. The reward contains the block reward and transaction fees, which are becoming more and more important (as the block reward gets halved every 4 years). Fees fluctuate based on how clogged the chain is, who is willing to pay more transactions fees is more likely to be included into the next block.
DEXs that offer atomic swaps/on-chain trades also face these same limitations. When mass adoption comes about, everyday payment transactions and atomic swap trades would further flood the already very congested and expensive Bitcoin blockchain.
This has also been the case on the Ethereum blockchain over the last few months when fees for a single transaction on Uniswap cost up to $300. If you wanted to transfer funds quickly, e.g. in order to outperform other traders, the fees became even more expensive.
On the Lightning network, however, these transaction fees are often only fractions of a cent (e.g. 0.0001 cents/transaction), depending on the fee set in the protocol. As the miners’ confirmations are again not involved, they don’t need to get paid. In fact, the fee is so small that the unit “microsat” (i.e. micro-satoshi, 1 sat x 10^-3) was introduced to be able to express it in BTC values.
Eventually, off-chain, miners no longer have to verify each transaction and they still are logged in the protocol of the two exchanging parties and protected by the code, resulting in only one single on-chain transaction (so called “channel creation transaction” or “on-ramping transaction”).
IV. Interchain operability
Another special feature of the LN is its interchain operability. Thanks to its cross-chain functionality, the LN — like no other protocol — allows to connect different blockchains with each other and thus build an inherently capable network of Lightning-compatible (supporting HTLCs and multisig) chains.
When conventional scaling solutions are used, for example, one has to be content with a single chain, with the relevant non-native assets being wrapped/pegged in order to facilitate a trade. This creates a new attack vector as the wrapping blockchain may not be as secure or decentralized as the original blockchain.
With LN, on the other hand, no new blockchain is added — instead, the transactions are being outsourced off-chain (balanced and settled by LN-Nodes) without the need for wrapping. The Lightning network therefore solves conventional congestion issues instead of simply relocating them onto other blockchains. This applies not only to Bitcoin but to any Lightning-compatible coin such as LTC, XLM, XSN and many more.
Work is also already underway for Omni-USDT on Layer 2 & other native L2 tokens, and it is currently assumed that it will go live in 2021. This will also allow Lightning DEXs to execute trades off-chain with native tokens on layer 2 - instead of on-chain (with all the problems mentioned above).