Ultimate Guide to DECENT Mining

How to install DECENT?

These instructions are for installing DECENT on Ubuntu 16.04. If you're running a different OS, some of the commands may not work properly.

Install required packages
sudo apt-get update
sudo apt-get install build-essential autotools-dev automake autoconf libtool make cmake checkinstall realpath gcc g++ flex bison doxygen gettext git qt5-default libqt5svg5-dev libreadline-dev libcrypto++-dev libgmp-dev libdb-dev libdb++-dev libssl-dev libncurses5-dev libboost-all-dev libcurl4-openssl-dev python-dev libicu-dev libbz2-dev
Install Boost library
# Version 1.60.0 is required which is not shipped by default with Ubuntu 16.04
mkdir -p ~/dev/DECENTfoundation/DECENT-Network-third-party
cd ~/dev/DECENTfoundation/DECENT-Network-third-party
rm -rf boost_1_60_0* boost-1.60.0*
tar xvf boost_1_60_0.tar.gz
mkdir boost-1.60.0_prefix
cd boost_1_60_0
export BOOST_ROOT=$(realpath ../boost-1.60.0_prefix)
./ --prefix=$BOOST_ROOT
./b2 install
cd ..
rm -rf boost_1_60_0 boost_1_60_0.tar.gz
Download DECENT
mkdir -p ~/dev/DECENTfoundation
cd ~/dev/DECENTfoundation
git clone
cd DECENT-Network
git submodule update --init --recursive
Install DECENT
mkdir -p ~/dev/DECENTfoundation/DECENT-Network-build
cd ~/dev/DECENTfoundation/DECENT-Network-build
cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ~/dev/DECENTfoundation/DECENT-Network
cmake --build . --target all -- -j -l 3.0
cmake --build . --target install

How to upgrade DECENT daemon?

Backup existing files so that you can get back to them if needed.

Backup files
BACKUP_NAME="backup.$(date +%Y-%m-%d-%H.%M.%S)"
mkdir -p ~/dev/DECENTfoundation/${BACKUP_NAME}
cp -r ~/dev/DECENTfoundation/DECENT* ~/dev/DECENTfoundation/${BACKUP_NAME}

Remove existing folders. Don't worry about the running miner, it will not stop mining.

Remove old folders
rm -rf ~/dev/DECENTfoundation/DECENT-Network-*
Download latest DECENT version
cd ~/dev/DECENTfoundation/DECENT-Network
git fetch
git checkout master
git pull              
git submodule update --init --recursive

Install Boost 1.60.0 to configure environment variables and install DECENT.

Install Boost library
# Version 1.60.0 is required which is not shipped by default with Ubuntu 16.04
mkdir -p ~/dev/DECENTfoundation/DECENT-Network-third-party
cd ~/dev/DECENTfoundation/DECENT-Network-third-party
rm -rf boost_1_60_0* boost-1.60.0*
tar xvf boost_1_60_0.tar.gz
mkdir boost-1.60.0_prefix
cd boost_1_60_0
export BOOST_ROOT=$(realpath ../boost-1.60.0_prefix)
./ --prefix=$BOOST_ROOT
./b2 install
cd ..
rm -rf boost_1_60_0 boost_1_60_0.tar.gz
Install DECENT
mkdir -p ~/dev/DECENTfoundation/DECENT-Network-build
cd ~/dev/DECENTfoundation/DECENT-Network-build
cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ~/dev/DECENTfoundation/DECENT-Network
cmake --build . --target all -- -j -l 3.0
cmake --build . --target install
Replay blockchain and restart miner. Please note that this will stop your miner.
systemctl stop decent
~/dev/DECENTfoundation/DECENT-Network-build/artifacts/prefix/bin/decentd --replay-blockchain
# when done, quit decentd by pressing CTRL+C
systemctl start decent

Your miner is upgraded 😇

How to run DECENT?

We will create a systemd service and configure it to run DECENT. It will automatically restart decentd in case it crashes for any reason.

Configure systemd service
cat > /etc/systemd/system/decent.service <<EOF
Description=DECENT daemon



Enable DECENT to start on system startup
systemctl daemon-reload
systemctl enable decent

Now we're ready to run DECENT

systemctl start decent

You can watch the output of DECENT by running the following command

journalctl -u decent -alf          

Now grab a cup of coffee ☕ and wait until the blockchain is synchronized.

How to configure a miner?

First you need to set a password for your wallets, create an account and register your miner.
Use cli_wallet for these steps. To run cli_wallet, execute the following command.

Run cli_wallet

When you're in wallet, the command line starts with locked >>>
We need to set a new password and unlock your wallet.

Set wallet password & unlock wallet
set_password pickYourPassword
unlock pickYourPassword      

Now you have unlocked a wallet which is indicated by unlocked >>> at the beginning of command line.
Let's import your DECENT Go wallet.

First create an account on if you don't already have one.
After creating an account open the Security settings and click on "Recovery Phrase". This will show your private key you will need in the next step.

Copy encrypted wallet address from your Wallet and enter it into the following command along with your private key.

Import account
import_key your_decentgo_username your_private_key

This command has imported your wallet into cli_wallet. In case you're getting an error message, wait until your DECENT daemon has synchronized blockchain. Unless the blockchain is completely synchronized, you cannot import your wallet and you'll get an error message.

After you have imported your wallet successfully, execute the following command three times to get 3 sets of keys which will be used for mining.

Generate 3 sets of keys

We will number these keys as key #1, #2 and #3.
They will be used to create a mining account and configure your miner. In the next step we will create a mining account.

Create account
register_account your_mining_account_username pub_key#1 pub_key#2 your_decentgo_username true

Mining account needs to have a balance of at least 1 DCT to be eligible for mining.
Transfer DCT from your DECENT Go wallet to your mining account to fund your miner.

Transfer 5 DCT
transfer your_decentgo_username your_mining_account_username 5.00 DCT "Mining deposit" true

We will now import your mining account to configure miner.

Import mining account
import_key your_mining_account_username wif_priv_key#2

After importing your mining account, close cli_wallet by pressing ctrl + D.
Open ~/.decent/data/decentd/config.ini and save your private key so that you don't have to import it with every cli_wallet run.

Add a line to config.ini
private-key = ["pub_key#2","wif_priv_key#2"]

Run cli_wallet again and create a miner.

unlock your_password
create_miner your_mining_account_username "URL to proposal" true

It is advised to change your keypair to key #3 which will be used as a signing key.

update_miner your_mining_account_username "URL to proposal" pub_key#3 true

Retrieve your miner's "id" by running the following command. It will be used to update config.ini file.

Retrieve miner's "id"
get_miner your_mining_account_username

Copy the value which starts with "1.4." and update your ~/.decent/data/decentd/config.ini.
Also replace the private-key with key #3.

Update config.ini
miner-id = "1.4.X"
private-key = ["pub_key#3","wif_priv_key#3"]

You're ready to start mining 😇
Restart your DECENT daemon — happy mining!

systemctl restart decent

How to run a backup miner node?

Each miner is identified by a signing key which is a combination of private key and public key.
In the previous examples we have already configured our miner to use key #3. If you'd like to run a backup miner node, you will need a new key #4. Generate the key in cli_wallet by running suggest_brain_key.

To deploy a new miner, follow this guide and deploy a miner to a new server.
Since you already have a mining account you can skip all steps related to creation and update of the account.
Just deploy a miner and use key #4 in config.ini as a private_key.

In case you primary miner stops mining due to for example server unavailability, you need to manually switch the signing key used for mining. Open cli_wallet and run the following command.

Switching singing key
update_miner your_mining_account_username "URL to proposal" pub_key#4 true

This will change the signing key used by your miner and your backup node will start mining Decent automatically.

How does miner voting work? a.k.a. What does Total Votes mean?

Total votes is a metric which determines if your miner is assigned any mining work. Based on the total votes the top X miners are selected and assigned mining work in the current maintenance interval.

At the time of writing the maintenance interval is set to 24 hours and the first 33 miners are assigned mining work. These parameters can be proposed to be changed in the future. If the proposal gets enough votes (a.k.a. support) it passes.

To determine the current interval and top X miners, use the following command.

  "parameters": {
    "maintenance_interval": 86400,  # interval in seconds, 86400 seconds = 24 hours
  "active_miners": [                # count the miners to get top X miner count

Based on Total votes your miner can be assigned work.
Total votes is the sum of DCT balance on accounts of users who voted for your miner at the time of maintenance interval.

This means that if someone votes for you with 100 DCT in their account, you receive Total votes worth 100 DCT. In case the 100 DCT is later moved to a different account, you lose 100 DCT worth of Total votes during the next maintenance interval.

A single account can vote for multiple miners. Every miner voted for by the account receives the same amount of votes. In this case each miner receives votes worth 100 DCT.

To see how many votes your miner has, use the following command.

get_miner your_mining_account_username 
  "total_votes": "12336400000000",

In our case the miner has 12336400000000 votes which is equal to 12 336 400 000 000 / 100 000 000 = 123 364 DCT worth of votes.

Need help?

Feel free to reach out in #mining on DECENT Slack if you have problems running your miner. My name is moonstalker and I'll be happy to help.

If this guide was helpful, consider voting for my miner 😇

vote_for_miner YOUR_ACCOUNT moonstalker true true

This page is sponsored

Node.js Hosting