Skip to content

Instantly share code, notes, and snippets.

@feulf
Last active April 10, 2018 05:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feulf/b5fe481a99bd53f04f2b91074f52272b to your computer and use it in GitHub Desktop.
Save feulf/b5fe481a99bd53f04f2b91074f52272b to your computer and use it in GitHub Desktop.
Workshop Series 1: Lightning Network

Lightning Network Workshop Series 1

  1. Run btcd
./btcd --simnet --rpcuser=kek --rpcpass=kek --txindex --connect=YOUR_IP
  1. Run lnd
./lnd --bitcoin.active --bitcoin.simnet --bitcoin.node=btcd --btcd.rpcuser=kek --btcd.rpcpass=kek --debuglevel=trace --noencryptwallet
  1. Check the block height to make sure your Blockchain is in sync
./btcctl --simnet --rpcuser=kek --rpcpass=kek getinfo
  1. Make sure lnd is connected, you can check the block height here too
./lncli getinfo
  1. Create a new address with lnd
./lncli newaddress p2wkh

Publish your publick key into IRC and ask for free bitcoins from the hubs. The host will send you the bitcoin, then they will mine a few blocks.

  1. Now check your wallet balance and make sure you receive them
./lncli walletbalance
  1. Here's start the fun part. Connect to the peer on your left in your group, to connect you need the public key and the address:
./lncli connect PUB_KEY@IP

You can find your IP running the following command on Linux and OSX ifconfig or running on Windows ipconfig, then searching for en0 and inet. You can find your lnd public key with ./lncli getinfo.

  1. More fun. Open a channel funding some money in the channel, and sending some fund to the other side of the channel
./lncli openchannel --block pubkey 50000 50000
  1. Make sure the channel is open
./lncli listchannels
  1. Now you can create an invoice and send to someone in your group, possibly with less than 5000 satoshis
./lncli addinvoice AMOUNT_IN_SATOSHIS
  1. When you receive an invoice from someone remember always to run decodepayreq to check how much they're asking you
./lncli decodepayreq PAYREQ
  1. You can also use queryroutes to make sure it exists one or more route to process the payment
./lncli queryroutes PUB_KEY AMOUNT_IN_SATOSHIS
  1. And voilà, you can finally pay the invoice!
./lncli payinvoice PAYREQ
  1. ... and check the invoices that have been payed to you
./lncli listinvoices
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment