Bitcoin Lightning Network Node Easy Setup Tutorial for Windows Desktop Users — A how to guide
I’ve noticed recently plenty of excitement for layer 2 scaling solutions, like Lightning Network (LN), but a lack of simple documentation for setting things up. While it may seem that using LN on the testnet is for programmers and Linux users only, it’s actually not that difficult. Getting setup with the current LN desktop clients for Windows is actually not too hard, and can be accomplished in about 30 minutes. I was pleasantly surprised.
Keep in mind, this is currently for testnet BTC ONLY right now. I will update the guide when you can use real BTC :)
What these desktop clients are doing are creating an easy GUI for you to interact with the LND daemon, similar to how Bitcoin Core and Bitcoin Knots help you to interact with bitcoind, the bitcoin daemon. You’ll see later on that both Zap and Lightning-App will display the exact same information albeit with different interfaces.
The goals of this tutorial are:
- Installation of Lightning-App or Zap Desktop (leading desktop LN applications)
- Open a payment channel
- Buy a virtual coffee from Starblocks (starblocks.acinq.co)
- Receive a lightning payment
For this tutorial, I will be using a Windows 7 desktop. If you’ve ever sent or received a Bitcoin transaction, you have all the pre-requisite knowledge required to walk through the tutorial.
Part 0: Setup (5-10 minutes, easy)
**EDIT**: If you do not want to use the Zap application, and only want to try the Lightning App desktop, you can download the Windows binaries here: https://github.com/lightninglabs/lightning-app/releases/download/v0.1.4-alpha/Lightning-win32-x64v0.1.4.zip Simply download, extract and run “lightning.exe” and it should work. You can then skip directly to Part 2.
We’re going to need a few programs to actually compile the LN apps for us, because they aren’t pre-compiled in a nice beautiful .exe yet. This isn’t too hard though!
Download Node.js for Windows and install: https://nodejs.org/en/download/
Download Git for Windows and install: https://git-scm.com/download/win
Download Yarn for Windows and run the installer: https://yarnpkg.com/lang/en/docs/install/#windows-tab
Download Windows Visual C++ Build Tools 2015 and install: http://landinghub.visualstudio.com/visual-cpp-build-tools
After installing, go ahead and restart your computer.
After rebooting, launch the command prompt (Start →CMD.exe). Type node -v, and hit enter. Then type git — version, and hit enter. Finally, type yarn -v, and hit enter. If you see any type of version output for all 3, then we’re good to go!
Finally, install python version 2.7 by executing the following command in your command prompt window: (double dashes are auto-formatted on medium.com, so make sure you type it out as you see below)
Part 1a: Installing Lightning-App for Desktop (5 minutes, still easy!)
I recommend installing Lightning-App for desktop first, because it automatically installs the LND daemon for us. This will save us some work when installing the Zap desktop.
So first, create a folder wherever you like. For this example, I’m using C:\Users\Jad\Desktop\Tutorials\Lightning-App
Next, right click CMD.exe, run as an administrator, and switch to the newly created directory by typing “cd C:\Your\Custom\Path” (you can paste into the command prompt by right clicking, and selecting Paste)
Now we’re in the correct location, so let’s pull all the files for Lightning-App into the directory by typing “git clone https://github.com/lightninglabs/lightning-app.git” There is about 189 MB of files to download, FYI. Once done, you should see the following:
Next, type “cd lightning-app”, and hit enter. Then type “npm run setup”, and hit enter. Wait 2–4 minutes, then type “npm run package-electron”, and hit enter. This will create a nice and easy .exe file that we can launch to use the app in the future.
Now we wait some time for the installation to complete, few minutes. If you encounter any errors, make sure you are running CMD as an admin. I also ran into an issue where I had Visual Studio Community 2015 previously installed, and was causing conflicts so I had to uninstall it completely before installing the Visual C++ Build Tools 2015. If successful, you should see a new folder “release” inside lightning-app with the following contents:
Upon launch, you should see the following. Syncing can take 5–10 minutes, but only needs to be done once:
Part 1a: Installing the Zap-Desktop App (optional)
Installing the Zap-Desktop app is simple if you already installed the Lightning-App. Personally, I enjoy the Zap interface more than the Lightning-App.
So just like before, go ahead and run CMD.exe as an administrator and cd to our tutorials directory. Then, type “git clone https://github.com/LN-Zap/zap-desktop.git”, and hit enter:
Once all the files are downloaded, type “cd zap-desktop”, and hit enter.
Then type “yarn”, hit enter, and wait 1–5 minutes for the command to finish.
Next, type “npm run install-grpc”, and wait 1–5 minutes for the command to finish.
For our final step, to get Zap-Desktop to work, we have to copy and paste the lnd.exe file into resources/bin/win32. So for my example, I want to paste LND.exe inside C:\Users\Jad\Desktop\Tutorials\zap-desktop\resources\bin\win32. To find lnd.exe, just type lnd in your Windows search, copy it and paste it. It doesn’t matter which one:
Finally, create a file inside the zap-desktop folder called “launch.bat”. Using a text editor, make launch.bat contain the following 2 lines:
npm run dev
Now we are ready to launch the application! Just right-click launch.bat, and run as an administrator:
Part 2: Opening a payment channel (less than 5 minutes, easy)
The rest of this tutorial is just playing inside the applications. Much less technical knowledge is needed; however, this is where you will likely experience the minor hiccups that the beta software still has.
First thing, we need some free testnet Bitcoins! Pull up your wallet’s address, as seen below:
Now go to https://testnet.manu.backend.hamburg/faucet and send yourself some free testnet BTC. Once they have 3 confirmations, you will be able to use the testnet BTC to open a payment channel.
For this example, we will open a payment channel with BitRefill.com, as they have been fairly reliant for me. Check out their guide as well! If you are using Zap, first click on the “Peers” option on the left-hand menu. Then press “Add new peer” and enter 03459c42e997536a3347cb31c19c50df2d8e0d22e4b064de4c435a75bb275b9d47 for the node public key and lnd.bitrefill.com for the host. For the Lightning-App, just paste email@example.com after visiting the “channels” tab and pressing “create channel”:
For the Zap-app, you need to first add bitrefill as a peer before you can create a channel. So first, go to “peers”, click on “Add new peer” and fill in the form:
Then you can go to the channels tab and create a payment channel with 0345[..]d47. A cool thing about Zap-desktop is you can make the payment channel open as bi-directional, so you can have some of the money already on the other side of the channel. For example, maybe you know you will do business with BitRefill for awhile, and you’re paying for something up front, maybe you will open the channel with a few BTC already on BitRefill’s side.
You should now have 1 single channel open. If you want to find more nodes to connect to, check out https://explorer.acinq.co/#/
After 3 confirmations on the blockchain, the channel will be open. I also have noticed the channels are sometimes active, and sometimes inactive. BitRefill’s channel has remained active. I assume this may mean the other node must remain online. If you are having connectivity issues, make sure you don’t have any firewalls blocking lnd.exe, and also try forwarding port 9735. I had to do both before I established connectivity.
Part 3: Pay for a virtual coffee
Go to https://starblocks.acinq.co/#/, add one of the coffees to your cart, and hit checkout. Copy the highlighted portion:
Then go to your LN app and paste the payment request in:
Then hit pay! Now at this point, payment routing is pretty bad. You will likely receive a “routing failed” error. If so, try to connect to more channels. Alternatively, try checking out some faux-mobile minutes at BitRefill.com! If you have a direct payment channel with BitRefill, you will be able to complete your payment without a hitch: https://blog.bitrefill.com/lightning-payments-on-testnet-for-bitrefill-b3edac845654
When it works, it works instantly, and is quite awesome to see!
Part 4: Get paid!
Finally, try testing out receiving funds. Create a payment request in one of the apps. For Zap, after you create a request, you have to go to the wallet page, and click on the request itself:
Now to practice receiving funds, go and open up a LN web-wallet at htlc.me and try sending funds to yourself, or download the eclair testnet wallet on your Android phone, and try sending yourself a payment. Another fun exercise is opening a payment channel with yourself from your eclair wallet to your desktop node.
Lightning Network, while certainly not ready for the spotlight, is at a point where one can very clearly see the final product vision, and the potential it holds. There are more than just technical challenges as well; it is yet to be seen how much friction is caused by opening/closing channels on-chain (since it will require fees), how efficient routing will become, how centralized nodes will be, and what types of malicious activity could occur. I’m optimistic however. We’ll see very soon :)
Join the discussion! And as always, I appreciate any feedback and/or corrections.
A great Zap YouTube video by the founder: https://www.youtube.com/watch?time_continue=11&v=dhpg_8D2FPI
Lightning App Slack: