Root-Server Tutorial

ROOT-SERVER TUTORIAL

Setting up a Bitcoin Full Node with a Lightning Network Node

Learn how to set up and run a Bitcoin full node along with a Lightning network node on a server.

Author:

ffaex

Last updated:

23/04/2023

Setting Up a Bitcoin Full Node with a Lightning Node

This tutorial explains how to set up a Bitcoin full node with a Lightning node on your server. Running a full node contributes to the strength and security of the Bitcoin network, and a Lightning node enables faster, cheaper transactions.

The most important requirement for implementation is a basic understanding of the Linux command line.

Requirements

To set up a Bitcoin full node and a Lightning node, you need a server with the following characteristics:

  • Sufficient storage (about 500 GB)
  • Good CPU power
  • A stable internet connection

The RS 2000 G8 SSD from netcup meets these requirements.

Step 1 - Ordering the VPS

Order the RS 2000 G8 SSD from netcup if you haven't done so already. Existing customers can add the product easily and quickly.

Step 2 - Basic configuration of the server

After provisioning the server and logging in with the username root and the password sent by email, update the basic configuration of the server.

  1. Change the root password with passwd.
  2. Download the current security updates with apt-get update && apt-get upgrade -y.

Step 3 - Download and install Bitcoin Core

  1. Download the latest Bitcoin Core release from the official website.

    wget https://bitcoincore.org/bin/bitcoin-core-24.0.1/bitcoin-24.0.1-x86_64-linux-gnu.tar.gz
    
  2. Extract the downloaded archive.

    tar xvf bitcoin-24.0.1-x86_64-linux-gnu.tar.gz
    
  3. Change to the extracted directory.

    cd bitcoin-24.0.1
    
  4. Add the binaries to your path.

    nano $HOME/.bashrc
    

    Go to the end of the file and paste the following:

    export PATH="$HOME/bitcoin-24.0.1/bin/:$PATH"
    

    Save with Ctrl+O and exit with Ctrl+X.

    Reload the changes with:

    source $HOME/.bashrc
    
  5. Create a default bitcoin.conf file.

    mkdir $HOME/.bitcoin
    nano $HOME/.bitcoin/bitcoin.conf
    

    Paste the following:

    server=1
    daemon=1
    zmqpubrawblock=tcp://127.0.0.1:28332
    zmqpubrawtx=tcp://127.0.0.1:28333
    

    Save with Ctrl+O and exit with Ctrl+X.

  6. Start Bitcoin Core by typing bitcoind in the terminal.

    bitcoind
    

At this point, Bitcoin Core should start synchronizing with the network. It will download and verify the entire blockchain, which can take several hours to a few days.

  1. Track the progress of your Bitcoin node synchronization.

    tail -f $HOME/.bitcoin/debug.log
    

    When the Bitcoin node is done synchronizing, you can continue with the next steps.

Step 4 - Install and configure LND (Lightning Network Daemon)

  1. Download the latest release of LND from the official GitHub repository.

    wget https://github.com/lightningnetwork/lnd/releases/download/v0.16.0-beta/lnd-linux-amd64-v0.16.0-beta.tar.gz
    
  2. Extract the downloaded archive.

    tar xvf lnd-linux-amd64-v0.16.0-beta.tar.gz
    
  3. Change to the extracted directory.

    cd lnd-linux-amd64-v0.16.0-beta.tar.gz
    
  4. Move the LND binaries to the ~/bin directory (create the directory if it doesn't exist).

    mkdir -p $HOME/bin
    mv lnd lncli $HOME/bin
    
  5. Add the LND binaries to your path.

    nano $HOME/.bashrc
    

    Go to the end of the file and paste the following:

    export PATH="$HOME/bin/:$PATH"
    

    Save with Ctrl+O and exit with Ctrl+X.

    Reload the changes with:

    source $HOME/.bashrc
    
  6. Create a default lnd.conf file.

    mkdir $HOME/.lnd
    nano $HOME/.lnd/lnd.conf
    

    Paste the following:

    [Application Options]
    debuglevel=info
    maxpendingchannels=10
    alias=YourNodeAlias
    color=#68F442
    listen=localhost
    
    [Bitcoin]
    bitcoin.active=true
    bitcoin.mainnet=true
    bitcoin.node=bitcoind
    
    
    

    Save with Ctrl+O and exit with Ctrl+X.

    Replace YourNodeAlias with a custom alias for your node.

  7. Start LND with the following command:

    lnd
    
  8. Create a wallet using lncli create.

After setting up your Bitcoin full node and Lightning network node, open another terminal window and create a wallet using the following command:

lncli create

Follow the steps described by the command-line interface to create a new wallet, including setting a wallet password, generating a seed, and backing up your seed phrase.

Congratulations! You now have a functioning Bitcoin full node with a Lightning network node and a newly created wallet.

For more information and basic usage of LND, check out the official LND documentation.

Remember to keep your seed phrase secure and make sure to have a backup, as losing it will result in the loss of your funds. Also, keep your server secure and up-to-date to ensure the safety of your Bitcoin full node and Lightning network node.

With your new setup, you can now participate in the Bitcoin and Lightning network ecosystems, send and receive transactions, and contribute to the overall health and decentralization of the network. Enjoy exploring the world of cryptocurrencies and the Lightning Network!

Now you have a Bitcoin full node with a Lightning node up and running. You can use lncli to interact with your LND node, and you can connect your Lightning wallet to your node for sending and receiving payments.

Licence

MIT

Copyright (c) 2021 netcup

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributor's Certificate of Origin

By making a contribution to this project, I certify that:

  1. The contribution was created in whole or in part by me and I have the right to submit it under the licence indicated in the file; or

  2. The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate licence and I have the right under that licence to submit that work with modifications, whether created in whole or in part by me, under the same licence (unless I am permitted to submit under a different licence), as indicated in the file; or

  3. The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

  4. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the licence(s) involved.

Published 23/04/2023 by ffaex

Submit your tutorial

Get 60€ netcup vouchers for every published tutorial.