(OBSOLETE) Windows + Lightning Network

Please see my updated guide here: https://medium.com/@pierre_rochard/windows-macos-lightning-network-284bd5034340


I wanted to write a guide about how to set up LND testnet and mainnet on Windows both to help Windows users start their experience, and to look for areas to improve.

If you get stuck at any point in this guide (or after!) please contact me either on Twitter or by email pierre@rochard.org so that I can help you out. If any of this is not clear, please let me know so that I can improve it.


This setup process will get easier and easier as each step gets automated one way or another. I’ll keep this guide updated as things change.


Bandwidth

Until neutrino matures on to mainnet “real” Bitcoin, we’ll have to do a full sync of the Bitcoin blockchain, which means your computer will have to download and store 210+ GB of data from the internet. Your bandwidth will be the bottleneck in this process, not your computer. Here is a helpful chart to see how long it will take for you to download. To keep it under 3 days, you’ll want an 8+ Mb/second connection. If you are on Google Fiber, it’ll only take you 30 minutes. Yes, this is a big reason why there’s a lot of controversy about the block weight limit!

Requirements

  • Windows 7+
  • 210+ GB of disk space
  • 8+ GB of RAM

Warnings

Bitcoin is an experiment. The Lightning Network is an experiment. Please understand that you may have a permanent loss of value from experimenting with these systems. This is risky business!

NB: there are three different passwords in this process.

  • There is an RPC Password for your Bitcoin node, which restricts access to your Bitcoin node’s RPC interface. In the commands you’ll see YOURPASSWORD which you should replace with your own password. If you get a 401 error with your LND node, that means there’s a mismatch between the RPC Password you provided to Bitcoin Core vs LND.
  • There is a Wallet Password that you use to unlock your Lightning LND node. This password is mandatory and allows access to your (testnet or mainnet) coins, please make sure it is secure, write it down, and don’t send an unreasonable amount of real BTC to your LND hot wallet. What “unreasonable” means will depend on your personal finances, time preference, and risk tolerance. Don’t be too #reckless, it’ll end in tears. Only put in what you can afford to lose.
  • There is a Seed Password that encrypts your mnemonic backup for your Lightning LND wallet. The password is optional but recommended. As with the Wallet Password, it provides access to your funds if someone also has your mnemonic, so don’t lose it!

Please keep track of these.

1. Bitcoin Core

Go to https://bitcoincore.org/en/download/ and click on the big blue Download button

Install Bitcoin Core, all of the defaults are fine, un-check Run Bitcoin Core at the end

Click on the Start menu and search for Run

Pin Run to your taskbar so that it’s easily accessible. Paste in the following command

“C:\Program Files\Bitcoin\bitcoin-qt.exe” -testnet=1 -txindex=1 -zmqpubrawblock=tcp://127.0.0.1:18501 -zmqpubrawtx=tcp://127.0.0.1:18502 -rpcuser=test_user -rpcpassword=YOURPASSWORD -server=1  -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1

This will start the testnet Bitcoin node

Open the Run window again and paste in

“C:\Program Files\Bitcoin\bitcoin-qt.exe” -txindex=1 -zmqpubrawblock=tcp://127.0.0.1:18503 -zmqpubrawtx=tcp://127.0.0.1:18504 -rpcuser=test_user -rpcpassword=YOURPASSWORD -server=1 -rpcallowip=127.0.0.1 -rpcbind=127.0.0.1 -rpcport=8332

This will start the mainnet Bitcoin node

Let the testnet and mainnet nodes sync, how long it takes to sync will depend on your internet bandwidth.

Project idea: a cross-platform Bitcoin Core Launcher utility that can manage multiple different node configurations and allow you to skip the command line.

2. Testnet LND

Go to https://github.com/lightningnetwork/lnd/releases and download lnd-windows-amd64-v0.5.1-beta-rc1.zip

Open the downloaded zip file

Copy and paste the two files into your home directory, for me that’s C:\Users\Pierre

Project idea: a Windows installer for LND!

Click on the Start menu and search for “PowerShell”, click on Windows PowerShell

Pin PowerShell to your taskbar so that it is easily accessible.

Copy the command , paste it into PowerShell by right clicking into its window (I know, PowerShell is weird):

.\lnd.exe --bitcoin.active --bitcoin.testnet --bitcoin.node=bitcoind --bitcoind.rpchost=127.0.0.1 --bitcoind.rpcuser=test_user --bitcoind.rpcpass=YOURPASSWORD --bitcoind.zmqpubrawblock=tcp://127.0.0.1:18501 --bitcoind.zmqpubrawtx=tcp://127.0.0.1:18502 --debuglevel=info --rpclisten=localhost:10010 --restlisten=0.0.0.0:8081 --listen=0.0.0.0:9736

Project idea: a LND node launcher GUI so that there’s no need to modify a config file or use the command line flags.

Right click on PowerShell in the taskbar to open up another instance

Type in

.\lncli -rpcserver=localhost:10010 -network=testnet create
Don’t touch my testnet coins!

Create a new wallet password and follow the instructions to write down the seed (if you care about recovering testnet coins, which maybe you should just to be in the right habit and practice it)

The easiest way to save the seed is to highlight the seed, hit enter (this copies it), paste it into Notepad or Word, and print it out. Save it to your computer only if it’s encrypted or you are comfortable possibly getting the (small) amount of value you send to your LND wallet stolen.

Now your testnet LND node will start syncing with your testnet Bitcoin node

You’re done with your testnet LND node! Once it’s synced you can start using lncli.exe for connecting to peers, opening channels, sending and receiving payments.

3. Mainnet LND

Copy the command, paste it into PowerShell by right clicking into its window:

.\lnd.exe --bitcoin.active --bitcoin.mainnet --bitcoin.node=bitcoind --bitcoind.rpchost=127.0.0.1 --bitcoind.rpcuser=test_user --bitcoind.rpcpass=YOURPASSWORD --bitcoind.zmqpubrawblock=tcp://127.0.0.1:18503 --bitcoind.zmqpubrawtx=tcp://127.0.0.1:18504 --debuglevel=info

Open another PowerShell instance and type in

.\lncli create

Follow the same steps as above, back up your seed!

The easiest way to save the seed is to highlight the seed, hit enter (this copies it), paste it into Notepad or Word, and print it out. Save it to your computer only if it’s encrypted or you are comfortable possibly getting the (small) amount of value you send to your LND wallet stolen.

Now your mainnet LND node is syncing! Let it finish and you’re all set, you can start using lncli.exe for connecting to peers, opening channels, sending and receiving payments.

Links

LND gRPC API reference has examples of lncli.exe commands: https://api.lightning.community/

Mastering Bitcoin has a section which explains how LN works: https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch12.asciidoc#payment-channels-and-state-channels

The details of how LN works are a work in progress, see the current specification documents here: https://github.com/lightningnetwork/lightning-rfc

Y’alls is a reddit-like LN website that has both a mainnet version https://yalls.org/ and testnet version https://testnet.yalls.org/


Please reach out if you have any questions!