Workshop: The Lightning Network

Slides, links and tutorials used for the workshop on the Lightning Network.

Links to slides:

Task 1: Install Lightning Network wallet

In this first task we are going to install one of the already many software wallets that exist for the Lightning Network.

For the workshop we are going to focus on these three options even if there are others available. So please choose one, preferably based on your skill.

Option 1a (easy, Android only): Eclair Wallet Testnet

Option 1b (easy, iOS only): CoinClip Testnet

Option 2 (advanced, GUI): Zap desktop wallet

Requirements:

Once you have installed the tools mentioned above continue here:

Option 3a (advanced, CLI): Command line

Create a directory where the data for the lnd process will be stored. For the example we will assume that the directory is /tmp/lnd. Also add the binaries from LND binary releases and add them to the PATH environment variable.

Open one command line window and run the following command:

lnd \
  --lnddir=/tmp/lnd \
  --logdir=/tmp/lnd \
  --bitcoin.active \
  --bitcoin.testnet \
  --bitcoin.node=neutrino \
  --neutrino.addpeer=btcd0.lightning.computer:18333 \
  --neutrino.addpeer=faucet.lightning.community \
  --neutrino.addpeer=lnd.bitrefill.com:18333 \
  --autopilot.maxchannels=0 \
  --autopilot.allocation=0 \
  --debuglevel=debug

If no critical error messages are printed and you see the message Waiting for wallet encryption password, you can create a wallet with the command:

lncli --lnddir=/tmp/lnd create

This should create a new wallet and sync the blockchain.

You can get the status of your node with the command:

lncli --lnddir=/tmp/lnd getinfo

To get an overview of all available commands, run:

lncli --lnddir=/tmp/lnd help

To get a wallet address, run the following command:

lncli --lnddir=/tmp/lnd newaddress np2wkh

This might take a while if the wallet is not yet synced to the chain. But finally an address starting with 2… should be printed.

Option 3b (advanced, CLI): Docker container

Create a directory where the data for the lnd process will be stored. For the example we will assume that the directory is /tmp/lnd.

Run the following command to pull and run a docker image:

docker run -d \
  -v /tmp/lnd:/root/.lnd \
  --restart=unless-stopped \
  --name=lnd \
  --entrypoint= \
  guggero/lnd \
  lnd \
  --logdir="/root/.lnd" \
  --bitcoin.active \
  --bitcoin.testnet \
  --bitcoin.node=neutrino \
  --neutrino.addpeer=btcd0.lightning.computer:18333 \
  --neutrino.addpeer=faucet.lightning.community \
  --neutrino.addpeer=lnd.bitrefill.com:18333 \
  --autopilot.maxchannels=0 \
  --autopilot.allocation=0 \
  --debuglevel=debug

This should start lnd in a container. The log can be viewed with docker logs -f lnd.

Now create a wallet with the command line tool that comes with lnd:

docker exec -ti lnd lncli create

To use the command line tool that comes with lnd, use the following command (for example, to get the node info with getinfo):

docker exec -ti lnd lncli getinfo

To get an overview of all available commands, run:

docker exec -ti lnd lncli help

To get a wallet address, run the following command:

docker exec -ti lnd lncli newaddress np2wkh

This might take a while if the wallet is not yet synced to the chain. But finally an address starting with 2… should be printed.

Go to testnet.manu.backend.hamburg/faucet and send yourself some Testnet Bitcoins!

Task 2: Open a Payment Channel