Project Icon

snarkOS

为零知识应用提供基础设施的区块链系统

snarkOS作为Aleo网络的核心组件,为零知识应用提供区块链基础设施。该系统可验证交易并安全存储加密应用状态,支持运行多种类型的网络节点。基于Rust开发的snarkOS具有高性能和安全性,为零知识应用的开发和部署提供了可靠的底层支持。

snarkOS

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 Requirements

The following are minimum requirements to run an Aleo node:

  • OS: 64-bit architectures only, latest up-to-date for security
    • Clients: Ubuntu 22.04 (LTS), macOS Sonoma or later, Windows 11 or later
    • Provers: Ubuntu 22.04 (LTS), macOS Sonoma or later
    • Validators: Ubuntu 22.04 (LTS)
  • CPU: 64-bit architectures only
    • Clients: 32-cores
    • Provers: 32-cores (64-cores preferred)
    • Validators: 32-cores (64-cores preferred)
  • RAM: DDR4 or better
    • Clients: 32GB 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: 300GB of disk space
    • Provers: 32GB 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: 500Mbps of upload and download bandwidth
    • Validators: 1000Mbps of upload and download bandwidth
  • GPU:
    • Clients: Not required at this time
    • Provers: CUDA-enabled GPU (optional)
    • Validators: Not required at this time

Please note that in order to run an Aleo Prover that is competitive, the machine will need more than these requirements.

2.2 Installation

Before beginning, please ensure your machine has Rust v1.79+ installed. Instructions to install Rust can be found here.

Start by cloning this GitHub repository:

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

Next, move into the snarkOS directory:

cd snarkOS
git checkout tags/testnet-beta

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

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

3. Run an Aleo Node

3.1 Run an Aleo Client

Start by following the instructions in the Build Guide.

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

./run-client.sh

3.2 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:

./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 v1.66+ installed. Instructions to install Rust can be found here.
  • If large errors appear during compilation, try running cargo clean.
  • Ensure snarkOS is started using ./run-client.sh or ./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 ./run-client.sh or ./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. Command Line Interface

To run a node with custom settings, refer to the options and flags available in the snarkOS CLI.

The full list of CLI flags and options can be viewed with snarkos --help:

snarkOS 
The Aleo Team <hello@aleo.org>

USAGE:
    snarkos [OPTIONS] <SUBCOMMAND>

OPTIONS:
    -h, --help                     Print help information
    -v, --verbosity <VERBOSITY>    Specify the verbosity [options: 0, 1, 2, 3] [default: 2]

SUBCOMMANDS:
    account    Commands to manage Aleo accounts
    clean      Cleans the snarkOS node storage
    help       Print this message or the help of the given subcommand(s)
    start      Starts the snarkOS node
    update     Update snarkOS

The following are the options for the snarkos start command:

USAGE:
    snarkos start [OPTIONS]

OPTIONS:
        --network <NETWORK_ID>                  Specify the network ID of this node [default: 3]
        
        --validator                             Specify this node as a validator
        --prover                                Specify this node as a prover
        --client                                Specify this node as a client
        
        --private-key <PRIVATE_KEY>             Specify the node's account private key
        --private-key-file <PRIVATE_KEY_FILE>   Specify the path to a file containing the node's account private key
        
        --node <IP:PORT>                        Specify the IP address and port for the node server [default: 0.0.0.0:4130]
        --connect <IP:PORT>                     Specify the IP address and port of a peer to connect to
 
        --rest <REST>                           Specify the IP address and port for the REST server [default: 0.0.0.0:3030]
        --norest                                If the flag is set, the node will not initialize the REST server
        
        --nodisplay                             If the flag is set, the node will not render the display
        --verbosity <VERBOSITY_LEVEL>           Specify the verbosity of the node [options: 0, 1, 2, 3] [default: 2]
        --logfile <PATH>                        Specify the path to the file where logs will be stored [default: /tmp/snarkos.log]
        
        --dev <NODE_ID>                         Enables development mode, specify a unique ID for this node

6. Development Guide

6.1 Quick Start

In the first terminal, start the first validator by running:

cargo run --release -- start --nodisplay --dev 0 --validator

In the second terminal, start the second validator by running:

cargo run --release -- start --nodisplay --dev 1 --validator

In the third terminal, start the third validator by running:

cargo run --release -- start --nodisplay --dev 2 --validator

In the fourth terminal, start the fourth validator by running:

cargo run --release -- start --nodisplay --dev 3 --validator

From here, this procedure can be used to further start-up provers and clients.

6.2 Operations

It is important to initialize the nodes starting from 0 and incrementing by 1 for each new node.

The following is a list of options to initialize a node (replace <NODE_ID> with a number starting from 0):

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>

When no node type is specified, the node will default to --client.

6.3 Local Devnet

6.3.1 Install tmux

To run a local devnet with the script, start by installing tmux.

macOS

To install tmux on macOS, you can use the Homebrew package manager. If you haven't installed Homebrew yet, you can find instructions at their website.

# Once Homebrew is installed, run:
brew install tmux
Ubuntu

On Ubuntu and other Debian-based systems, you can use the apt package manager:

sudo apt update
sudo apt install tmux
Windows

There are a couple of ways to use tmux on Windows:

Using Windows Subsystem for Linux (WSL)

  1. First, install Windows Subsystem for Linux.
  2. Once WSL is set up and you have a Linux distribution installed (e.g., Ubuntu), open your WSL terminal and install tmux as you would on a native Linux system:
sudo apt update
sudo apt install tmux

6.3.2 Start a Local Devnet

To start a local devnet, run:

./devnet.sh

Follow the instructions in the terminal to start the devnet.

6.3.3 View a Local Devnet

Switch Nodes (forward)

To toggle to the next node in a local devnet, run:

Ctrl+b n

Switch Nodes (backwards)

To toggle to the previous node in a local devnet, run:

Ctrl+b p

Select a Node (choose-tree)

To select a node in a local devnet, run:

Ctrl+b w

Select a Node (manually)

To select a node manually in a local devnet, run:

Ctrl+b :select-window -t {NODE_ID}

6.3.4 Stop a Local Devnet

To stop a local devnet, run:

Ctrl+b :kill-session

Then, press Enter.

Clean Up

To clean up the node storage, run:

cargo run --release -- clean --dev <NODE_ID>

7. Contributors

Thank you for helping make snarkOS better!
🧐 What do the emojis mean?

项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

AIWritePaper论文写作

AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号