[Guide] Build Decent and start mining from scratch on Ubuntu 16.04 (for dummies)

in decent •  7 years ago  (edited)

Let's start off by saying that I am not very technical with the whole mining thing and that I started using linux two days prior to making this tutorial. This guide will work 100% but only on Ubuntu 16.04.
Also do not think that I am doubting anyones intelligence I simply explain the steps the way I understood them and in a manner that even someone who never used linux could understand.
So please read EVERYTHING and follow exactly these steps.

PS:

Make sure you have at least 1dct in your Decentgo account. If not buy some on any exchange selling DCT.
You can support me by donating or voting for me
(or both).
User ID: fahdminer1

1-Prerequisites:

Just copy paste these commands line by line and keep an eye for any error message (do not copy the $ sign):
$ 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 libcurl4-openssl-dev python-dev libicu-dev libbz2-dev
$ 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*
$ wget https://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz
$ 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)
$ ./bootstrap.sh --prefix=$BOOST_ROOT
$ ./b2 install
$ cd ..
$ rm -rf boost_1_60_0 boost_1_60_0.tar.gz
Now all prerequisites are installed. Next is building decent from scratch

2-Building Decent:

Again just copy paste and do not copy the $ sign:
$ mkdir -p ~/dev/DECENTfoundation
$ cd ~/dev/DECENTfoundation
$ git clone https://github.com/DECENTfoundation/DECENT-Network.git
$ cd DECENT-Network
$ git submodule update --init --recursive
$ 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
Decent is now installed

3-Starting Decent and creating your first miner:

Start Decent:
$ ~/dev/DECENTfoundation/DECENT-Network-build/artifacts/prefix/bin/decentd
Open a second terminal and start the wallet:
$ ~/dev/DECENTfoundation/DECENT-Network-build/artifacts/prefix/bin/cli_wallet
The wallet will start and will ask you to set a password for it:
set_password the_password_you_want
Your wallet will show locked. To unlock:
unlock the_new_created_password
Now you have to import your account (the one you created on DecentGo) if you do not have one www.decentgo.com and sign up.
Open your account on decentgo and go to wallet and copy your encrypted ID
Go to security and generate recovery phrase which will give you your Private and Public Keys. Copy the Private Key.
Back to the command screen import your account:
import_key your_decentgo_ID your_decentgo_private_key
Now that you decentgo account is imported you have to create a miner account so make sure you have some DCT in your decentgo account.
First generate new keys for the account:
suggest_brain_key
Do it three times (x3) and save the result.
-Public key starts with DCT
-Private key starts with 5
Example:
unlocked >>> suggest_brain_key
suggest_brain_key
{
"brain_priv_key": "AGILITY SWALER IMSONIC FELWORT TIP GRIZZLE BARTER SANDBOY GROOM BAKING WHEYISH ALEVI PRECESS VELA SCUTE BANKET",
"wif_priv_key": "5KUp8YKUGRns8yhTqWCKonRMp9pnMnKrUJYrgJ7QXow6gD2sVG2",
"pub_key": "DCT76XjhRKre1MBNJp43ASFjKMBK7c9aX7SNHhfBCg3nsCsyAVAT1"
}
Securely save these three sets of keys and DO NOT LOSE THEM!!
Now create an account using a username of your choice:
register_account your_chosen_name public_key1 public_key2 your_decentgo_encryptedID true
-your_chosen_name: the username you want to have
-public_key1: the first pub_key you generated
-public_key2: the second pub_key you generated
-your_decentgo_encryptedID: the decentgo wallet encrypted address (this address will pay the fees to create the account)
Import your newly created account to the wallet:
import_key your_created_username your_private_key2

Creating a miner

Transfer at least 0.5 DCT to your new account to be able to create a miner.
To send DCT go to decentgo wallet and send the amount you want to the username you created.
Next is creating your miner:
create_miner your_username "proposal URL" true
Proposal URL can be left empty by typing ""
Your miner is now created. You now need to get the miner info
get_miner your_username
Now copy the the miner ID:
get_miner fahdminer1
{
"id": "1.4.83",
"miner_account": "1.2.2559",
"last_aslot": 0,
"signing_key": "DCTdsfmnkrjx75dRXZob88uAVShTaGj7WfiQLPL2zjYuHUhd5TEos",
"vote_id": "0:82",
"total_votes": "1290648626945",
"url": "",
"total_missed": 0,
"last_confirmed_block_num": 0
}
miner ID looks like 1.4.XX

4- Start your miner

Before starting the miner you have to update your config.ini file
First install nano to edit the config.ini:
apt-get install nano
Now open the path for config.ini which is located in .decent folder in your home directory:
$ cd ~
$ cd .decent/data/decentd
$ nano config.ini
Edit the line miner ID with you miner ID 1.4.xx
Edit the line private-key by removing the # and adding your keys:
private-key = ["public_key3","your_private_key3"]
Where:
public_key3: the third public key you generated
private_key3: the third private key you generated
Save the changes by pressing Ctrl+X and pressing Y and Enter
Now you have to update your miner with the new info. To do so open cli_wallet again and type:
update_miner your_miner_name "" public_key3 true
You re all set now.
To start the miner simply type the following command:
$ ~/dev/DECENTfoundation/DECENT-Network-build/artifacts/prefix/bin/decentd
To open the wallet:
$ ~/dev/DECENTfoundation/DECENT-Network-build/artifacts/prefix/bin/cli_wallet
Your miner is online now but you still need to get votes to be activated.

5-Voting for miners:

To vote open the cli_wallet and type:
vote_for_miner your_ID target_miner true true
Your ID is your username if you made a new account using cli_wallet or your decentgo encryptedID
That is all

You can support me by donating or voting for me

(or both).

User ID: fahdminer1

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Welcome to Steem @fad88 :)

Couple notes after skimming:

Should remove libboost-all-dev from the apt-get install list. You're installing a newer version of Boost right after, and it's pretty big.

I think this step needs sudo privileges: ./b2 install. It will also go faster using the -j flag followed by the number of logical cores you'd like to use.

Under section 2, building, there needs to be a step of git checkout [current version release tag] before the git submodule update step.

Remove the CMAKE_BUILD_TYPE=Debug from the cmake step unless you want to debug. It increases load and time while syncing and replaying, among other things.

Transfer at least 0.5 DCT to your new account to be able to create a miner.

A minerwitness account should have a bit more balance to do a few update_miners

sudo is only necessary when installing into administrative directories such as /etc or /usr

In this case it's more preferred to use ./bootstrap --prefix=/path/to/install/directory then ./b2 -j[1-4] I recommend setting the processor concurrency to 2 more than the # of logical cores, so if you have 4 then set it to 6, I've cut compiling times down by 15-30 mins.

No need to instruct installing nano as that's a default package in Ubuntu 16.04+

Thanks for the guide, I will follow it to setup a witness very soon.
upvoted and resteemed