Hello, I'm Heorhii, and I'm here to guide you through the setup and usage of snarkOS, a decentralized operating system for zk apps. This powerful system forms the backbone of the Aleo network, verifying transactions and storing the encrypted state of apps in a publicly verifiable manner.
Advantages of using snarkOS
Privacy and security: snarkOS leverages zk proofs, ensuring that transactions and data remain private and secure while still allowing for public verifiability.
Decentralization: by supporting a decentralized infrastructure, snarkOS eliminates single points of failure and increases the resilience and reliability of apps.
Scalability: the architecture of snarkOS is designed to handle high transaction volumes efficiently, making it suitable for large-scale apps.
Interoperability: snarkOS supports various cryptographic primitives and standards, enabling interoperability with other blockchain networks and cryptographic protocols.
Developer-friendly: with comprehensive documentation, a robust set of tools, and an active developer community, snarkOS makes it easier for developers to build and deploy zk apps.
Build guide:
1. Requirements: to run an Aleo node, ensure your machine meets the following minimum requirements:
OS: 64-bit architectures only, latest up-to-date for security. Clients: Ubuntu 22.04 (LTS), macOS Ventura or later, Windows 11 or later. Provers: Ubuntu 22.04 (LTS), macOS Ventura or later. Validators: Ubuntu 22.04 (LTS)
CPU: 64-bit architectures only. Clients: 16-cores. Provers: 32-cores (64-cores preferred). Validators: 32-cores (64-cores preferred)
RAM: DDR4 or better. Clients: 16GB of memory. Provers: 32GB of memory (64GB or larger preferred). Validators: 64GB of memory (128GB or larger preferred)
Storage: PCIe Gen 3 x4, PCIe Gen 4 x2 NVME SSD, or better. Clients: 64GB of disk space. Provers: 128GB of disk space. Validators: 2TB of disk space (4TB or larger preferred)
Network: Symmetric, commercial, always-on. Clients: 100Mbps of upload and download bandwidth. Provers: 250Mbps of upload and download bandwidth. Validators: 500Mbps of upload and download bandwidth
GPU: Clients: Not required at this time. Provers: CUDA-enabled GPU (optional). Validators: Not required at this time
Note: For competitive performance, especially for Aleo Provers, more than the minimum requirements may be needed.
2. Installation:
Ensure Rust v1.66+ is installed. Rust installation instructions.
Clone the snarkOS repository:
git clone https://github.com/AleoHQ/snarkOS.git --depth 1
Move into the snarkOS directory:
cd snarkOS
[For Ubuntu users] Install dependencies using the helper script:
./build_ubuntu.sh
Install snarkOS:
cargo install --locked --path .
Ensure ports 4130/tcp and 3030/tcp are open on your router and OS firewall.
3. Run an Aleo Node:
Run an Aleo Client:
Follow the build guide instructions.
Start a client node:
./run-client.sh
Run an Aleo Prover:
Follow the build guide instructions.
Generate an Aleo account address:
snarkos account new
Save the outputted private key, view key, and address.
Start a proving node:
./run-prover.sh
When prompted, enter your Aleo private key:
Enter the Aleo Prover account private key: APrivateKey1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
4. Command Line Interface. To run a node with custom settings, refer to the options and flags available in the snarkOS CLI. View the full list with:
snarkos --help
Common Commands:
Manage Aleo accounts:
snarkos account
Clean the snarkOS node storage:
snarkos clean
Start the snarkOS node:
snarkos start
Update snarkOS:
snarkos update
Options for snarkos start
Specify the network ID:
snarkos start --network <NETWORK_ID>
Run as validator:
snarkos start --validator
Run as prover:
snarkos start --prover
Run as client:
snarkos start --client
Specify private key:
snarkos start --private-key <PRIVATE_KEY>
Specify node server IP and port:
snarkos start --node <IP:PORT>
Connect to a peer:
snarkos start --connect <IP:PORT>
Specify REST server IP and port:
snarkos start --rest <REST>
Disable REST server:
snarkos start --norest
Set verbosity level:
snarkos start --verbosity <VERBOSITY_LEVEL>
Specify log file path:
snarkos start --logfile <PATH>
Enable development mode:
snarkos start --dev <NODE_ID>
5. Development guide.
Quick start:
Start validators in separate terminals:
cargo run --release -- start --nodisplay --dev 0 --validator
cargo run --release -- start --nodisplay --dev 1 --validator
cargo run --release -- start --nodisplay --dev 2 --validator
cargo run --release -- start --nodisplay --dev 3 --validator
Operations. Initialize nodes starting from 0, incrementing by 1 for each new node:
cargo run --release -- start --nodisplay --dev <NODE_ID> --validator
cargo run --release -- start --nodisplay --dev <NODE_ID> --prover
cargo run --release -- start --nodisplay --dev <NODE_ID> --client
cargo run --release -- start --nodisplay --dev <NODE_ID>
Local Devnet:
Install tmux. Install tmux for managing multiple node sessions. Instructions are available for macOS, Ubuntu, and Windows.
Start a Local Devnet. Run the local devnet script:
./devnet.sh
Follow the terminal instructions to start the devnet.
View a Local Devnet:
Switch to the next node:
Ctrl+b n
Switch to the previous node:
Ctrl+b p
Select a node (choose-tree):
Ctrl+b w
Select a node manually:
Ctrl+b :select-window -t {NODE_ID}
Stop a Local Devnet. Stop the devnet:
Ctrl+b :kill-session
Press Enter to confirm.
Clean up. Clean node storage:
cargo run --release -- clean --dev <NODE_ID>
More info you can find here:
Conclusion. snarkOS is a robust, decentralized OS tailored for zk apps on the Aleo network. Its architecture ensures privacy, security, and scalability, making it an excellent choice for developers building next-generation privacy-preserving apps. With extensive documentation and a supportive community, getting started with snarkOS is straightforward, allowing developers to fully leverage zk cryptography in their projects.
To know more about Aleo, join now!
Aleo Twitter
Aleo Discord
Aleo Website
List of Aleo and Leo code and resourses
Prepared by Colliseum