How To: Setup a Bitcoin Lightning Network in 4 Steps

lightningnetwork

#1


via Hackernoon

This guide will take you through setting up a machine running ubuntu/debian as a lightning network node.

1. Install Bitcoind

$ sudo add-apt-repository -y ppa:bitcoin/bitcoin
$ sudo apt-get update
$ sudo apt-get install -y bitcoind

2. Install C-Lightning

c-lightning is blockstream’s lightning network daemon.

$ sudo apt-get install -y
      \ autoconf automake build-essential git libtool libgmp-dev
      \ libsqlite3-dev python python3 net-tools
$ cd /opt
$ git clone https://github.com/ElementsProject/lightning.git lightningd $ cd lightningd
$ make

3. Configure Bitcoind and C-Lightning

Create a file at ~/.lightning/config with the following contents.

# network=testnet # uncomment to run on testnet instead of mainnet

Create a file at ~/.bitcoin/bitcoin.conf with the following contents.

# testnet=1 # uncomment to run on testnet instead of mainnet printtoconsole=1
server=1
txindex=1

4. Sync with the blockchain

This step will take 1–4 hours depending upon the speed of your internet connection.

Run the bitcoin daemon.

$ bitcoind -daemon

In another terminal window run the lightning daemon.

$ lightningd

Check everything is running correctly.

$ lightning-cli getinfo
{
 "id": "07798d536c58ede3d3a150ba89679e2dc78a3a0966074024ad4081367abda76719",
 "port": 9735,
 "address": [
  {
   "type": "ipv6",
   "address": "edc7:c9f:dc33:5922:21b2:f0d0:2a02:4f40",
   "port": 9735
  }
 ],
 "version": "v0.5.2-2016-11-21-2438-g1fe79df",
 "blockheight": 1290015,
 "network": "testnet"
}

Check the blockheight of your target blockchain using an explorer to discover how far through the syncing process you are.

Conclusion

You’ll want to be running your node on machine that is permanently switched on and connected to the internet. Restarting the daemons even after they’ve downloaded the blockchain takes a long time as they have to reindex transactions in memory. Furthermore, you’ll want your node constantly available so it can accept and route payments, earning you BTC.

Personally I’ve used an old laptop which I leave switched on and connected to my router 24/7. For convenience I’ve set up ssh access to it so I can make payments using it. Check out my guide on how to make lightning payments to learn how to do this.


#2

Running lightning nodes, the new mining?

it’s all just giving cycles to the network where the network needs the love, and the network loving u back


#3

You think this will run on an ancient eee pc? those mini 10" laptop that asus realised ages ago


#4

It runs on a Raspberry Pi so I am going to say probably. Running nodes requires very little power.


#5

yeah dude, i have a lightning node running on a 15 year old gateway computer that i had stored in a dark corner of my closet.


#6

which one of these raspberry would you recommend


#7

3B+ :raspberrypi::raspberrypi::raspberrypi::raspberrypi::raspberrypi::raspberrypi::raspberrypi::raspberrypi::raspberrypi:


#8

if i was to set up a bitcoin lightning node, how much btc fund is needed?


#9

the more you can stake the more use your node will get (as far as i understand)
so if i wanted to send someone 10 btc and i want it to get there the fastest way possible, i’m going to pick the route that has the fewest hops nessisary. if you are only staking .3 btc then you’ll probably only get traffic (and rewards) from small time buyers doing DCA or something of that nature.

this is probably completely wrong but that’s just how i understand it


#10

ok, we can run a node … now we need to use those nodes for something…
theres some kind of list of sites that use LN ? or LN wallets like https://zap.jackmallers.com/ ? i don’t even know if this wallet is useable/safe.
also, LN can be really good to send funds betwen exchanges (from a fiat exchange on my country to binance/bittrex and back for example).


#11

Can you run bitcoind on a VPS then use a VPN to the lightning node running at home on a RPI?

I’m thinking autossh will cover broadband drops and having the lightning node local, slightly more secure or is it just not worth the hassle on DHCP?