Instantly share code, notes, and snippets.

@aakselrod /lnd-bitcoind.md Secret
Last active Jan 31, 2018

Embed
What would you like to do?
Testing the Lightning Network Daemon with a Bitcoin Core back-end

NOTE: THIS IS OUTDATED. bitcoind back-end has been merged into master and install instructions updated.

Testing lnd with a bitcoind back-end

This guide assumes you are an experienced lnd tester who has built it from source by cloning it from Github, and that you know your way around the command line. It also assumes you're using a Linux variant. The following are the necessary steps to begin testing with bitcoind as a back end for lnd.

Install bitcoind

When you install bitcoind, you'll need to test in either testnet or regtest mode. bitcoind does not support simnet. In addition, you'll need to turn on ZMQ for raw blocks and (if you want unconfirmed tx support) raw transactions so that lnd can subscribe to notifications.

The following is a sample bitcoin.conf:

testnet=1
txindex=1
server=1
daemon=1
zmqpubrawblock=tcp://127.0.0.1:18501
zmqpubrawtx=tcp://127.0.0.1:18501

Start bitcoind and allow it to synchronize.

Check out lnd with bitcoind support

In your lnd source directory under your GOPATH, you'll want to check out PR 447:

cd $GOPATH/src/github.com/lightningnetwork/lnd
git fetch origin pull/447/head:bitcoind-backend
git checkout bitcoind-backend

Then, you'll want to update your vendored files:

rm -rf vendor && glide install

Now, you can build lnd:

go install . ./cmd/...

Configure lnd for bitcoind support

You'll need to edit your lnd.conf file (or change your lnd launch command accordingly). If you've enabled neutrino, you'll need to disable it. Then add the following line to lnd.conf:

bitcoin.node=bitcoind

This enables the Bitcoin Core (bitcoind) back end for lnd. Please note that this is currently only supported for Bitcoin testnet and regtest; it is not supported for simnet, mainnet, or any Litecoin network.

If you discover any issues with this, please submit them to https://github.com/aakselrod/lnd/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment