Compilazione Dash Core#

While Dash offers stable binary builds on the website and on GitHub, and development builds using GitLab CI, many users will also be interested in building Dash binaries for themselves. Users who do not required deterministic builds can typically follow the generic build notes available on GitHub to compile or cross-compile Dash for any platform.

Guix#

Guix è il processo di compilazione deterministico utilizzato per creare gli eseguibili Dash Core. Fornisce un modo per essere ragionevolmente sicuri che gli eseguibili siano realmente creati dall’origine su GitHub. Garantisce inoltre che le stesse dipendenze testate vengano utilizzate e integrate staticamente nell’eseguibile. Più sviluppatori costruiscono il codice sorgente seguendo un descrittore specifico («ricetta»), firmano crittograficamente il risultato e caricano la firma risultante. Questi risultati vengono confrontati e solo se corrispondono, la build viene accettata e caricata su dash.org.

Le istruzioni per creare Dash Core 19.0 o versioni precedenti utilizzando gitian sono disponibili in una versione precedente di questa pagina <https://docs.dash.org/en/19.0.0/docs/user/developers/compiling.html#gitian >`__.

Ambiente di installazione#

Nota

Questa configurazione è stata testata utilizzando un’installazione pulita di Ubuntu 22.04. Per la massima compatibilità, utilizzare quella versione.

Inizia accedendo come utente «root». Crea un nuovo utente con il seguente comando, sostituendo <username> con un nome utente a tua scelta:

adduser <username>

Ti verrà richiesta una password. Immettere e confermare utilizzando una nuova password (diversa dalla password di root) e conservarla in un luogo sicuro. Verranno visualizzate anche richieste di informazioni sull’utente, ma questo può essere lasciato vuoto. In alternativa, un utente esistente può essere utilizzato su sistemi già in uso (ad esempio il sistema di sviluppo esistente).

Aggiungi l’utente ai gruppi sudo e docker in modo che possa eseguire comandi come root ed eseguire comandi docker:

usermod -aG sudo <username>

Installa i prerequisiti#

Mentre sei ancora connesso come root, aggiorna il sistema dal repository dei pacchetti Ubuntu:

apt update
apt upgrade -y

Installa gli strumenti di creazione richiesti:

apt-get install build-essential

Prepara guix#

It is only necessary to run this step during the initial setup of your machine. Run the guix install routine to prepare your environment and answer «Y» for all prompts:

sudo apt install guix
cd /tmp
wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh
chmod +x guix-install.sh
./guix-install.sh

Clonazione di repository#

Dopo aver installato i prerequisiti e preparato GUIX, riavviare il sistema, accedere come <username> e clonare i repository richiesti:

git clone https://github.com/dashpay/dash
git clone https://github.com/dashpay/guix.sigs
git clone https://github.com/dashpay/dash-detached-sigs

Scarica l’SDK di macOS necessario per creare build di macOS:

mkdir -p ~/guix-dash/macOS-SDKs
wget -N -P ~/guix-dash https://bitcoincore.org/depends-sources/sdks/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers.tar.gz
tar -xvzf ~/guix-dash/Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers.tar.gz --directory ~/guix-dash/macOS-SDKs/

Costruisci Dash Core#

Acquista il tag associato alla versione Dash Core che intendi creare:

# <version> = Dash Core tag to build
# Example: git checkout v20.0.3
cd ~/dash
git checkout v20.0.3

Esegui guix-build per creare binari per Linux, Mac e Windows:

# Example: Build binaries for all OSes
env SDK_PATH="$HOME/guix-dash/macOS-SDKs" ./contrib/guix/guix-build

Una volta completata la compilazione, i file binari verranno inseriti nella directory guix-build-/output/.

Crea firme per i file binari#

I file binari per Mac e Windows sono firmati da Dash Core Group utilizzando i relativi processi Apple e Microsoft. In questo passaggio, tali informazioni verranno convalidate e firmate dalla tua macchina.

Preparare il repository distaccato sigs:

cd ~/dash-detached-sigs/
git checkout master
git pull
# Checkout the branch for the version being built
# Example: git checkout v20.0.3
git checkout v<version>

Prepara il repository guix.sigs estraendo le ultime modifiche:

cd ~/guix.sigs/
git checkout master
git pull

Crea un nuovo ramo per la versione che è stata creata:

# <signer> = The name associated with your PGP key
# <version> = Dash Core tag to build (exclude the leading "v")
# Example: git checkout -b 20.0.3-alice
git checkout -b <version>-<signer>

Binari non firmati#

Per creare firme per i file binari non firmati, eseguire guix-attest:

# <signer> = The name associated with your PGP key
# Example: env GUIX_SIGS_REPO=~/guix.sigs SIGNER=alice ./contrib/guix/guix-attest
cd ~/dash
env GUIX_SIGS_REPO=~/guix.sigs SIGNER=<signer> ./contrib/guix/guix-attest

Nota

Il parametro firmatario deve essere impostato sul valore fornito per «Nome reale» quando si genera una chiave con GPG. Consulta il GnuPrivacyGuard Howto per i dettagli su come generare una chiave se non ne hai già una.

Binari firmati#

Per creare firme per i binari firmati, eseguire guix-codesign seguito da guix-attest:

env DETACHED_SIGS_REPO=~/dash-detached-sigs ./contrib/guix/guix-codesign
# <signer> = The name associated with your PGP key
# Example: env GUIX_SIGS_REPO=~/guix.sigs SIGNER=alice ./contrib/guix/guix-attest
env GUIX_SIGS_REPO=~/guix.sigs SIGNER=<signer> ./contrib/guix/guix-attest

Carica firme#

Dopo aver creato con successo i file binari, averli firmati e verificato le firme, puoi facoltativamente contribuire al repository guix.sigs tramite una richiesta pull su GitHub .

Configurazione iniziale#

Poiché il repository ufficiale guix.sigs ha un accesso in scrittura limitato, creane un fork tramite GitHub e aggiungi il tuo fork come repository remoto:

cd ~/guix.sigs
git remote add me https://github.com/<your GitHub username>/guix.sigs

La prima volta che contribuisci con le firme, inserisci anche una copia della tua chiave pubblica nella cartella «builder-keys» del repository in modo che altri possano verificare facilmente la tua firma. La tua chiave pubblica può essere esportata in un file utilizzando il seguente comando:

# <signer> = The name associated with your PGP key
# Example: gpg --output alice.pgp --armor --export alice
gpg --output <signer>.pgp --armor --export <signer>

Aggiunta delle tue firme#

Aggiungi e conferma i file *.SHA256SUMS e *.SHA256SUMS.asc creati dal processo di compilazione:

# Example: git add 20.0.3
git add <version>
# Example: git commit -m "chore: add guix signatures for alice for 20.0.3"
git commit -m "chore: add guix signatures for <signer> for <version>"

Invia al tuo fork del repository guix.sigs su GitHub:

# "me" references the name of the remote repository added during initial setup
git push me

Vai su GitHub e apri una richiesta pull al ramo master del repository upstream. La richiesta pull verrà esaminata dagli sviluppatori Dash Core e unita se tutto va a buon fine. Grazie per aver contribuito!

Verifica le firme#

Il repository guix.sigs contiene risultati di build deterministici firmati da più sviluppatori Core per ogni versione. Il repository contiene anche chiavi pubbliche utilizzate per la verifica della firma. Importa le chiavi pubbliche:

cd ~/guix.sigs
git pull
gpg --import builder-keys/*.pgp

Esegui i seguenti comandi per verificare che la tua build corrisponda alla versione ufficiale:

cd ~/dash
git -C ~/guix.sigs pull
# Example:
# git checkout 20.0.3
git checkout <version>
env GUIX_SIGS_REPO=~/guix.sigs ./contrib/guix/guix-verify

Dovresti ottenere un risultato simile al seguente per Linux, Windows, MacOS, Signed Windows e Signed MacOS. Supponendo che i passaggi precedenti siano stati completati con successo, vedrai anche le tue firme con lo stato «OK».

Looking for signature directories in '../guix.sigs/20.0.3'

--------------------

gpg: Signature made Tue Dec 26 15:15:29 2023 EST
gpg:                using RSA key 3F5D48C9F00293CD365A3A9883592BD1400D58D9
gpg:                issuer "udjinm6@dash.org"
gpg: Good signature from "UdjinM6 <UdjinM6@dash.org>" [unknown]
gpg:                 aka "UdjinM6 <UdjinM6@dashpay.io>" [unknown]
gpg:                 aka "UdjinM6 <UdjinM6@gmail.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 3F5D 48C9 F002 93CD 365A  3A98 8359 2BD1 400D 58D9
Files ../guix.sigs/20.0.3/UdjinM6/noncodesigned.SHA256SUMS and ../guix.sigs/20.0.3/UdjinM6/noncodesigned.SHA256SUMS are identical
Verified: '../guix.sigs/20.0.3/UdjinM6/noncodesigned.SHA256SUMS'

gpg: Signature made Wed Dec 27 01:21:08 2023 EST
gpg:                using RSA key 15191D05B5CF956FE37C95962176C4A5D01EA524
gpg:                issuer "knstqq@gmail.com"
gpg: Good signature from "Konstantin Akimov <knstqq@gmail.com>" [unknown]
gpg:                 aka "Konstantin Akimov <konstantin.akimov@dash.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 1519 1D05 B5CF 956F E37C  9596 2176 C4A5 D01E A524
5c5
< 40613fc2d13198d7765a9bbcf2feeca93bc43dc57c74f26ee631185437b8e100  dashcore-20.0.3-arm64-apple-darwin-debug.tar.gz
---
> 8035094d94fca4f8ed3abf50eb5707ba60910a345a7072b57b3271d98cb1a92b  dashcore-20.0.3-arm64-apple-darwin-debug.tar.gz
12c12
< 90924b90e73f50bf072798c9911e37f6b97b7863b04dd88575161392e661e1c2  dashcore-20.0.3-x86_64-apple-darwin-debug.tar.gz
---
> 46113d6c4ac419d9df78244ac951d9021f43cef80eb3e4ecee4f37c5d448ddfa  dashcore-20.0.3-x86_64-apple-darwin-debug.tar.gz
ERR: The SHA256SUMS attestation in these two directories differ:
    '../guix.sigs/20.0.3/UdjinM6/noncodesigned.SHA256SUMS'
    '../guix.sigs/20.0.3/knst/noncodesigned.SHA256SUMS'

gpg: Signature made Tue Dec 26 13:13:27 2023 EST
gpg:                using RSA key 29590362EC878A81FD3C202B52527BEDABE87984
gpg:                issuer "pasta@dashboost.org"
gpg: Good signature from "Pasta <pasta@dashboost.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 2959 0362 EC87 8A81 FD3C  202B 5252 7BED ABE8 7984
5c5
< 40613fc2d13198d7765a9bbcf2feeca93bc43dc57c74f26ee631185437b8e100  dashcore-20.0.3-arm64-apple-darwin-debug.tar.gz
---
> bb577ed0a7a577a67fde39ac9c00ddfe11991aa98f44d850eb45c0f18d52709f  dashcore-20.0.3-arm64-apple-darwin-debug.tar.gz
12c12
< 90924b90e73f50bf072798c9911e37f6b97b7863b04dd88575161392e661e1c2  dashcore-20.0.3-x86_64-apple-darwin-debug.tar.gz
---
> 1c650cfe167c4f16dc8329701b94fe507dcb758a9b874c65633667d7fdcfa377  dashcore-20.0.3-x86_64-apple-darwin-debug.tar.gz
ERR: The SHA256SUMS attestation in these two directories differ:
    '../guix.sigs/20.0.3/UdjinM6/noncodesigned.SHA256SUMS'
    '../guix.sigs/20.0.3/pasta/noncodesigned.SHA256SUMS'

gpg: Signature made Tue Dec 26 14:32:19 2023 EST
gpg:                using RSA key FD4A3062EE42C95FE9B34DBC6317F01E6F491072
gpg:                issuer "thephez@gmail.com"
gpg: Good signature from "thephez <thephez@gmail.com>" [full]
5c5
< 40613fc2d13198d7765a9bbcf2feeca93bc43dc57c74f26ee631185437b8e100  dashcore-20.0.3-arm64-apple-darwin-debug.tar.gz
---
> cbb3213303c3813c818fdda91671acf60d7c81f8f13800c297fcd66e4058b799  dashcore-20.0.3-arm64-apple-darwin-debug.tar.gz
12c12
< 90924b90e73f50bf072798c9911e37f6b97b7863b04dd88575161392e661e1c2  dashcore-20.0.3-x86_64-apple-darwin-debug.tar.gz
---
> 4b084a5153024de5806f1bc8cd48914d6cf686d52602bcf52cf671023dca602b  dashcore-20.0.3-x86_64-apple-darwin-debug.tar.gz
ERR: The SHA256SUMS attestation in these two directories differ:
    '../guix.sigs/20.0.3/UdjinM6/noncodesigned.SHA256SUMS'
    '../guix.sigs/20.0.3/thephez/noncodesigned.SHA256SUMS'

DONE: Checking output signatures for noncodesigned.SHA256SUMS

--------------------

WARN: No signature directories with all.SHA256SUMS found

====================

Gitian#

Avvertimento

Le build Gitian sono state deprecate a favore delle build Guix con il rilascio di Dash Core v20.0. Le istruzioni sulla creazione di Dash Core 19.0 o versioni precedenti utilizzando gitian sono disponibili in una versione precedente di questa pagina <https://docs.dash.org/en/19.0.0/docs/user/developers/compiling.html#gitian> `__.