Scalable Off-Chain Instant Payments
Lightning Network Alpha
The Lightning Network is a "second layer" payment protocol that operates on top of a blockchain. It enables fast transactions between participating nodes and has been touted as a solution to the scalability problem. It features a peer-to-peer system for making micropayments of digital cryptocurrency through a network of bidirectional payment channels without delegating custody of funds. Lightning Network implementation simplifies atomic swaps.
Normal use of the Lightning Network consists of opening a payment channel by committing a funding transaction to the relevant blockchain, followed by making any number of Lightning transactions that update the tentative distribution of the channel's funds without broadcasting to the blockchain, optionally followed by closing the payment channel by broadcasting the final version of the transaction to distribute the channel's funds.
The payment channels allow participants to transfer money to each other without having to make all their transactions public on the blockchain. This is done by penalizing uncooperative participants. When opening a channel, participants must commit an amount (in a funding transaction, which ison the blockchain). Time-based script extensions like CheckSequenceVerify and CheckLockTimeVerify make the penalties possible.
If we presume a large network of channels on the Grailum blockchain, and all Grailum users are participating on this graph by having at least one channel open on the Grailum blockchain, it is possible to create a near-infinite amount of transactions inside this network. The only transactions that are broadcast on the Grailum blockchain prematurely are with uncooperative channel counterparties.
The Lightning Network is made up of bidirectional payment channels between two nodes which combined create smart contracts. If at any time either party drops the channel, the channel will close and be settled on the blockchain.
How it works?
Basically, lightning network relies on concept of payment channels. Let’s say two people; our famous Alice and Bob want to use LN for playing a game of chess. They set a prize for the winner which will be 10 GXM. Below are steps that go in setting up a LN channel.
- Alice and Bob setup a multi-sig wallet by putting in 5GXM each. This transaction will be recorded on the main Grailum blockchain along with the wallet address. A payment channel gets created between both the nodes. There is a small fee whenever a channel is created.
- Also, if Alice and Bob do not want to setup a channel for themselves, they could even use connecting nodes for making the transactions. Only thing here is the nodes facilitating the transaction might charge some fees again.
- Now, Alice and Bob can make any number of transactions. These are also instantaneous; they don’t have to wait for confirmation like main chain.
- All of the transactions, updates to the balances are committed to a balance sheet that’s located in each node.
- When they are done with the game and they are ready to close the channel, Alice and Bob can submit the balance sheet to the main chain. Note that, main chain doesn’t have to execute all the intermediate transactions made by Alice and Bob. Only, the final one with ending balances.
- Closing a channel will confirm the balance for Alice and Bob on the main chain as well. If any discrepancies, there is a challenge period during which any of the channel members can fight by submitting a transaction history from their node. If identified as the victim, all the 10GXM will go to the victim.
- Good for micro transactions.
- Fast instant transactions. LN quotes 1 million tps.
- Very minimal amount of transaction fees.
- More privacy.