Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Setting up a cold staking + electrum node for NavCash


NavCash is a light wallet for NavCoin. Its main features are Ledger and Cold Staking support and that it does not need to keep a full copy of the blockchain in order to operate. Instead, it relies on electrum servers to subscribe to notifications related to the wallet. Additional features like Community Fund voting will be added once the new DAO functionality is activated.

In this guide I will explain how to set up cold staking with NavCash using your own node. If you already have your full node and do not wish to use you own electrumx server, you can directly jump to the last point.

Building navcoin-core

We will start with a fresh Ubuntu 20.04 system. First step is to connect through SSH or open a terminal if we have local access to create a new user and install the system dependencies.

sudo adduser --disabled-password --gecos "" navcoin

Continue with the dependencies.

sudo apt-get -y update
sudo apt-get -y install build-essential libcurl3-dev libunbound-dev libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev git

We will also need to install an old version of libdb for legacy compatibility with older wallets.

mkdir -p $BDB_PREFIX
wget ''
echo '12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef  db-4.8.30.NC.tar.gz' | sha256sum -c
tar -xzvf db-4.8.30.NC.tar.gz
sed -i 's/__atomic_compare_exchange/__atomic_compare_exchange_db/g' db-4.8.30.NC/dbinc/atomic.h
cd db-4.8.30.NC/build_unix/
../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
make install
cd ~

Now we are ready to build navcoin-core.

git clone ~/navcoin-core
cd ~/navcoin-core
./configure --without-gui --disable-tests LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/"
sudo make install

We can set up navcoin-core as a service to ensure it will run every time the machine starts.

sudo mkdir /usr/lib/systemd/system
sudo cp contrib/init/navcoind.service /usr/lib/systemd/system

Before starting the node, it's necessary to get some parameters into the navcoin.conf file.

sudo mkdir /etc/navcoin
sudo pico /etc/navcoin/navcoin.conf

We fill it with:


Substitute <INSERT USER HERE> and <INSERT PASSWORD HERE> with an user/password combination of your desire. Remember it for later as we will need it. We must not forget to set up the right permissions (the data folder and config file should be owned by navcoin).

mkdir -p /var/lib/navcoind
chown -R navcoin:navcoin /etc/navcoin
chown -R navcoin:navcoin /var/lib/navcoind
chmod -R 740 /etc/navcoin
chmod -R 740 /var/lib/navcoind

As we are going to use this node to cold stake, we need to edit /usr/lib/systemd/system/navcoind.service to remove -disablewallet from the execution parameters. It should look like this:

Description=NavCoin's distributed currency daemon


ExecStart=/usr/local/bin/navcoind -daemon -pid=/var/lib/navcoind/ \
-conf=/etc/navcoin/navcoin.conf -datadir=/var/lib/navcoind



Let's create some of the necessary folder structures and enable the service.

ln -s /usr/local/bin/navcoind /usr/bin/navcoind
sudo systemctl daemon-reload
sudo systemctl enable navcoind

Now we are ready to start the daemon!!

sudo systemctl start navcoind

We can check its status to verify it is correctly working.

# systemctl status navcoind
**** navcoind.service - NavCoin's distributed currency daemon
Loaded: loaded (/usr/lib/systemd/system/navcoind.service; enabled; vendor preset: enabled)
Active: **active (running)** since Sun 2019-12-29 17:47:41 CET; 1s ago
Process: 20778 ExecStart=/usr/bin/navcoind -daemon -pid=/var/lib/navcoind/ -conf=/etc/navcoin/navcoin.conf -datadir=/var/lib/navcoind (code=exited, status=0/SUCCESS)
Main PID: 20789 (navcoind)
Tasks: 8 (limit: 4583)
CGroup: /system.slice/navcoind.service
└─20789 /usr/bin/navcoind -daemon -pid=/var/lib/navcoind/ -conf=/etc/navcoin/navcoin.conf -datadir=/var/lib/navcoind
Dec 29 17:47:41 testnet-3 systemd[1]: Starting NavCoin's distributed currency daemon...
Dec 29 17:47:41 testnet-3 navcoind[20778]: NavCoin server starting
Dec 29 17:47:41 testnet-3 systemd[1]: navcoind.service: Can't open PID file /var/lib/navcoind/ (yet?) after start: No such file or directory
Dec 29 17:47:41 testnet-3 systemd[1]: Started NavCoin's distributed currency daemon.

Setting up electrumx (Optional)

If we want to use our own electrumx server we can use the same server we have for navcoin-core to host an instance of electrumx. The only additional thing you would need is a public domain pointing to your server's ip. First we will need to create an specific user.

sudo adduser --disabled-password --gecos "" electrumx

Fill the asked data and continue with the installation of the needed dependencies.

sudo apt-get -y install python3-pip python3-dev
pip3 install setuptools
pip3 install wheel
pip3 install plyvel
git clone
cd x13-hash
python3 install

Then we will need to create an SSL certificate.

sudo apt-get -y install certbot
certbot certonly --register-unsafely-without-email

Let's assume our public domain is and generate the certificates for it.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
How would you like to authenticate with the ACME CA?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Spin up a temporary webserver (standalone)
2: Place files in webroot directory (webroot)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1
Plugins selected: Authenticator standalone, Installer None

Please enter in your domain name(s) (comma and/or space separated)  (Enter 'c'
to cancel):
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for
Waiting for verification...
Cleaning up challenges


- Congratulations! Your certificate and chain have been saved at:
Your key file has been saved at:
Your cert will expire on 2020-03-28. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- If you like Certbot, please consider supporting our work by:

Donating to ISRG / Let's Encrypt:
Donating to EFF:

Clone the repository and install it.

git clone
cd electrumx
python3 install
cp contrib/systemd/electrumx.service /etc/systemd/system/
chown -R electrumx:electrumx /etc/letsencrypt

Create the database folder structure and set the right permissions.

mkdir /home/electrumx/db
chown electrumx /home/electrumx/db

Edit the configuration file.

pico /etc/electrumx.conf

Use this sample configuration.

COIN = Navcoin
DB_DIRECTORY = /home/electrumx/db
USERNAME = electrumx
ANON_LOGS = x.x.x.x
SSL_CERTFILE = /etc/letsencrypt/live/<YOUR PUBLIC DOMAIN>/fullchain.pem
SSL_KEYFILE = /etc/letsencrypt/live/<YOUR PUBLIC DOMAIN>/privkey.pem

Substitute the parameters between < > (in the case of the user and password we will use those we wrote in navcoin.conf in the previous step), save the file and enable the service.

sudo systemctl daemon-reload
sudo systemctl enable electrumx

Now we are ready to start it.

sudo systemctl start electrumx

We can check that everything went smooth.

# systemctl status electrumx
**** electrumx.service - Electrumx
Loaded: loaded (/etc/systemd/system/electrumx.service; enabled; vendor preset: enabled)
Active: **active (running)** since Sun 2019-12-29 18:29:22 CET; 7min ago
Main PID: 23622 (electrumx_serve)
Tasks: 11 (limit: 4583)
CGroup: /system.slice/electrumx.service
└─23622 /usr/bin/python3 /usr/local/bin/electrumx_server

Dec 29 18:32:27 testnet-3 electrumx_server[23622]: INFO:BlockProcessor:our height: 9 daemon: 555,112 UTXOs 0MB hist 0MB
Dec 29 18:32:58 testnet-3 electrumx_server[23622]: INFO:BlockProcessor:our height: 6,309 daemon: 555,112 UTXOs 3MB hist 0MB
Dec 29 18:33:28 testnet-3 electrumx_server[23622]: INFO:BlockProcessor:our height: 14,709 daemon: 555,112 UTXOs 8MB hist 1MB
Dec 29 18:33:58 testnet-3 electrumx_server[23622]: INFO:BlockProcessor:our height: 25,409 daemon: 555,112 UTXOs 14MB hist 3MB
Dec 29 18:34:28 testnet-3 electrumx_server[23622]: INFO:BlockProcessor:our height: 32,409 daemon: 555,112 UTXOs 19MB hist 4MB
Dec 29 18:34:58 testnet-3 electrumx_server[23622]: INFO:BlockProcessor:our height: 42,809 daemon: 555,112 UTXOs 18MB hist 5MB
Dec 29 18:35:29 testnet-3 electrumx_server[23622]: INFO:BlockProcessor:our height: 53,509 daemon: 555,112 UTXOs 21MB hist 6MB
Dec 29 18:36:00 testnet-3 electrumx_server[23622]: INFO:BlockProcessor:our height: 59,309 daemon: 555,112 UTXOs 24MB hist 7MB
Dec 29 18:36:30 testnet-3 electrumx_server[23622]: INFO:BlockProcessor:our height: 67,309 daemon: 555,112 UTXOs 29MB hist 8MB
Dec 29 18:37:00 testnet-3 electrumx_server[23622]: INFO:BlockProcessor:our height: 74,709 daemon: 555,112 UTXOs 33MB hist 9MB

Now share the public address of your electrumx node and contribute to the decentralization of the network!

NavCash and Cold Staking

We have all our infrastructure correctly set up, so next step is to download the right version of NavCash depending on our operating system from When we launch it for the first time we will be asked which server we want to use.

If we set up an electrumx instance we might want to use it. If we don't have our own electrum server we can jump to the next paragraph. Choose Select server manually and click next. Choose the Server tab in the next page, uncheck Select server automatically, introduce your public address in the text field and click next.

In the next page you can type a name for the new wallet you are about to create (you can also leave the default name, it will work anyway!). The most important part is to choose Spending wallet for cold staking in the next page.

Now we will go to our server and get an address from navcoin-core which we will use as the staking address.

navcoin-cli -conf=/etc/navcoin/navcoin.conf -datadir=/var/lib/navcoind getnewaddress

Paste the address in the text field and click next.

If you want to use your Ledger you will need to select Use a hardware wallet. Otherwise choose Create a new seed to create a new wallet which will be stored in your computer. Go through the rest of the wizard and you will finally see the NavCash main window.

Click on the Receive tab, push the On-chain button and a new entry will be created in the Incoming payments list at the bottom of the window. Right click on it and select Copy Address.

Send your coins to this address (which you might notice is a bit longer than the normal navcoin addresses) and you will be ready to cold stake using NavCash!

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