LogoLogo
  • WELCOME TO ALEPH ZERO
  • EXPLORE
    • About Aleph Zero
    • AlephBFT Consensus
    • The Economy of Aleph Zero
    • Where to Buy AZERO
    • Decentralized Governance on Aleph Zero
    • Ecosystem
    • Aleph Zero Foundation Treasury Management
    • Community
    • Glossary
    • Audit & Research Papers
  • USE
    • Wallets
    • Explorer
    • Ledger
    • Telegram Notifications
    • Aleph Zero Signer
      • General introduction
      • What does Signer do?
      • What are Sub-accounts and Sub-account paths?
      • Why is it critical to store your Secret Phrase in a safe place?
      • How to forget and restore accounts?
      • What are Networks?
      • What are Trusted apps?
    • Dashboard
      • Dashboard basics
      • Overview
    • Stake
      • Staking Basics
      • Staking Menu Overview
      • How to Start Staking with the Aleph Zero Dashboard
      • How to Start Staking With the Developer Wallet
      • How to start staking using Ledger hardware wallet
      • How to Change Nominations
      • How to Stop Staking
      • Staking Rewards
      • Validators
      • Commission and Foundation Nodes
      • Proxy Accounts
    • Validate
      • Validating Overview
      • Hardware requirements
      • Running an Aleph Node on Testnet
        • Downloading and running the node
        • Verifying your setup
        • Customizing your setup
        • Building and running from source [advanced]
          • Building from source
          • Set environment variables
          • Download DB snapshot
          • Running the binary
        • Appendix: Ports, addresses, validators, and archivists
      • Running an Aleph Node on Mainnet
        • Running the node
        • Building and running from source [advanced]
      • Setting your identity
      • Making the node validate
      • Securing your validator
      • Troubleshooting
      • Elections and Rewards Math
      • Testnet Validator Airdrop
      • Foundation Nomination Program
    • Using the EVM-layer
    • Governance
      • Token
      • Multisig Accounts
  • BUILD
    • Aleph Zero smart contracts basics
      • Setting up a Testnet account
      • Installing required tools
      • Creating your first contract
      • Deploying your contract to Aleph Zero Testnet
      • Extending your contract
    • Cross contract calls
      • Using references
      • Using dynamic calls
    • Migrating from Solidity
    • Writing e2e tests with ink-wrapper
    • Aleph Zero Signer integration
    • Front-end app: smart contract interaction
    • Security Course by Kudelski Security
      • ink! Developers Security Guideline
      • Lesson 1 - Getting started with ink!
      • Lesson 2 - Threat Assessment
      • Lesson 3 - Integer Overflow
      • Lesson 4 - Signed-integer
      • Lesson 5 - Role-Based Access Control
      • Lesson 6 - Address Validation
      • Lesson 7 - Smart Contract Control
    • Development on EVM-layer
  • PROTOCOL DETAILS
    • Shielder
      • Overview
      • Design against Bad Actors
      • Preliminaries - ZK-relations
      • Notes and Accounts
      • ZK-ID and Registrars
      • Anonymity Revokers
      • PoW Anonymity Revoking
      • Relayers
      • Deterministic Secret Management
      • SNARK-friendly Symmetric Encryption
      • SNARK-friendly Asymmetric Encryption
      • Cryptography
      • Token shortlist
      • User Wallet
      • Versioning
      • PoC
      • Version 0.1.0
      • Version 0.2.0
    • Common DEX
      • Common Whitepaper - Differences
      • Dutch Auctions
  • FAQ
  • Tutorials
    • Withdrawing coins from exchanges
      • How to withdraw your AZERO coins from KuCoin
      • How to withdraw your AZERO coins from MEXC Global
      • How to withdraw your AZERO coins from HTX
  • Setting up or restoring a wallet
    • How to set up or recover your AZERO account using Aleph Zero Signer
    • How to set up or recover your AZERO account using the official mainnet web wallet
    • How to set up or recover your AZERO account using Nova Wallet
    • How to set up or recover your AZERO account using SubWallet
    • How to set up or recover your AZERO account using Talisman
  • Staking
    • How to stake via a direct nomination using the Aleph Zero Dashboard
    • How to stake via a nomination pool using the Aleph Zero Dashboard
    • How to destroy a nomination pool via the Aleph Zero Dashboard
Powered by GitBook
On this page
  • Getting the repository
  • Nix
  • Docker
  • Cargo

Was this helpful?

  1. USE
  2. Validate
  3. Running an Aleph Node on Testnet
  4. Building and running from source [advanced]

Building from source

PreviousBuilding and running from source [advanced]NextSet environment variables

Last updated 1 month ago

Was this helpful?

When building from source, you have three options:

  1. Build using Nix, a package manager that keeps your system configuration intact and maintains a minimal set of dependencies

  2. Build with Nix inside a Docker image (doesn’t require you to install nix)

  3. Build using Cargo and the usual Rust build process

Getting the repository

All those three methods require you to download Aleph’s code repository:

git clone https://github.com/Cardinal-Cryptography/aleph-node.git
cd aleph-node

Nix

  1. Install Nix:

sh <(curl -L https://nixos.org/nix/install) --daemon
  1. Checkout a Testnet or Mainnet aleph-nodetag, see

git checkout r-15.2.0
  1. Use nix to build the node binary:

nix-shell --pure --run 'cargo build --release --locked --package aleph-node' shell.nix

The binary will be stored as target/release/aleph-node

Docker

In order to build a binary for aleph-node using docker we first need to install docker itself, i.e. in case of the Ubuntu Linux distribution, by executing sudo apt install docker.io (please consult your distribution's manual describing docker installation procedure). Build procedure can be invoked by running:

sudo docker build -t aleph-node/build -f nix/Dockerfile.build .
sudo docker run -ti --volume=$(pwd):/node/build aleph-node/build

Binary will be stored in $(pwd)/aleph-node

Cargo

This way is not recommended as it can potentially interfere with your system’s configuration but we provide it for the sake of this guide’s completeness.

First of all, you will need some system-level dependencies. These are build dependencies we use in our Linux images for aleph-node:

bash
binutils
clang
git
glibc
llvm
nss-cacert
openssl
pkg-config
protobuf
rust-nightly

Example build procedure using Ubuntu 20.04 LTS and bash shell:

sudo apt update
sudo apt install build-essential curl git clang libclang-dev pkg-config libssl-dev protobuf-compiler
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
git clone https://github.com/Cardinal-Cryptography/aleph-node.git
cd aleph-node
rustup show
rustup target add x86_64-unknown-linux-gnu wasm32-unknown-unknown
cargo build --profile production -p aleph-node

The binary will be located in the target/release directory in the aleph-node repository. It is named aleph-node.

Of course, if you want to build a specific release, you can checkout an appropriate tag after cloning the repository, similarly to the Nix guide above. For example:

git checkout r-15.2.0

Version of the rust toolchain is specified by the file within the aleph-node repository. You can use to install a specific version of rust, including its custom compilation targets. Using rustup, it should set a proper toolchain automatically while you call rustup show within project's root directory.

The best way to find the tag is to use page

https://alephzero.org/developers#developer-resources
rust-toolchain
rustup
https://alephzero.org/developers#developer-resources