Skip to content

Set the Environment

Based on the selection of the OS you are using, follow these steps to prepare an environment to run correctly.

Build and setup DCore node:


We provide a public testnet as test environment, which is not connected with the production environment.

In case you want to use IPFS, please, read the part regarding IPFS.


Build and Setup on Linux

These instructions are for installing DCore on Ubuntu 16.04. If you're running a different version of an 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*
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

Download DCore

mkdir -p ~/dev/DECENTfoundation
cd ~/dev/DECENTfoundation
git clone https://github.com/DECENTfoundation/DECENT-Network.git
cd DECENT-Network
git submodule update --init --recursive

Install DCore

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

Build and Setup on MacOS

Installing Prerequisites in MacOS

Then, execute in the console:

brew doctor
brew tap homebrew/versions
brew update
brew install \
  automake autoconf libtool cmake berkeley-db [email protected] \
  qt5 cryptopp doxygen byacc flex gettext git pbc gmp \
  ipfs openssl readline

Obtaining the Sources, Building, and Installing DCore in *nix (MacOS or Linux)

After all the prerequisites are installed, execute the following commands in console, in order to clone the repo, build and install/stage DCore:

# Clone the repo.
mkdir -p ~/dev/DECENTfoundation
cd ~/dev/DECENTfoundation
git clone https://github.com/DECENTfoundation/DECENT-Network.git
cd DECENT-Network
git submodule update --init --recursive

# Build and install DCore.
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

Note that in case of "Unix Makefiles" CMake generator, the last two commands are equivalent to:

make -j -l 3.0
make install

By this time you should have DCore files installed at ~/dev/DECENTfoundation/DECENT-Network-build/artifacts/prefix directory. You can specify any other custom install prefix for cmake during the initial configuration enter -D CMAKE_INSTALL_PREFIX=~/dev/DECENTfoundation/DECENT-Network-prefix to the command line.

You can use any path instead of ~/dev/DECENTfoundation in the steps above.

You can use Xcode, or any other CMake generator, and then, if it is an IDE generator, instead of building and installing via cmake in terminal, open the generated project/solution file in the corresponding IDE and perform ALL_BUILD and INSTALL (or install) actions from there.


Build and Setup on Windows

Installing Prerequisites

First, create a directory where you will store all the 3rd party applications written below. In this example we use C:/Projects/Decent/3rdParty/.

Visual Studio

You need Microsoft Visual Studio 2015 with Update 3. MS VS 2017 should work, but currently we are still using MS VS 2015.

CMake

Download and install CMake 3.8.1.

Cryptopp

  • Download cryptpp 5.6.3 and unzip into directory C:/Projects/Decent/3rdParty/cryptopp.

  • Open the solution in Visual Studio.

  • Find project cryptlib and open the md5.h and insert CRYPTOPP_DLL before every method:

CRYPTOPP_DLL static void InitState(HashWordType *state);
CRYPTOPP_DLL static void Transform(word32 *digest, const word32 *data);
CRYPTOPP_DLL static const char * StaticAlgorithmName() {return "MD5";}
  • Find the project cryptdll or in some case this is called cryptcpp and if it does not include file md5.cpp add this file to the project.

  • Build both projects as DLL - import Release for x64.

Perl

Download and install Perl 5.12.3.

NASM

Download and install NASM 2.13. We used this one nasm-2.13.02-installer-x64.exe.

OpenSSL

  • Download openssl-1.0.2j and unzip into directory C:/Projects/Decent/3rdParty/openssl-1.0.2j.

  • Run the vcvars64.bat from the Visual Studio directory to be sure that x64 variables are set and navigate to the folder C:/Projects/Decent/3rdParty/openssl-1.0.2j and run configuration scripts and nmake to build the openssl project:

perl Configure VC-WIN64A
ms\do_win64a
nmake -f ms\ntdll.mak
  • Copy content of openssl-1.0.2j/out32dll into openssl-1.0.2j/lib directory.

  • Copy content of openssl-1.0.2j/inc32 into openssl-1.0.2j/include directory.

  • Copy the file openssl.cnf from openssl-1.0.2j/apps into openssl-1.0.2j/ssl directory.

Boost

Download and install the boost 1_60_0 Windows prebuild to the directory C:\Projects\Decent\3rdParty\boost_1_60_0. We used this one boost_1_60_0-msvc-14.0-64.exe.

Doxygen

Download and install the doxygen. We used this one doxygen-1.8.14-setup.exe.

Qt

Download the QT online installer qt-unified-windows-x86-3.0.2-online.exe and run it to install the Qt (ver 5.8) into directory C:\Projects\Decent\3rdParty\Qt2.

MPIR

  • Download mpir-3.0.0 and unzip into directory C:/Projects/Decent/3rdParty/mpir-3.0.0.

  • Open the project for the library used for generic target (under build.vc14lib_mpir_gc or build.vc14dll_mpir_gc). Build the project as Release for x64.

Git

Install git to be able to obtain source codes from GitHub.

PBC

  • Get the PBC sources from github:
git clone https://github.com/blynn/pbc.git
  • Find the solution file in the pbcwin directory and open the project pbclib.vcxproj in Visual Studio.

  • Find the file pbc_vc_compat.win32 and comment this line:

//#define snprintf _snprintf
  • Add in the project properties the path to the mpir.lib library:
c:/Projects/Decent/3rdParty/mpir-3.0.0/build.vc14/lib_mpir_gc/x64/Release/mpir.lib
C:/Projects/Decent/3rdParty/mpir-3.0.0/build.vc14/lib_mpir_gc/x64/Release
  • Build the project as Release for x64.

cURL

  • Download curl 7.54.0 and unzip into directory C:/Projects/Decent/3rdParty/curl.

  • Enter project properties and change Target Platform version from 10 to 8.1.

  • Build the solution for target DLL Release - DLL Windows SSP1 for x64.

zlib

  • Download zlib 1.2.3 and unzip into directory C:/Projects/Decent/3rdParty/zlib123.

  • Open the project located in C:/Projects/Decent/3rdParty/zlib123\projects\visualc6\ in Visual Studio.

  • Build the project for target LIB Release for x64. By default the target is x86 so change it to x64.

Obtaining the DCore Sources

Navigate to the directory where you want to have the whole DECENT project and get the sources from git. We used the directory C:/Projects/Decent/:

git clone https://github.com/DECENTfoundation/DECENT-Network.git
cd DECENT-Network
git submodule update --init --recursive
git checkout master
 git pull

Building DCore on Windows

Because the CMake on Windows cannot rely on installed development packages with headers and libraries as on Linux, you must run CMake command line which specifies where your libraries are installed. After pulling sources from git set command line current directory to root of sources and run CMake from there. The following command line is used in our environment to generate all needed MS VS 2015 projects:

cmake -DCMAKE_CXX_FLAGS="/DWIN32 /D_WIN32_WINNT=0x0601; /IC:/Projects/Decent/3rdParty" -DBOOST_ROOT=C:/Projects/Decent/3rdParty/boost_1_60_0 -DBoost_COMPILER=-vc140 -DBOOST_INCLUDEDIR=C:/Projects/Decent/3rdParty/boost_1_60_0/boost -DBOOST_LIBRARYDIR=C:/Projects/Decent/3rdParty/boost_1_60_0/lib64-msvc-14.0 -DCMAKE_PREFIX_PATH=C:/Projects/Decent/3rdParty -DCMAKE_INCLUDE_PATH=C:/Projects/Decent/3rdParty -DCMAKE_LIBRARY_PATH=C:/Projects/Decent/3rdParty/cryptopp/x64/DLL_Output/Release -DOPENSSL_ROOT_DIR=C:/Projects/Decent/3rdParty/openssl-1.0.2j -DZLIB_LIBRARY=C:/Projects/Decent/3rdParty/zlib123/projects/visualc6/Win32_LIB_Release/zlib.lib -DZLIB_INCLUDE_DIR=C:/Projects/Decent/3rdParty/zlib123 -DCURL_LIBRARY="C:/Projects/Decent/3rdParty/curl/build/Win64/VC14/DLL Release - DLL Windows SSPI/libcurl.lib" -DCURL_INCLUDE_DIR=C:/Projects/Decent/3rdParty/curl/include -DGENERATEDGMP=C:/Projects/Decent/3rdParty/mpir-3.0.0/build.vc14/lib_mpir_gc/x64/Release -DPBCROOT=C:/Projects/Decent/3rdParty/pbc -DQt5Core_DIR=C:\Projects\Decent\3rdParty\Qt2\5.8\msvc2015_64\lib\cmake\Qt5Core -DQt5Widgets_DIR=C:\Projects\Decent\3rdParty\Qt2\5.8\msvc2015_64\lib\cmake\Qt5Widgets -DQt5Svg_DIR=C:\Projects\Decent\3rdParty\Qt2\5.8\msvc2015_64\lib\cmake\Qt5Svg -DQt5Core_DIR=C:\Projects\Decent\3rdParty\Qt2\5.8\msvc2015_64\lib\cmake\Qt5Core -DQt5Widgets_DIR=C:\Projects\Decent\3rdParty\Qt2\5.8\msvc2015_64\lib\cmake\Qt5Widgets -G "Visual Studio 14 2015 Win64" .

CMake generates all MS VS 2015 project files.

First, try to build decentd project, which builds all dependencies and decentd.exe. Then build CLI Wallet which builds cli_wallet.exe and finally build decent project which builds GUI.


First Launch of CLI Wallet

Navigate to programs/cli_wallet folder and run:

./cli_wallet

Setup the password for the wallet access:

new >>> set_password mypassword
set_password mypassword

Unlock the wallet to be ready for use:

locked >>> unlock mypassword
unlock mypassword

Result:

null
unlocked >>>

Install and Run IPFS

By calling the following commands you will download and install IPFS:

wget http://dist.ipfs.io/go-ipfs/v0.3.11/go-ipfs_v0.3.11_linux-amd64.tar.gz
tar -xsvf go-ipfs_v0.3.11_linux-amd64.tar.gz
cd dev/ipfs/
./install.sh

To run IPFS for the first time, use init command, otherwise call daemon in the command instead of init.

First launch of IPFS looks like:

ipfs init

Common launch of IPFS (the first call of IPFS was done before) is:

ipfs daemon

Make sure the IPFS version is at least 0.14.2. If not, run the update, for example using ipfs-update package.

To test the IPFS let us create test file:

echo "version 1 of my text" > mytextfile.txt

Add test file to IPFS:

$ ipfs add mytextfile.txt
added QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy mytextfile.txt

Now, try to open the file from IPFS:

$ ipfs cat QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy
version 1 of my text

When its content is shown IPFS is set correctly.