Bitcoin Forum
November 05, 2024, 01:24:42 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: bitcoind, c-lightning and RTL on centos 7 (walktrough)  (Read 540 times)
mocacinno (OP)
Legendary
*
Offline Offline

Activity: 3556
Merit: 5187


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
January 13, 2020, 12:33:11 PM
Last edit: January 13, 2020, 12:47:36 PM by mocacinno
Merited by ABCbits (10), NotATether (5), JayJuanGee (4), nc50lc (2), n0nce (2), d5000 (1), Wind_FURY (1), Pmalek (1), psycodad (1), Heisenberg_Hunter (1), ndalliard (1)
 #1

bitcoind, c-lightning and RTL on centos 7 (walktrough)

I decided to write down some documentation on how to rebuild some of my services in case i ever faced a system crash, and because i more or less had all documentation on my system, i decided to update everything and publish it on this forum AND my blog... This way everybody could use my documentation to setup their own services of they ever wanted to.

some remaks:
  • I'm not taking any political stance here... The lightning network has pro's and con's, it's not completely mature (yet). This thread is NOT for discussing LN merits or shortcomings, but merely a technical walk-trough on how to get things up and running
  • my system specs: Centos 7, KVM VPS, 3 Gb RAM, 3vCPU's... The most important spec, however, is the disksize... A full node requires 278G at this moment, and there is a (theoritical) growth potential of ~17 Gb/month. Add some space for binaries, updates, builds, logs,... So you'll need at very least 350 Gb of free space on your filesystem
  • not all VPS providers will deliver a VPS that has the same configuration... It's possible some prereqs were already met in my basic image, while you have to install them yourself (or vice-versa)
  • i didn't document the firewall rules, because there are several possible firewall-implementations, and basically, if i'd have to go into the details of setting up firewallrules, i'd need a completely seperate firewall tutorial alltogether. If you have a clean (unused) VPS or you're installing a server in your HOME network (behind your own firewall), you *might* want to disable the firewall for testing puposes (re-enable it afterwards tough!!!)
  • i didn't document the backup procedures. Always make sure you backup wallets, seeds,...
  • no guarantee... If you follow these steps and lose money: don't blame me
  • no help... Sure, i might try to help you out if you run into problems, but i'm under no obligation to do so. Best effort only, and only when i have time to help you
  • no docker. Sure, docker is great, but if you run docker containers, you'll never know what's under the hood Smiley. It's easy to download and spin up a docker container, but you'll learn little (or nothing). Don't get me wrong, if you're building your own containers or if you don't want to learn how to setup your service, docker is great... Just not if you want to get your hands dirty Smiley
  • bitcoin core, c-lightning and RTL are built from source in this walktrough... It's up to you to periodically perform updates (not only for these binaries, but for all packages on your system)
  • this tutorial is a work in progress... There are many other steps (hardening, cleanup,...) that could happen. I'll probably edit these steps when i get input, or when i think about something myself. This is also why i split up this thread, this way every step has the chance/space to grow in the future...

Overview Of what we'll be installing
Bitcoin Core: a full node implementation and wallet, sometimes called the reference client. This node fetches all blocks and unconfirmed transactions from the peers it's connected to, parses and verifies everything and has a full wallet functionality
C-lightning: a Lightning Network implementation in C. Create lightning channels, create or pay lightning invoices.
RTL: Ride the lightning: one of the best GUI's that can be used on top of an existing c-lightning daemon. No extra functionality, but a lot easyer to use than using lightning-cli

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
mocacinno (OP)
Legendary
*
Offline Offline

Activity: 3556
Merit: 5187


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
January 13, 2020, 12:33:29 PM
Last edit: September 27, 2021, 05:37:20 AM by mocacinno
Merited by LoyceV (4), ABCbits (2)
 #2

Bitcoin core
prereqs: running (base) system

step 1: create service user, install prereqs
Code:
adduser bitcoin
passwd bitcoin
usermod -aG wheel bitcoin
yum -y install epel-release
yum install -y autoconf automake boost-devel gcc-c++ git libdb4-cxx libdb4-cxx-devel libevent-devel libtool openssl-devel wget nano python3
su - bitcoin

step 2: verify
Code:
whoami
pwd
you should see you're "bitcoin" and your current working directory is "/home/bitcoin"

step 3: build Smiley
Code:
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
git checkout v0.19.0.1
./autogen.sh
./configure
make -j $(nproc)
sudo make install
make sure you checkout the latest release (at the time of writing, this is v0.19.0.1, but later on this number will increase)

step 4: create password hash
Code:
cd share/rpcauth/
 python3 rpcauth.py the_username_of_the_user_you_want cleartext_password_unique_long
Caveat: the plaintext password will be saved in your history!! pick a unique one and/or clean up your history afterwards!!!

step 5: make dir, create conf
Code:
mkdir ~/.bitcoin
nano ~/.bitcoin/bitcoin.conf

step 6: fill bitcoin.conf
Code:
daemon=1
server=1
maxmempool=50
mempoolexpiry=2
rpcauth=user_chose_in_step_4:hash_created_in_step_4
dbcache=2048
banscore=10
datadir=/home/bitcoin/.bitcoin/

step 7: create service file
Code:
sudo nano /usr/lib/systemd/system/bitcoind.service

step 8: file bitcoind.service
Code:
[Unit]
Description=Bitcoin daemon
After=network.target

[Service]
ExecStart=/usr/local/bin/bitcoind -daemon -conf=/home/bitcoin/.bitcoin/bitcoin.conf

# Make sure the config directory is readable by the service user
PermissionsStartOnly=true

# Process management
####################

Type=forking
Restart=on-failure

# Directory creation and permissions
####################################

# Run as bitcoin:bitcoin
User=bitcoin
Group=bitcoin

# Hardening measures
####################

# Provide a private /tmp and /var/tmp.
PrivateTmp=true

# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full

# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true

# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true

# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true

[Install]
WantedBy=multi-user.target

step 9: enable and start bitcoind service
Code:
sudo systemctl enable bitcoind.service
sudo service bitcoind start

step 10: final step: check if your node is syncing
Code:
tail -f ~/.bitcoin/debug.log
once everything seems to be working, press "Ctrl-C"

step 11: (optional), re-visit step 6 and remove the banscore variable and decrease dbcache

Finished... Now you'll have to wait several hours for your node to sync... You can only proceed to the next step once this process is finished


█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
mocacinno (OP)
Legendary
*
Offline Offline

Activity: 3556
Merit: 5187


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
January 13, 2020, 12:33:39 PM
Last edit: September 27, 2021, 05:37:45 AM by mocacinno
Merited by LoyceV (4), ABCbits (1), Heisenberg_Hunter (1)
 #3

c-lightning
prereqs: running and synced bitcoin core

step 1: make sure you're user bitcoin, make sure you're in the home folder, install the prereqs
Code:
whoami
pwd
cd ~
sudo  yum install -y autoconf automake boost-devel gcc-c++ git libdb4-cxx libdb4-cxx-devel libevent-devel libtool openssl-devel wget libsodium-devel gmp-devel sqlite-devel python34 asciidoc clang python2-devel pythong34-devel python34-pip
sudo pip3 install Mako

step 2: clone and build c-lightning
Code:
git clone https://github.com/ElementsProject/lightning.git
cd lightning
git checkout v0.8.0
./configure
make -j $(nproc)
sudo make install
make sure you checkout the latest release (at the time of writing, this is v0.8.0, but later on this number will increase)

step 3: create the service
Code:
sudo nano /usr/lib/systemd/system/lightningd.service

step 4: fill lightningd.service
Code:
[Unit]
Description=C-Lightning daemon
Requires=bitcoind.service
After=bitcoind.service
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/local/bin/lightningd --daemon --conf /home/bitcoin/.lightning/bitcoin/lightningd.conf

User=bitcoin
Group=bitcoin
Type=forking
Restart=on-failure

# Hardening measures
####################

# Provide a private /tmp and /var/tmp.
PrivateTmp=true

# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full

# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true

# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true

# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true

[Install]
WantedBy=multi-user.target

step 5: create conf file
Code:
nano /home/bitcoin/.lightning/bitcoin/lightningd.conf

step 6: fill conf file
Code:
network=bitcoin
log-level=debug
log-file=/home/bitcoin/.lightning/debug.log
daemon
alias=alias_for_your_node

step 7: enable and start the service
Code:
sudo systemctl enable lightningd.service
sudo service lightningd start

step 8: monitor the startup progress
Code:
tail -f /home/bitcoin/.lightning/debug.log
press "Ctrl-c" to stop the tail, after a while you might decide to decrease the log level (step 6)

Finished...


█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
mocacinno (OP)
Legendary
*
Offline Offline

Activity: 3556
Merit: 5187


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
January 13, 2020, 12:33:57 PM
Last edit: September 27, 2021, 05:38:14 AM by mocacinno
Merited by LoyceV (4), ABCbits (1), Heisenberg_Hunter (1)
 #4

RTL
prereqs: running and synced bitcoin core, running lightningd (c-lightning)

step 1: make sure you're user bitcoin, make sure you're in the home folder, install the prereqs
Code:
whoami
pwd
cd ~
sudo yum install -y gcc-c++ make
sudo curl -sL https://rpm.nodesource.com/setup_12.x | sudo -E bash -
sudo yum install nodejs

step 2: clone and build c-lightning-REST (this is a prereq for RTL)
Code:
git clone https://github.com/saubyk/c-lightning-REST
cd c-lightning-REST
npm install
cp sample-cl-rest-config.json cl-rest-config.json
sudo lsof -i :3001
sudo lsof -i :4001
if the lsof command return nothing, the cl-rest-config.json should not be edited, if an other service is listening to port 3001 or 4001, you'll need to edit cl-rest-config.json

step 3: create a service file for c-lightning-REST
Code:
sudo nano /etc/systemd/system/c-lightning-REST.service

step 4: fill c-lightning-REST.service
Code:
[Unit]
Description=c-lightning-REST daemon
Wants=lightningd.service
After=lightningd.service

[Service]
ExecStart=/usr/bin/node /home/bitcoin/c-lightning-REST/cl-rest.js
User=bitcoin
Group=bitcoin
Restart=always
TimeoutSec=120
RestartSec=30

[Install]
WantedBy=multi-user.target

step 5: enable and start the service
Code:
sudo systemctl enable c-lightning-REST.service
sudo service c-lightning-REST start

step 6: make sure you're back into your home folder
Code:
cd ~

step 7: clone and build RTL
Code:
git clone https://github.com/Ride-The-Lightning/RTL.git
cd RTL
npm install
cp sample-RTL-Multi-Node-Conf.json RTL-Multi-Node-Conf.json

step 8: edit RTL-Multi-Node-Conf.json
Code:
{
  "multiPass": "very_strong_password",
  "port": "3000",
  "defaultNodeIndex": 1,
  "SSO": {
    "rtlSSO": 0,
    "rtlCookiePath": "",
    "logoutRedirectLink": ""
  },
  "nodes": [
    {
      "index": 1,
      "lnNode": "C Lighting",
      "lnImplementation": "CLT",
      "Authentication": {
        "macaroonPath": "/home/bitcoin/c-lightning-REST/certs/"
      },
      "Settings": {
        "userPersona": "MERCHANT",
        "themeMode": "NIGHT",
        "themeColor": "TEAL",
        "channelBackupPath": "/home/bitcoin/RTL/",
        "bitcoindConfigPath": "/home/bitcoin/.bitcoin/",
        "enableLogging": true,
        "fiatConversion": false,
        "lnServerUrl": "https://127.0.0.1:3001/v1"
      }
    }
  ]

step 9: create service file
Code:
sudo nano /etc/systemd/system/RTL.service

step 10: fill RTL.service
Code:
[Unit]
Description=RTL daemon
Wants=c-lightning-REST.service
After=c-lightning-REST.service

[Service]
ExecStart=/usr/bin/node /home/bitcoin/RTL/rtl.js
User=bitcoin
Group=bitcoin
Restart=always
TimeoutSec=120
RestartSec=30

[Install]
WantedBy=multi-user.target

step 11: enable and start RTL service
Code:
sudo systemctl enable RTL.service
sudo service RTL start

At this point, you have RTL up and running... If you surf to https://127.0.0.1:3000 you'll be able to login and manage your lightning node.
HOWEVER, if you've installed RTL on a server without a desktop environment and/or without proper x server forewarding, you'll need to execute the following steps in order to be able to surf to RTL (the RTL daemon only listens on localhost port 3000, so i't not accessible on an external port


step 1: register a tld. If you don't want to spend any money, a .tk domain is free. Make sure there's an a-record for this domain that points to your server. If you really don't have a domain, contact me and i'll give you a free [yourname].mocacinno.com subdomain

step 2: request a certificate for this domain using certbot
Code:
sudo yum install nginx certbot
sudo certbot certonly

step 3: open nginx.conf
Code:
nano /etc/nginx/nginx.conf

step 4: edit nginx.conf
Code:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}



stream {
        upstream RTL {
                server 127.0.0.1:3000;
        }

        server {
                listen 3002 ssl;
                proxy_pass RTL;

                ssl_certificate /etc/letsencrypt/live/yourdomain.tld/fullchain.pem;
                ssl_certificate_key /etc/letsencrypt/live/yourdomain.tld/privkey.pem;
                ssl_session_cache shared:SSL:1m;
                ssl_session_timeout 4h;
                ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
                ssl_prefer_server_ciphers on;
        }
}


step 5: restart nginx
Code:
sudo service nginx restart

step 6: you now have RTL up and running: https://yourdomain.tld:3002








█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
mocacinno (OP)
Legendary
*
Offline Offline

Activity: 3556
Merit: 5187


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
January 13, 2020, 12:34:09 PM
 #5

I'm thinking about adding a walktrough on how to install btcpayserver on top of the above stack... But i haven't written any documentation about this process (yet)... So i'll either update this post in the future, or i'll remove it (if i decide adding btcpayserver is to much work)

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Wind_FURY
Legendary
*
Offline Offline

Activity: 3094
Merit: 1929



View Profile
January 14, 2020, 06:29:17 AM
Merited by JayJuanGee (1)
 #6

How much would your average monthly cost be for electricity, internet connection, maintenance, if you keep your Lightning node running for 24/7 that specializes in providing liquidity?

██████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
██████████████████████
.SHUFFLE.COM..███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
█████████████████████
████████████████████
██████████████████████
████████████████████
██████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
██████████████████████
██████████████████████
██████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
.
...Next Generation Crypto Casino...
mocacinno (OP)
Legendary
*
Offline Offline

Activity: 3556
Merit: 5187


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
January 14, 2020, 06:41:47 AM
 #7

How much would your average monthly cost be for electricity, internet connection, maintenance, if you keep your Lightning node running for 24/7 that specializes in providing liquidity?

To be honest, i hire a dedicated server which i've partitioned into smaller VPS's. A dedicated box costs me €40/month, but i would be able to install 5 or 6 full stacks on such a dedicated server, so if you pool your resources with 3 other forum members, you'd have a nice VPS with plenty of resources for €10/month if you'd want to.

If you want to do a home setup, much depends on the power draw of your machine... An avarage laptop draws 60 Watts (according to google), beause there's a lot of IO and system load, i'd guess a laptop running such a stack would draw a little bit more.
80 Watt * 24 hours * 31 days =~ 60 Kwh.
In my country i pay about 30 cents per Kwh, so the cost of running a node on a home laptop would be ~€18/month, not including the wear and tear of the hardware.

As you can see in the screenshot, i'll never break even (my node has been online for about 1 year and 3 months, and i've earned 1.2 satoshi's in routing fees)

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Wind_FURY
Legendary
*
Offline Offline

Activity: 3094
Merit: 1929



View Profile
January 14, 2020, 10:54:32 AM
 #8

How much would your average monthly cost be for electricity, internet connection, maintenance, if you keep your Lightning node running for 24/7 that specializes in providing liquidity?

To be honest, i hire a dedicated server which i've partitioned into smaller VPS's. A dedicated box costs me €40/month, but i would be able to install 5 or 6 full stacks on such a dedicated server, so if you pool your resources with 3 other forum members, you'd have a nice VPS with plenty of resources for €10/month if you'd want to.

If you want to do a home setup, much depends on the power draw of your machine... An avarage laptop draws 60 Watts (according to google), beause there's a lot of IO and system load, i'd guess a laptop running such a stack would draw a little bit more.
80 Watt * 24 hours * 31 days =~ 60 Kwh.
In my country i pay about 30 cents per Kwh, so the cost of running a node on a home laptop would be ~€18/month, not including the wear and tear of the hardware.

As you can see in the screenshot, i'll never break even (my node has been online for about 1 year and 3 months, and i've earned 1.2 satoshi's in routing fees)

That was going to be in my next question.

But, that reinforces the belief that the nodes in the Lightning Network will evolve to become more specialized, and routing fees becoming higher than they are now. It also takes a valuable commodity, Bitcoins, staked in channels.

██████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
██████████████████████
.SHUFFLE.COM..███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
█████████████████████
████████████████████
██████████████████████
████████████████████
██████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
██████████████████████
██████████████████████
██████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
.
...Next Generation Crypto Casino...
ABCbits
Legendary
*
Offline Offline

Activity: 3052
Merit: 8059


Crypto Swap Exchange


View Profile
January 14, 2020, 11:42:16 AM
Merited by JayJuanGee (1)
 #9

I'm a bit curious,
1. What is average RAM usage after install all of these tools?
2. Does Bitcoin Core use most of the RAM in your case (since you use value 2048 for you dbcahce) ?

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
mocacinno (OP)
Legendary
*
Offline Offline

Activity: 3556
Merit: 5187


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
January 14, 2020, 12:26:48 PM
 #10

That was going to be in my next question.

But, that reinforces the belief that the nodes in the Lightning Network will evolve to become more specialized, and routing fees becoming higher than they are now. It also takes a valuable commodity, Bitcoins, staked in channels.

My main idear wasn't to make a profit, but rather learn the "new" (at that time) lightning protocol... I do hope that sooner or later, the fees might increase a little bit, but as for now: nobody knows Smiley

I'm a bit curious,
1. What is average RAM usage after install all of these tools?
2. Does Bitcoin Core use most of the RAM in your case (since you use value 2048 for you dbcahce) ?


Yup, dbcache was set to 2048 to speed up the intial sync, afterwards it's perfectly fine to remove this parameter.
Here you go (i've snipped all processes that had nothing to do with this particular stack) Smiley
Code:
 ps -o pid,user,%mem,command ax | sort -b -k3 -r
  PID USER     %MEM COMMAND
13827 bitcoin  18.3 /usr/local/bin/bitcoind -daemon -conf=/home/bitcoin/.bitcoin/bitcoin.conf
22686 bitcoin   0.7 /usr/bin/node /home/bitcoin/RTL/rtl.js
20476 bitcoin   0.6 /usr/local/bin/lightningd --daemon --conf /home/bitcoin/.lightning/bitcoin/lightningd.conf
21778 bitcoin   0.6 /usr/bin/node /home/bitcoin/c-lightning-REST/cl-rest.js
20487 bitcoin   0.0 /usr/local/libexec/c-lightning/lightning_hsmd
20489 bitcoin   0.0 /usr/local/libexec/c-lightning/lightning_gossipd
20488 bitcoin   0.0 /usr/local/libexec/c-lightning/lightning_connectd
20478 bitcoin   0.0 /usr/local/bin/../libexec/c-lightning/plugins/pay
20477 bitcoin   0.0 /usr/local/bin/../libexec/c-lightning/plugins/fundchannel
20479 bitcoin   0.0 /usr/local/bin/../libexec/c-lightning/plugins/autoclean
29533 nginx     0.0 nginx: worker process
29532 nginx     0.0 nginx: worker process
29531 nginx     0.0 nginx: worker process

Code:
cat /proc/meminfo
MemTotal:        2913960 kB
MemFree:           79220 kB
MemAvailable:    1919348 kB
Buffers:            3020 kB
Cached:          2067608 kB
SwapCached:        11496 kB
Active:          1341376 kB
Inactive:        1354236 kB
Active(anon):     362948 kB
Inactive(anon):   375720 kB
Active(file):     978428 kB
Inactive(file):   978516 kB
Unevictable:           4 kB
Mlocked:               4 kB
SwapTotal:       1048568 kB
SwapFree:         741632 kB
Dirty:                64 kB
Writeback:             0 kB
AnonPages:        615284 kB
Mapped:           105608 kB
Shmem:            113628 kB
Slab:              59592 kB
SReclaimable:      36760 kB
SUnreclaim:        22832 kB
KernelStack:        5104 kB
PageTables:        21064 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     2505548 kB
Committed_AS:    2735808 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       13956 kB
VmallocChunk:   34359720444 kB
HardwareCorrupted:     0 kB
AnonHugePages:     20480 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      182144 kB
DirectMap2M:     1914880 kB
DirectMap1G:     1048576 kB

Code:
top - 07:27:07 up 4 days,  4:39,  1 user,  load average: 0.00, 0.03, 0.05
Tasks: 140 total,   1 running, 139 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  2.1 sy,  0.0 ni, 97.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  2913960 total,    85292 free,   727596 used,  2101072 buff/cache
KiB Swap:  1048568 total,   741632 free,   306936 used.  1919012 avail Mem

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Carlton Banks
Legendary
*
Offline Offline

Activity: 3430
Merit: 3080



View Profile
January 14, 2020, 01:40:31 PM
Merited by ABCbits (1), figmentofmyass (1)
 #11

But, that reinforces the belief that the nodes in the Lightning Network will evolve to become more specialized, and routing fees becoming higher than they are now. It also takes a valuable commodity, Bitcoins, staked in channels.

why?

it's a supply and demand equation, but with privacy incentives distorting the supply-side. It seems more likely to me that the market will always tend toward liquidity over-supply (which is obviously better than under-supply), and so fees will frequently or always be at or lower than any "specialized" node could tolerate

Vires in numeris
Wind_FURY
Legendary
*
Offline Offline

Activity: 3094
Merit: 1929



View Profile
January 15, 2020, 05:34:36 AM
 #12

But, that reinforces the belief that the nodes in the Lightning Network will evolve to become more specialized, and routing fees becoming higher than they are now. It also takes a valuable commodity, Bitcoins, staked in channels.

why?

it's a supply and demand equation, but with privacy incentives distorting the supply-side. It seems more likely to me that the market will always tend toward liquidity over-supply (which is obviously better than under-supply), and so fees will frequently or always be at or lower than any "specialized" node could tolerate


In theory, I could be wrong. Because I don't believe that the people running LN nodes will continue doing so altruistically forever, not especially when it requires staking a valued commodity, and some level of specialization.

██████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
██████████████████████
.SHUFFLE.COM..███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
█████████████████████
████████████████████
██████████████████████
████████████████████
██████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
██████████████████████
██████████████████████
██████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
.
...Next Generation Crypto Casino...
Wind_FURY
Legendary
*
Offline Offline

Activity: 3094
Merit: 1929



View Profile
January 16, 2020, 08:21:25 AM
 #13

@mocacinno RAM usage is lower than i expected, i'll consider running similar setup if i have good reason to do so.

But, that reinforces the belief that the nodes in the Lightning Network will evolve to become more specialized, and routing fees becoming higher than they are now. It also takes a valuable commodity, Bitcoins, staked in channels.
why?

it's a supply and demand equation, but with privacy incentives distorting the supply-side. It seems more likely to me that the market will always tend toward liquidity over-supply (which is obviously better than under-supply), and so fees will frequently or always be at or lower than any "specialized" node could tolerate
In theory, I could be wrong. Because I don't believe that the people running LN nodes will continue doing so altruistically forever, not especially when it requires staking a valued commodity, and some level of specialization.

At least for merchant and exchange, they could always increase their goods/service fees or burden the fee to user.

IMO other specialized nodes will always have negative profit since,
1. LN client would use route with lowest fee or create new channel (if fees for existing routes is too high)
2. Merchant and exchange will keep routing fees low to take the advantage the fact many users (who only make few transaction) would connect to them directl


Then, another theory, regular users/hobbyists won't maintain running a Lightning node for nothing forever, and running one would converge towards large merchants, which the costs are subsidized by their businesses, IF they adopt it.

I like the other theory. Cool

██████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
██████████████████████
.SHUFFLE.COM..███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
█████████████████████
████████████████████
██████████████████████
████████████████████
██████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
██████████████████████
██████████████████████
██████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
███████████████████████
.
...Next Generation Crypto Casino...
ndalliard
Full Member
***
Offline Offline

Activity: 154
Merit: 177



View Profile
July 07, 2021, 08:02:20 PM
 #14

how is RTL secured? is there a password prompt when you access the site? if not - everyone who knows your domain (and port) can access your node or did i miss something?
Rath_
aka BitCryptex
Legendary
*
Offline Offline

Activity: 1876
Merit: 3139



View Profile
July 07, 2021, 09:04:46 PM
Merited by ABCbits (1), ndalliard (1)
 #15

how is RTL secured? is there a password prompt when you access the site? if not - everyone who knows your domain (and port) can access your node or did i miss something?

Yes, there is a password prompt. You can also set up two-factor authentication in the settings.
psycodad
Legendary
*
Offline Offline

Activity: 1648
Merit: 1812


精神分析的爸


View Profile
September 23, 2021, 09:04:10 AM
 #16

Thank you mocacinno for this excellent walk-through!
I used it to setup my own lightning node on Devuan (hating systemd and the Poettering fuckwit so much I went that extra mile) and it's supported by my VPS host.

What was impressing with the latest bitcoin core v22.0 is that synching from scratch took less than 24hrs on a pretty low-end VPS with spinning rust. Last time I synched a bitcoin node in 2014 (on much more low-end HW) it took me 2 weeks.

Overall a very exciting experience thanks to your HowTo, I greatly appreciate the time you have taken and I am very pleased with the results so far!

Now I have to go to find out how I set the fees (working with the defaults so far) and what reasonable fees are. I don't want to go full free (because what's free is not worth anything) but to set very moderate/low fees. If anybody has any reading pointers on how fees work in lightning, what good settings are etc., I would be happy to hear about that.
Also, I would be interested what the settings of "urgent", "normal", "slow" etc. mean when setting up a new channel, I guess urgent translates to high fees, but I am not sure yet.

Are people setting their fees on a per-channel basis or globally?

Again, thank you very much for the great HowTo, it gave me a great and easy start into the topic!

Rath_
aka BitCryptex
Legendary
*
Offline Offline

Activity: 1876
Merit: 3139



View Profile
September 23, 2021, 09:34:59 AM
Merited by ABCbits (2), JayJuanGee (1)
 #17

If anybody has any reading pointers on how fees work in lightning, what good settings are etc.

There are no good settings. If you open a channel between two large nodes then you will probably not route any payments unless you set your fees to zero. You have to experiment with your fee settings. I opened a large channel to Bitfinex and a small one to Nicehash. Even though my fees in that channel (Bitfinex) were high (1 sat base fee; 95 ppm), I routed quite a few payments. The largest one was ~950k satoshi and I earned ~91.5 sat in routing fees just for that single transaction. After some time I had to lower my fees since no one wanted to send their payment through that channel.

Are you familiar with the way the fees are calculated or do you need an explanation?

Also, I would be interested what the settings of "urgent", "normal", "slow" etc. mean when setting up a new channel, I guess urgent translates to high fees, but I am not sure yet.

Honestly, I would not use RTL to open and close channels. I overpaid a few times because of it. Also, you can open multiple channels in a single transaction via a command line! This way you can save a ton on money on the transaction fees.

Are people setting their fees on a per-channel basis or globally?

Most people set their fees on a per-channel basis. If you are running a small node then you will very likely change them often. There is a plugin which automatically adjusts the fees for each channel but I am not sure how well it works.

By the way, are you interested in opening a dual-funded channel at some point? It is still an experimental feature but I have successfully opened this type of channel with two other bitcointalk members. Here's my node for reference. Also, you might find The Lightning Network FAQ useful. Most of the LN related discussion is held there.
psycodad
Legendary
*
Offline Offline

Activity: 1648
Merit: 1812


精神分析的爸


View Profile
September 23, 2021, 11:13:03 AM
 #18

<snip>
Also, you might find The Lightning Network FAQ useful. Most of the LN related discussion is held there.

Thank you for your reply, you are ofcourse right, I replied to your post in your thread:

https://bitcointalk.org/index.php?topic=5158920.msg58004580#msg58004580

NotATether
Legendary
*
Offline Offline

Activity: 1778
Merit: 7362


Top Crypto Casino


View Profile WWW
September 25, 2021, 03:14:35 PM
 #19

Just a minor issue, all the images in your guide are broken (maybe you removed them from your hosting server or changed their names/paths?)

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
n0nce
Hero Member
*****
Offline Offline

Activity: 882
Merit: 5918


not your keys, not your coins!


View Profile WWW
September 25, 2021, 08:38:47 PM
 #20

The whole nginx install and config is to be able to use a HTTPS certificate? I have not installed a node on a VPS, always in local networks that's why I ask, I just use the local IP.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!