The Lightning Network (LN) is a payment protocol that operates on top of Bitcoin and enables lightning fast transfers.
In this tutorial, we will see why you need to run your own Bitcoin and LN node to access the Lightning Network, and how to do so easily thanks to Pierre Rochard’s Lightning Power Node Launcher.
You will only need a computer (Windows, macOS or Linux), 10GB of disk space, and a decent internet connection.
If you are already familiar with the mechanics of the LN, you can go directly to the third part “How to run your own Lightning Node”.
The Lightning Network in a nutshell
The Lightning Network (LN) is an extension of Bitcoin: it is a network of Bitcoin nodes whose purpose is to allow the instant transfer of bitcoins between its participants. The Lightning Network leverages Bitcoin smart contracts to minimize the need for blockchain transactions.
Until the deployment of Lightning Network in early 2018, it was only possible to send bitcoins recording each transaction in the Bitcoin blockchain. Though it remains today the safest way to transfer bitcoins, it is also the slowest and the most expensive.
On the contrary, a Lightning transaction does not need to be recorded on the Bitcoin blockchain to guarantee its existence, its validity and its issuer’s solvency: transaction fees and execution time are then reduced to a minimum.
Why running your own node?
To receive bitcoins through the Lightning Network, it is necessary to run your own Lightning node (which also includes a Bitcoin node) and to be always online to make sure no one is cheating. To understand why, let’s explore the mechanics behind the Lightning Network and start from a simple transaction.
Imagine that Alice sends a transaction directly to Bob without broadcasting it to the network. After checking the validity of the transaction, Bob could assume that it will be sufficient to broadcast it only when he will want to spend the bitcoins. The problem is that Alice may meanwhile broadcast another transaction sending her bitcoins to Charlie. Whenever Bob releases the transaction signed by Alice, it will be rejected by the network. This is the famous double spending problem!
To work around this difficulty, the foundational idea of LN is to temporarily lock Alice's bitcoins in a channel with an expiration date and rules defined in advance:
- If Bob presents a transaction signed by Alice on the blockchain, bitcoins locked in the channel will be sent to Bob.
- If no transfer occurs until the lock expires, the bitcoins will be unlocked and return to Alice.
From this transaction, Bob is certain that only two things can happen: either he gets Alice's bitcoins or the lock expires.
This channel offers a fundamental possibility to Alice and Bob: they can rewrite the terms of the transaction as many times as they want, because it is not yet registered on the blockchain: this is the key feature of LN. It allows the members of the network to negotiate transactions without having to go through the blockchain, except in case of dispute.
The invalidation is based on the principle of penalty: Alice and Bob sign a commitment not to broadcast the invalid transaction. If one does so, the other can then broadcast a transaction imposing a penalty on the cheater.
The Lightning Network relies on this foundational mechanism to form a network of channels. In this network, Bitcoin transactions are exchanged without immediately broadcasting them on the blockchain. The transaction confirmation time becomes almost instantaneous. The members of this network agree on the transfers to be made, and in case of disagreement, the dispute is settled on the blockchain.
Therefore, your need to run your own LN node to open up payment channels to other nodes, that can route many payments between them ‘off-chain’, and to monitor the Bitcoin blockchain that will act as a final “judge” in the case of a dispute or simply when a user closes his/her channel, to verify all of the small transactions that occurred within the channel.
How to run your own Lightning Node
- Lightning Lab’s lnd implementation in Go
- Blockstream's c-lightning implementation in C
- ACINQ's eclair implementation in Scala
The LN mainnet has launched in 2018 and has since a growing adoption ever since.
As of September 2019, the LN is made up of 5,000 active nodes which opened more than 35,000 channels. More than 800 bitcoins ($8Mio) are currently locked in the network. However, the Lightning Network is still considered to be in Beta, be aware that you may have a loss of value from experimenting with LN.
If starting a Bitcoin Lightning node has long been challenging, whatever the implementation, two projects have made it far more easier for non-technical individuals to join the network: Casa Lightning Node, a hardware device that enables a seamless set up of a full Bitcoin and Lightning Network node, and the Lightning Power Node Launcher developed by Pierre Rochard, to help onboard the next wave of BTC/LN users, which runs LND implementation.
We will now focus on the latter, at it is for us the easiest and quickest way to join the network. Pierre Rochard wrote a great set up guide. However, if you just download the package, the software will install by default a full node, which requires a lot of disk space (around 300GB) to download the full history of Bitcoin transactions.
Hence, we find it much more convenient for newcomers to run a pruned node (~10GB of disk available), which does not contain the entire transaction history like a full node, but is useful for people who want to help secure the network but aren’t willing to commit, or don’t have, the computational resource disk space to act as a full node.
When you launch the LN Node Launcher, in order to run a pruned node :
- Select the Bitcoin icon in your system tray
- Click on advanced
- Click on Configuration Files / Show bitcoin.conf:
- Open bitcoin.conf, delete the line "txindex=1" and edit "prune=0" to "prune=10000", to get the follwing bitcoin.conf file:
The synchronisation of your node shall now be much faster than for a full node, and take around 1-2 days depending on the speed of your internet connection.
Once a green dot appears on the Bitcoin icon, your node is synced! You can now set up your Lightning Network wallet.
You may now use the LND-compatible wallet of your choice. The easiest ones to install are :
- Zap: a desktop LN wallet
- Joule: a browser add-in you can download for Google Chrome (and Firefox, Opera, Brave)
And that’s it! You are now free to explore the Lightning Network, earn and spend your sats and enjoy this new fast, open, and global financial system:
For more information about the Lightning Network, here is an index of curated high quality educational resources and information provided by Jameson Lopp, CTO of Casa: https://www.lopp.net/lightning-information.html