Skip to content

Instantly share code, notes, and snippets.

@rlafranchi
Last active November 13, 2023 13:43
Show Gist options
  • Save rlafranchi/6a1772c07c1eccafe2f21f784632504d to your computer and use it in GitHub Desktop.
Save rlafranchi/6a1772c07c1eccafe2f21f784632504d to your computer and use it in GitHub Desktop.
Setting up a Nimiq Node on DigitalOcean

Running a Nimiq Node on a Digital Ocean droplet

I thought I would put this quick tutorial together to help out anyone interested in contributing a node to the Nimiq network, also feel free to sign up using my referral link which will give you a $10 credit - https://m.do.co/c/0e575aa2cb44

requires some basic shell skills

First steps

  • Create a droplet and pick an operating system (we'll Use Ubuntu as an example)
  • Select a droplet size (If you are mining expect to get around 1 to 1.5kh/s per cpu core for a standard droplet)
  • Once the droplet is created, be sure to configure your desired domain name's dns settings to point to the assigned ip address for the droplet. In this example we'll be using nimiq.example.com

Open a shell session to the machine (w/ ssh or through DigitalOceans web console)

Install Nimiq

The Nimiq team has provided a debian package for easy installation. We'll use the latest download link, but best to go to the downloads page and follow the instructions there. (v 1.1.2 at time of writing)

wget https://repo.nimiq.com/deb/pool/main/n/nimiq/nimiq_1.1.2-1_amd64.deb
dpkg -i nimiq_1.1.2-1_amd64.deb

Install SSL cert with Letsencrypt

Letsencrypt is an easy when to install a free SSL cert and supports automatic renewal. I've found the nginx distribution to be the best and not cause any issues. https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx

apt-get update
apt-get install software-properties-common
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install python-certbot-nginx

Creating the certificate is a simple command

certbot --nginx -d nimiq.example.com

Register your email and answer the questions that are prompted. When complete, take note of the paths to the certificate files.

ex. /etc/letsencrypt/live/nimiq.example.com/fullchain.pem /etc/letsencrypt/live/nimiq.example.com/privkey.pem

installing the certs as the root user requires permissions to be changed to allow the nimiq service to read the certificate files.

chmod 755 /etc/letsencrypt/live
chmod 755 /etc/letsencrypt/archive

Configure Nimiq

The nimiq configuration file can be found at /etc/nimiq/nimiq.conf, use nano or vi to open and edit the file

nano /etc/nimiq/nimiq.conf

ensure the appropriate host and paths to cert files are configured properly, ex.

{
  "host": "nimiq.example.com",
  "tls": {
    "cert": "/etc/letsencrypt/live/nimiq.example.com/fullchain.pem",
    "key": "/etc/letsencrypt/live/nimiq.example.com/privkey.pem"
  },
  "statistics": 60,
  "mining": {
    "enabled": "yes"
  },
  "wallet": {
    "address": "NQ24 XX.."
  },
  "poolMining": {
    "enabled": "yes",
    "host": "pool.nimiq.watch",
    "port": 8443
  }
}

Once configured, simply save the file (ctrl + O for nano) and restart the Nimiq service

systemctl restart nimiq

You can see the status by running systemctl status nimiq

Enjoy! Send me some beer money:

NQ42 2XFM G9U0 8MSC 7T2H UTUV A9D6 RG13 P1RV
@fafeichter
Copy link

DigitalOcean free Coupon $200

1. Use this link to Sign Up.

2. Activate your account by credit card or PayPal.

3. Done! Now you have free $200 credit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment