MCPcopy Index your code
hub / github.com/ProvableHQ/snarkOS

github.com/ProvableHQ/snarkOS @testnet-v4.8.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release testnet-v4.8.2 ↗ · + Follow
2,234 symbols 7,718 edges 197 files 1,223 documented · 55%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README
<img alt="snarkOS" width="1412" src="https://github.com/ProvableHQ/snarkOS/raw/testnet-v4.8.2/resources/snarkOS-banner.png">







<a href="https://circleci.com/gh/ProvableHQ/snarkOS"><img src="https://circleci.com/gh/ProvableHQ/snarkOS.svg?style=svg"></a>
<a href="https://codecov.io/gh/ProvableHQ/snarkOS"><img src="https://codecov.io/gh/ProvableHQ/snarkOS/branch/master/graph/badge.svg?token=cck8tS9HpO"/></a>
<a href="https://discord.gg/aleo"><img src="https://img.shields.io/discord/700454073459015690?logo=discord"/></a>
<a href="https://twitter.com/AleoHQ"><img src="https://img.shields.io/twitter/follow/AleoHQ?style=social"/></a>
<a href="https://GitHub.com/ProvableHQ/snarkOS"><img src="https://img.shields.io/badge/contributors-59-ee8449"/></a>

Table of Contents

1. Overview

snarkOS is a decentralized operating system for zero-knowledge applications. This code forms the backbone of Aleo network, which verifies transactions and stores the encrypted state applications in a publicly-verifiable manner.

2. Build Guide

2.1 Definitions

The following snarkOS node types exist in the Aleo network: - Validator: Validator nodes participate in consensus and must be started with an account that is bonded into the committee. - Client: Clients do not participate in consensus but maintain a ledger. They are capable of providing information about the network as well as accepting solutions and transactions and communicating them to their peers. All clients run the same software, however, for the purposes of configuration management, this document defines two types of clients: - Core Client: Client node connected directly to a validator node. - Outer Client: Client node connected only to other clients or prover nodes. - Prover: Prover nodes are dedicated to solving the Aleo puzzle. They do not participate in consensus or maintain a copy of the ledger.

2.2 Requirements

The following are the requirements to run an Aleo node: - OS: 64-bit architectures only, latest up-to-date for security - Clients: Ubuntu 22.04 (LTS), macOS Ventura or later, Windows 11 or later - Validators: Ubuntu 22.04 (LTS) - CPU: 64-bit architectures only, Latest Intel Xeon or Better - Clients: 24-cores (32-cores or larger preferred) - Validators: 64-cores (128-cores or larger preferred) - RAM: DDR4 or better - Clients: 128GiB of memory (192GiB or larger preferred) - Validators: 256GiB of memory (384GiB or larger preferred) - Storage: PCIe Gen 3 x4, PCIe Gen 4 x2 NVME SSD, or better - Clients: 2TB of disk space (4TB or larger preferred) - Validators: 4TB of disk space (6TB or larger preferred) - Network: Symmetric, commercial, always-on - Clients: 250Mbps of upload and download bandwidth - Validators: 500Mbps of upload and download bandwidth

No explicit recommendations are made for proving nodes as proving hardware may be highly variable. If interested in running Aleo Provers nodes, please refer to resources published by the Aleo community.

2.3 Installation

Before beginning, please ensure your machine has Rust installed, with at least this version. Instructions to install Rust can be found here.

Start by cloning this GitHub repository:

git clone --branch mainnet --single-branch https://github.com/ProvableHQ/snarkOS.git

Next, move into the snarkOS directory:

cd snarkOS

[For Ubuntu users] A helper script to install dependencies is available. From the snarkOS directory, run:

./build_ubuntu.sh

Lastly, install snarkOS:

cargo install --locked --path .

Optional: CUDA Acceleration for Provers

This CUDA build is optional. The current snarkOS puzzle does not leverage CUDA acceleration—it is a leftover from a previous event, although CUDA may become relevant again with ARC-43.

The CUDA feature is considered unstable and experimental; expect breaking changes.

For prover operators who want to experiment with GPU support:

cargo install --locked --path . --features cuda

Please ensure ports 4130/tcp and 3030/tcp are open on your router and OS firewall.

2.4 Port Configuration

2.4.1 For Core Clients

Port Protocol Allow/Deny Source Explanation
4130/tcp TCP Allow All IPv4/IPv6 TCP traffic to peers

2.4.2 For Outer Clients

Port Protocol Allow/Deny Source Explanation
3030/tcp TCP Allow All IPv4/IPv6 REST server
4130/tcp TCP Allow All IPv4/IPv6 TCP traffic to peers

2.4.3 For Validators

Port Protocol Allow/Deny Source Explanation
4130/tcp TCP Allow All IPv4/IPv6 TCP traffic to peers
5000/tcp TCP Allow Trusted Validator IPs TCP traffic between validators for BFT communication
3000/tcp TCP Allow Internal VPC or VPN Metrics dashboard, should only be open within an internal VPC or VPN
3030/tcp TCP Deny All IPv4/IPv6 REST server. This should always be disabled for validators
9000/tcp TCP Allow Internal VPC or VPN Metrics export, should only be open within an internal VPC or VPN
9090/tcp TCP Allow Internal VPC or VPN Prometheus metrics, should only be open within an internal VPC or VPN

Note: Ensure that your open file limit is set to 16,384 or above. For the recommended setting run:

# Increase the open file limit for the current user (replace <username> with your username)
echo "<username> - nofile 65536" | sudo tee -a /etc/security/limits.conf
# Increase the default system open file limit
sudo bash -c 'echo "DefaultLimitNOFILE=65536" >> /etc/systemd/system.conf'

3. Run an Aleo Node

3.1 Run an Aleo Client

Start by following the instructions in the Build Guide. The guide below provides information on running core and outer clients (as defined in Section 2.2.) Aleo community members running validators are recommended to run 1-3 core clients as their exclusive client peers. This will ensure network traffic from the public internet is verified prior to reaching the validator.

Any client not connected directly to a validator can be considered an outer client.

3.1.1 Run an Aleo Core Client

The following command is recommended when starting a client node that is connected to a validator: snarkos start --client --nodisplay --node 0.0.0.0:4130 --peers "validator_ip:4130,core_client_ip_1:4130,core_client_ip_2:4130,core_client_ip3:4130,outer_client_ip_1:4130,..." --verbosity 1 --norest

To start a core client node, you can also run the following command from the snarkOS directory:

./scripts/run-core-client.sh

3.1.2 Run an Aleo Outer Client

The following command is recommended when starting a client node that is NOT connected to a validator: snarkos start --client --nodisplay --node 0.0.0.0:4130 --peers "core_client_ip_1:4130,core_client_ip_2:4130,core_client_ip3:4130,outer_client_ip_1:4130,..." --verbosity 1 --rest 0.0.0.0:3030

To start an outer client node, you can also run the following command from the snarkOS directory:

./scripts/run-outer-client.sh

Outer clients can be bootstrap clients that serve as accessible entry points for new nodes joining the network with publicly known or static IPs. For bootstrap clients, we also recommend the use of --rotate-external-peers to avoid the bootstrap peerlist from filling up.

3.2 Run an Aleo Validator

Start by following the instructions in the Build Guide.

The following command is recommended when starting a validator node: snarkos start --validator --nodisplay --bft 0.0.0.0:5000 --node 0.0.0.0:4130 --peers "validator_ip_1:4130,validator_ip_2:4130,...,core_client_ip_1:4130,core_client_ip_2:4130,..." --validators "validator_ip_1:5000,validator_ip_2:5000,..." --verbosity 1 --norest --private-key-file ~/snarkOS/privatekey

Instead of specifying a private key file (--private-key-file flag), the private key can also be defined explicitly (--private-key flag).

To start a validator, you can also run the following command from the snarkOS directory:

./scripts/run-validator.sh

3.2.1 Validator Telemetry Metrics

Validator telemetry allows you to track participation in consensus. This is enabled by default in the standard build.

Once enabled, telemetry metrics are available through:

  1. Node logs
  2. REST API endpoints // GET /{network}/validators/participation // GET /{network}/validators/participation?metadata={true}

Telemetry is enabled by default, and you can still explicitly specify the telemetry feature flag:

1. Installation

Use the default installation command:

cargo install --locked --path .

2. ./run-validator.sh

Telemetry is included by default when running ./scripts/run-validator.sh.

3.3 Run an Aleo Prover

Start by following the instructions in the Build Guide.

Next, generate an Aleo account address:

snarkos account new

This will output a new Aleo account in the terminal.

Please remember to save the account private key and view key. The following is an example output:

 Attention - Remember to store this account private key and view key.

  Private Key  APrivateKey1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  <-- Save Me And Use In The Next Step
     View Key  AViewKey1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  <-- Save Me
      Address  aleo1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  <-- Save Me

Next, to start a proving node, from the snarkOS directory, run:

./scripts/run-prover.sh

When prompted, enter your Aleo private key:

Enter the Aleo Prover account private key:
APrivateKey1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

4. FAQs

1. My node is unable to compile.

  • Ensure your machine has Rust installed, with at least this version. Instructions to install Rust can be found here.
  • If large errors appear during compilation, try running cargo clean.
  • Ensure snarkOS is started using ./scripts/run-client.sh or ./scripts/run-prover.sh.

2. My node is unable to connect to peers on the network.

  • Ensure ports 4130/tcp and 3030/tcp are open on your router and OS firewall.
  • Ensure snarkOS is started using ./scripts/run-client.sh or ./scripts/run-prover.sh.

3. I can't generate a new address ###

  • Before running the command above (snarkos account new) try source ~/.bashrc
  • Also double-check the spelling of snarkos. Note the directory is /snarkOS, and the command is snarkos

4. How do I use the CLI to sign and verify a message?

  1. Generate an account with snarkos account new if you haven't already
  2. Sign a message with your private key using snarkos account sign --raw -m "Message" --private-key-file=<PRIVATE_KEY_FILE>
  3. Verify your signature with snarkos account verify --raw -m "Message" -s sign1SignatureHere -a aleo1YourAccountAddress

Note, using the --raw flag with the command will sign plaintext messages as bytes rather than Aleo values such as 1u8 or 100field.

5. What is the different between node-data and ledger?

Ledger contains only public ledger information, while node-data contains information specific to the node that created it. The latter should not be shared with untrusted sources, and, for validators, contains data required to participate in consensus.

6. At startup I get an error telling me the nodes still uses the old storage format. What should I do?

The node should have created a new folder for the node data. For example, for mainnet a folder should exist at ~/.aleo/storage/node-data-0.

The error message will tell you what data to migrate. Alternatively, you can start the node with --auto-migrate-node-data and it will attempt to do this automatically.

The following is an overview of all files that may be needed to be migrated. - The JSON Web token sec

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 1,434
Function 558
Class 181
Interface 31
Enum 30

Languages

Rust100%

Modules by API surface

node/bft/src/primary.rs87 symbols
node/rest/src/routes.rs80 symbols
node/sync/src/block_sync.rs74 symbols
node/bft/src/gateway.rs70 symbols
node/bft/src/helpers/storage.rs67 symbols
node/network/src/peering.rs52 symbols
node/bft/src/bft.rs47 symbols
node/bft/src/worker.rs44 symbols
node/tcp/src/tcp.rs42 symbols
node/bft/ledger-service/src/ledger.rs39 symbols
node/router/src/helpers/cache.rs37 symbols
node/bft/src/sync/mod.rs36 symbols

Datastores touched

aleoDatabase · 1 repos

For agents

$ claude mcp add snarkOS \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page