Δημιουργώντας τον Πυρήνα του Dash

While Dash offers stable binary builds on the website and on GitHub, and development builds using Jenkins, many users will also be interested in building Dash binaries for themselves. The following guides are available:

These guides describe how to build the current stable version. To build the latest version from the develop branch, replace the normal git clone command with the following command when pulling from GitHub:

git clone https://github.com/dashpay/dash.git -b develop

Linux

This guide describes how to build Dash Core wallet without the GUI from source under Ubuntu Linux. For a more detailed guide, see the Unix Build Notes. The content on this page is intended to serve as a simple guide for general compilation of non-deterministic binary files from the stable source code. A standard installation of Ubuntu Linux 18.04 LTS will be used as an environment for the build. We assume you are running as a user with sudo permissions. First add the necessary extra repository and update all packages:

sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt update
sudo apt upgrade

Τώρα εγκαταστήστε τα dependencies όπως περιγράφεται στα έγγραφα της εγκατάστασης:

sudo apt install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git libdb4.8-dev libdb4.8++-dev curl
sudo apt install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libzmq3-dev

Επιλεκτικά μπορείτε να εγκαταστησετε τα Qt dependencies αν θέλετε να φτιάξετε το Dash GUI:

sudo apt install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler

Κατεβάστε το σταθερό Dash repository:

git clone https://github.com/dashpay/dash.git

Και δημιουργήστε:

cd dash
./autogen.sh
./configure
make
make install

Το /usr/local/bin τώρα περιλαμβάνει τα Dash binaries που συλλέξατε.

macOS

Dash can be built for macOS either using a cross-compiler under Linux or natively under macOS.

Linux cross-compile

This guide describes how to build Dash Core wallet from source under Ubuntu Linux. It is intended to serve as a simple guide for general compilation of non-deterministic binary files from the stable source code. For a more detailed guide, see the macOS Build Notes. A standard installation of Ubuntu Linux 18.04 LTS will be used as an environment for the build. We assume you are running as a user with sudo permissions. First add the necessary extra repository and update all packages:

sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt update
sudo apt upgrade

Τώρα εγκαταστήστε τα dependencies όπως περιγράφεται στα έγγραφα της εγκατάστασης:

sudo apt install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git libdb4.8-dev libdb4.8++-dev curl
sudo apt install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libzmq3-dev
sudo apt install ca-certificates curl g++ git-core pkg-config autoconf librsvg2-bin libtiff-tools libtool automake faketime bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python python-dev python-setuptools fonts-tuffy p7zip-full sleuthkit

Επιλεκτικά μπορείτε να εγκαταστησετε τα Qt dependencies αν θέλετε να φτιάξετε το Dash GUI:

sudo apt install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler

Κατεβάστε το σταθερό Dash repository:

git clone https://github.com/dashpay/dash.git
cd dash

A copy of the macOS SDK is required during the build process. To download this, use a Google Chrome in a desktop environment to go to https://appleid.apple.com and create or sign in to your Apple account. Then go to https://developer.apple.com and open the Chrome Developer Tools from the Menu -> More tools -> Developer tools. Click on the Network tab, then go back to your main browser window and copy in the following URL:

https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_7.3.1/Xcode_7.3.1.dmg

Cancel the download as soon as it begins and go back to your the Network tab in the developer tools. Right click on the network request at the bottom of the list labeled Xcode_7.3.1.dmg and select Copy -> Copy as cURL (bash). Paste this long string of text into your Linux terminal, append -o Xcode_7.3.1.dmg at the end and then press enter to begin the download. Once it is complete, extract the required files from the disc image as follows:

contrib/macdeploy/extract-osx-sdk.sh
rm -rf 5.hfs MacOSX10.11.sdk
mkdir depends/SDKs
mv MacOSX10.11.sdk/ depends/SDKs/

Και δημιουργήστε:

make -C depends HOST=x86_64-apple-darwin11
./autogen.sh
./configure --prefix=`pwd`/depends/x86_64-apple-darwin11
make

~/dash/src now contains the compiled Dash binaries, and ~/dash/src/qt contains the Dash GUI wallet.

macOS Native

This guide describes how to build Dash Core wallet from source under macOS. It is intended to serve as a simple guide for general compilation of non-deterministic binary files from the stable source code. For a more detailed guide, see the macOS Build Notes. A standard installation of macOS 10.13 High Sierra will be used as an environment for the build. We assume you are running as a user with sudo permissions. First, open a the Terminal app and enter the following command to install the OS X command line tools:

xcode-select --install

When the popup appears, click Install. Then install Homebrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install dependencies:

brew install automake berkeley-db4 libtool boost --c++11 miniupnpc openssl pkg-config protobuf qt libevent librsvg

Clone the Dash Core source code and change to the dash directory:

git clone https://github.com/dashpay/dash
cd dash

Build Dash Core. Configure and build the headless dash binaries as well as the GUI (if Qt is found). You can disable the GUI build by passing --without-gui to configure:

./autogen.sh
./configure
make

It is recommended to build and run the unit tests:

make check

You can also create a .dmg that contains the .app bundle (optional):

make deploy

Dash Core is now available at ./src/dashd.

Windows

This guide describes how to build Dash Core wallet from source for 64-bit Windows. Most developers use cross-compilation from Linux to build executables for Windows. The content on this page is intended to serve as a simple guide for general compilation of non-deterministic binary files from the stable source code. For a more detailed guide, see the Windows Build Notes. A standard installation of Ubuntu Linux 18.04 LTS will be used as an environment for the build. We assume you are running as a user with sudo permissions. First add the necessary extra repository and update all packages:

sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt update
sudo apt upgrade

Τώρα εγκαταστήστε τα dependencies όπως περιγράφεται στα έγγραφα της εγκατάστασης:

sudo apt install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git libdb4.8-dev libdb4.8++-dev curl
sudo apt install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libzmq3-dev
sudo apt-get install g++-mingw-w64-x86-64 mingw-w64-x86-64-dev

Επιλεκτικά μπορείτε να εγκαταστησετε τα Qt dependencies αν θέλετε να φτιάξετε το Dash GUI:

sudo apt install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler

Κατεβάστε το σταθερό Dash repository:

git clone https://github.com/dashpay/dash.git

Build and link the depends system:

cd dash/depends
make HOST=x86_64-w64-mingw32
cd ..
sudo update-alternatives --set x86_64-w64-mingw32-gcc  /usr/bin/x86_64-w64-mingw32-gcc-posix
sudo update-alternatives --set x86_64-w64-mingw32-g++  /usr/bin/x86_64-w64-mingw32-g++-posix

Και δημιουργήστε:

./autogen.sh
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
make

~/dash/src now contains the compiled Dash binaries, and ~/dash/src/qt contains the Dash GUI wallet.

Gitian

Το Gitian είναι η προσιοριστική διαδικασία δημιουργίας που χρησιμοποιούμε για να φτιάξουμε Dash Core executables. Μας δίνει ένα τρόπο για να είμαστε απολύτως σίγουροι ότι τα executables είναι φτιαγμένα από την πηγή (source) στο GitHub. Επίσης διασφαλίζει ότι τα ίδια, ελεγμένα dependencies χρησιμοποιούνται και ενσωματώνονται στατικά στο executable. Πολλαπλοί developers χτίζουν τον source code ακολουθώντας μία συγκεκριμένη «συνταγή», υπογράφοντας κρπτογραφικά το αποτέλεσμα και ανεβάζουν την υπογραφή που προκύπτει. Τα αποτελέσματα συγκρίνονται και μόνο αν συμπίπτουν, το build γίνεται δεκτό και ανεβαίνει στο dash.org.

Χρειαζόμαστε περισσότερους Gitian builders, για αυτό άλλωστε και υπάρχει αυτός ο οδηγός. Είναι προτιμώτερο να ακολουθήσετε αυτά τα βήματα ο ίδιος από το να χρησιμοποιήσετε την εικόνα VM κάποιου άλλου για να μην «μολυνθεί» το build.

Διαμορφώστε το host environment

Τα Gitian builds είναι γνωστό ότι δουλεύουν στο Debian 8.x. Αν το μηχάνημά σας ήδη τρέχει αυτό το σύστημα, μπορείτε να τρέξετε Gitian builds με το τρέχον hardware. Εναλλακτικά, μπορείτε να το εγκαταστήσετε σε μια virtual machine. Ακολουθήστε τον οδηγό για setting up a VPS for masternodes, επιλέξτε το Debian 8.x image κατά την διάρκεια της διαικασίας εγκατάστασης και ονομάστε τον non-root user gitianuser. Αν επιλέξετε ένα VPS με δύο επεξεργαστές θα επιταχύνετε πολύ την διαδικασία build. Αν δεν μπορείτε να κάνετε login στο VPS σας ως root μπείτε στο terminal και πληκτρολογήστε την ακόλουθη command:

sed -i 's/^PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
/etc/init.d/ssh restart

Καντε log in στο νέο περιβάλλον μέσω SSH ως root. Διαμορφώστε πρώτα τα dependancies κάνωντας paste τα παρακάτω στο terminal:

apt-get install git ruby sudo apt-cacher-ng qemu-utils debootstrap lxc python-cheetah parted kpartx bridge-utils make ubuntu-archive-keyring curl
adduser gitianuser sudo

Μετά διαμορφώστε το LXC και τα υπόλοιπα με τα παρακάτω, τα οποία είναι μια πολύπλοκη ομάδα από settings και workarounds:

# the version of lxc-start in Debian needs to run as root, so make sure
# that the build script can execute it without providing a password
echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-start" > /etc/sudoers.d/gitian-lxc
echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-execute" >> /etc/sudoers.d/gitian-lxc
# make /etc/rc.local script that sets up bridge between guest and host
echo '#!/bin/sh -e' > /etc/rc.local
echo 'brctl addbr br0' >> /etc/rc.local
echo 'ifconfig br0 10.0.3.2/24 up' >> /etc/rc.local
echo 'iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE' >> /etc/rc.local
echo 'echo 1 > /proc/sys/net/ipv4/ip_forward' >> /etc/rc.local
echo 'exit 0' >> /etc/rc.local
# make sure that USE_LXC is always set when logging in as gitianuser,
# and configure LXC IP addresses
echo 'export USE_LXC=1' >> /home/gitianuser/.profile
echo 'export GITIAN_HOST_IP=10.0.3.2' >> /home/gitianuser/.profile
echo 'export LXC_GUEST_IP=10.0.3.5' >> /home/gitianuser/.profile
reboot

Στο τέλος το Debian κάνει επανεκκίνηση για να επαληθεύσει ότι ισχύουν οι αλλαγές. Ξανα κάντε login ως ο χρήστης gitianuser που δημιουργήσατε κατά την διάρκεια της εγκατάστασης. Όλα τα υπόλοιπα βήματα σε αυτόν τον οδηγό γίνονται με αυτόν τον χρήστη.

Δεν υπάρχει πακέτο python-vm-builder στο Debian, οπότε πρέπει να το εγκαταστήσουμε από την πηγή μόνοι μας:

wget http://archive.ubuntu.com/ubuntu/pool/universe/v/vm-builder/vm-builder_0.12.4+bzr494.orig.tar.gz
echo "76cbf8c52c391160b2641e7120dbade5afded713afaa6032f733a261f13e6a8e  vm-builder_0.12.4+bzr494.orig.tar.gz" | sha256sum -c
# (verification -- must return OK)
tar -zxvf vm-builder_0.12.4+bzr494.orig.tar.gz
cd vm-builder-0.12.4+bzr494
sudo python setup.py install
cd ..

Διαμορφώστε το περιβάλλον και κάντε compile

Κλωνοποιήστε την αποθήκη Dash Core στο δικό σας home directory:

git clone https://github.com/dashpay/dash.git

Έπειτα δημιουργήστε το αρχείο script:

nano dash/contrib/gitian-build.sh

Και κάντε paste το ακόλουθο script (αυτό θα γίνει αυτόματα αν/όταν το script τοποθετείται στο Dash Core):

https://github.com/strophy/dash/blob/master/contrib/gitian-build.sh

Αποθηκεύστε το αρχείο και θέστε το ως executable:

sudo chmod +x dash/contrib/gitian-build.sh

Διαμορφώστε το περιβάλλον, αντικαθιστώντας το όνομα και την έκδοση με το δικό σας όνομα και την έκδοση στόχο:

dash/contrib/gitian-build.sh --setup strophy 0.12.1.5

Τρέξτε το compilation script:

dash/contrib/gitian-build.sh --build strophy 0.12.1.5

Το σύστημά σας θα χτίσει όλα τα dependancies και το Dash Core από την αρχή για πλατφόρμες Windows και Linux ( macOs αν τα dependancies εγκαταστήθηκαν σύμφωνα με αυτές τις οδηγίες). Αυτό μπορεί να πάρει λίγη ώρα. Μόλις ολοκληρωθεί, θαδείτε τα SHA256 checksums, τα οποία μπορείτε να τα συγκρίνετε με τα hashes που είναι διαθέσιμα στην ιστοσελίδα του Dash. Με αυτόν τον τρόπο, μπορείτε να είστε σίγουροι ότι τρέχετε αυθεντικά και untampered builds του κώδικα όπως αυτός υπάρχει στο GitHub.