Step 1: Configuring bitcoind

To make things easier on newbies, we’re going to bundle bitcoind’s parameters into a batch file instead of configuring bitcoin.conf. This command can either be run by itself or saved in a .bat file using a text editor (e.g., Notepad).

Open the Command Prompt and run this command

“C:\Program Files\Bitcoin\daemon\bitcoind.exe” -zmqpubrawblock=tcp://127.0.0.1:18501 -zmqpubrawtx=tcp://127.0.0.1:18501 -rpcuser=INSERT_USERNAME -rpcpassword=INSERT_PASSWORD -server=1 -txindex=1

Optional Parameters:

-dbcache=(megabytes) sets the blockchain database RAM cache size (a higher number will help Bitcoin sync faster, but make sure not to allocate more than half your total available ram)

-maxconnections=(number) number of connections allowed to and from your node, good for high-bandwidth servers.

When this command is executed, Bitcoin-Core will begin to download the ~170gb full blockchain from other nodes on the network. I suggest letting this run overnight.

Step 2: Use Bitcoin-CLI to Encrypt Your Wallet and Check Sync Status

Run this command in a separate Command Prompt window to encrypt your wallet (required):

“C:\Program Files\Bitcoin\daemon\bitcoin-cli.exe” -rpcuser=INSERT_USERNAME -rpcpassword=INSERT_PASSWORD encryptwallet AVERYSECUREPASSWORD

Run this command to see how much of the blockchain your node has downloaded so far:

“C:\Program Files\Bitcoin\daemon\bitcoin-cli.exe” -rpcuser=INSERT_USERNAME -rpcpassword=INSERT_PASSWORD getinfo

Compare the “blocks” number to the most recent block here

Step 3: Set your GOPATH Environment Variable (this can be done while bitcoind is syncing)

Taken from the Go Github Wiki:

Your workspace can be located wherever you like, but we’ll use C:\go-work in this example.

NOTE: that GOPATH must not be the same path as your Go installation.

Create folder at C:\go-work .

. Right click on “Start” and click on “Control Panel”. Select “System and Security”, then click on “System”.

From the menu on the left, select the “Advanced systems settings”.

Click the “Environment Variables” button at the bottom.

Click “New” from the “User variables” section.

Type GOPATH into the "Variable name" field.

into the "Variable name" field. Type C:\go-work into the "Variable value" field.

into the "Variable value" field. Click OK.

Step 4: Pull LND and Modify It to Run on the Mainnet (can also be done while bitcoind is syncing)

Open another Command Prompt window and run these commands in order:

Install Glide (a Go package manager):

go get -u github.com/Masterminds/glide

Pull the LND repo from Github:

Navigate to the New Folder:

cd %GOPATH%/src/github.com/lightningnetwork/lnd

Use Glide to install dependencies:

glide install

Note: If glide install doesn’t work (saying “glide not recognized..etc..”): This means Glide wasn’t added to your system path. For a short-term solution, try putting glide.exe (from your go file or from their GitHub) into any folder you plan on running the glide command in. In case of an “access denied” error, reader Василий Ширкин also suggested this: “you can download old glide.exe version 0.12.3, and put it in %GOPATH%\bin”

Now minimize the window and navigate to %GOPATH%/src/github.com/lightningnetwork/lnd using the File Explorer (the file browser) :

Use Notepad to open chainparams.go

Change the line that says: var activeNetParams = bitcoinTestNetParams to var activeNetParams = bitcoinMainNetParams

Somewhere in the file, add:

var bitcoinMainNetParams = bitcoinNetParams{ Params: &bitcoinCfg.MainNetParams, rpcPort: “8334”, }

Save and close

Back in the Command Prompt window we left open, type (don’t copy) this command:

go install . ./cmd/...

Step 5: Run LND and Lightning-CLI (bitcoind sync should be complete first)

Google “what’s my IP” and replace X.X.X.X below with the IP address you’re given in the command below. Additionally, you may need to forward port 9735 (the lighting port) to your local IP (using the command “ipconfig” to determine your local IP) if you want other nodes to be able to call your node. The process varies by router manufacturer, but there are guides available online by searching “how to port forward”.

As always, you can either run this directly or create a .bat file with Notepad and save it somewhere for easy starting in the future.

“%GOPATH%\bin\lnd.exe” --bitcoin.active --debuglevel=debug --bitcoin.node=bitcoind --bitcoind.rpcuser=INSERT_USERNAME --bitcoind.rpcpass=INSERT_PASSWORD --externalip=X.X.X.X --bitcoind.zmqpath=tcp://127.0.0.1:18501 --bitcoind.rpchost=localhost:8332

The LND node will now start, but tell you that the Bitcoin wallet is locked. To unlock it, we need to use the Lightning CLI in another Command Prompt window:

“%GOPATH%\bin\lncli.exe” unlock

It will prompt you for your previously created VERYSECUREPASSWORD, and will then unlock your wallet, allowing LND to continue.

Note: Some have reported the need to use the ln-cli.exe create command if the unlock command alone doesn’t work.

LND will now begin syncing to the Bitcoin blockchain. In the mean time, we will set up Zap-Desktop and deposit BTC in our wallet.

Step 6: Zap-Desktop and Depositing BTC

Open a new Command Prompt window and run these commands:

Install MSBuild tools for Yarn:

npm install --global --production windows-build-tools

yarn config set msvs_version 2015 --global

Get Zap Repo:

Navigate to repo directory:

cd zap-desktop

Install Dependencies with Yarn:

yarn

Install More Dependencies with NPM:

npm run install-grpc

Finally, use NPM to start a Zap-Desktop instance:

npm run dev

Ta da! You should now see a screen either detailing the syncing process, or your main wallet page. While it syncs, you can use the address Zap gives you to deposit mainnet BTC (the address should start with the number 3, indicating that it is SegWit enabled)

Step 7: Connecting to the Lightning Network

Once LND finishes syncing and once the Bitcoin you deposited has been confirmed (mined in a block) you can open your first channels to the Lightning Network.

In Zap, navigate to the Contacts tab

In the upper left corner, click the Add button

On the bottom of the dialog box, paste this address (you will be connecting to my node):

02829de2d8762ac70f6a243c7e210e1a41d7bc9fe909d09f120b7f0b0252c83858@lightning.zaptremworld.com:9735

On the bottom, a text box says “Use 0.3 BTC Per Contract”

BTC Per Contract” Edit the number to the value of BTC you want to place into this Lightning channel (e.g., 0.003 for ~$30 of BTC)

Add the node/channel (the fee is automatically determined and usually only takes an hour or two).

Now, LND will begin downloading the layout of the entire network (first from the node listed above, and later other nodes it finds). In a few hours, the transaction that opens the channel will be mined and you will be free to send payments to any other node over the Mainnet Lightning Network! Simply click the “Pay” button and paste a Lightning Invoice created by the person/site you want to interact with.