Compilar Dash Core

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

Ahora instala las dependencias como se describe en la documentación de instalación:

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

De manera opcional, instala las dependencias de Qt si deseas compilar la GUI de Dash:

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

Descarga el repositorio estable de Dash:

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

Y construye:

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

/usr/local/bin ahora contiene los binarios compilados de Dash.

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

Ahora instala las dependencias como se describe en la documentación de instalación:

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

De manera opcional, instala las dependencias de Qt si deseas compilar la GUI de Dash:

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

Descarga el repositorio estable de Dash:

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/

Y construye:

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

Ahora instala las dependencias como se describe en la documentación de instalación:

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

De manera opcional, instala las dependencias de Qt si deseas compilar la GUI de Dash:

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

Descarga el repositorio estable de Dash:

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

Y construye:

./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 es el proceso de compilación determinista que se utiliza para compilar los ejecutables de Dash Core. Proporciona una forma de estar razonablemente seguro de que los ejecutables están realmente construidos desde la fuente en GitHub. También se asegura de que se usen las mismas dependencias probadas y estén integradas estáticamente en el ejecutable. Múltiples desarrolladores crean el código fuente siguiendo un descriptor específico («receta»), firman criptográficamente el resultado y cargan la firma resultante. Estos resultados se comparan y solo si coinciden, la compilación es aceptada y cargada en dash.org.

Se necesitan constructores de Gitian más independientes, razón por la cual existe esta guía. Es preferible que sigas estos pasos tu mismo en lugar de usar la imagen de VM de otra persona para evitar “contaminar” la compilación.

Configurar el entorno de alojamiento

Se sabe que las versiones de Gitian están trabajando en Debian 8.x. Si tu máquina ya está ejecutando este sistema, puedes realizar compilaciones de Gitian en el hardware actual. Alternativamente, puedes instalarlo en una máquina virtual. Siguiendo la guía para configurar un VPS para masternodes, seleccionando una imagen de Debian 8.x durante el proceso de instalación y nombrando a tu usuario non-root gitianuser. Seleccionar un VPS con dos procesadores también acelerará en gran medida el proceso de compilación. Si no puedes iniciar sesión en tu VPS a través de SSH como root, accede al terminal y emite el siguiente comando:

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

Inicia sesión en su tuevo entorno mediante SSH como raíz. Configura las dependencias primero pegando lo siguiente en el 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

Luego configura LXC y el resto con lo siguiente, que es una mezcla compleja de configuraciones y soluciones:

# 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

Al final, Debian se reinicia para garantizar que los cambios entren en vigencia. Vuelve a iniciar sesión como el usuario gitianuser que se creó durante la instalación. El resto de los pasos en esta guía se realizarán como ese usuario.

No existe el paquete python-vm-builder en Debian, por lo que debemos instalarlo desde la fuente nosotros mismos:

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 ..

Configurar el entorno y compilar

Clona el repositorio de Dash Core en tu directorio personal:

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

Luego crea el archivo de script:

nano dash/contrib/gitian-build.sh

Y pega el siguiente script en su lugar (esto será automático si/cuando el script se inserta en Dash Core):

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

Guarda el archivo y configúralo como ejecutable:

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

Configurar el entorno, reemplazando el nombre y la versión con tu nombre y versión de destino:

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

Ejecuta el script de compilación:

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

Tu sistema creará todas las dependencias y el Dash Core desde cero para plataformas Windows y Linux (macOS si las dependencias se instalaron de acuerdo con estas instrucciones). Esto puede llevar algo de tiempo. Cuando se complete, verás las sumas de comprobación SHA256, con las que puedes comparar con los valores disponibles en el Sitio web de Dash. De esta manera, puedes estar seguro de que estás ejecutando compilaciones originales y sin moderar del código tal como existe en GitHub.