Aleo之家
中文资讯网

snarkOS 操作系统

1. 概述

snarkOS 是一个用于零知识应用程序的去中心化操作系统。 此代码构成了 Aleo 网络的支柱, 它验证交易并以可公开验证的方式存储加密状态应用程序。

2. 构建指南

2.1 要求

以下是运行 Aleo 节点的最低要求:

  • 操作系统: 仅限 64 位架构,最新的安全性
    • 客户端:Ubuntu 22.04 (LTS)、macOS Sonoma 或更高版本、Windows 11 或更高版本
    • 证明者: Ubuntu 22.04 (LTS)、macOS Sonoma 或更高版本
    • 验证器:Ubuntu 22.04 (LTS)
  • CPU:仅限 64 位架构
    • 客户端:32 核
    • Provers:32 核(首选 64 核)
    • 验证器:32 核(首选 64 核)
  • 内存:DDR4 或更高
    • 客户端:32GB 内存
    • 证明者:32GB 内存(首选 64GB 或更大)
    • 验证器:64GB 内存(最好是 128GB 或更大)
  • 存储:PCIe Gen 3 x4、PCIe Gen 4 x2 NVME SSD 或更高
    • 客户端:300GB 磁盘空间
    • Provers:32GB 磁盘空间
    • 验证器:2TB 磁盘空间(最好是 4TB 或更大)
  • 网络:对称、商用、永远在线
    • 客户端:100Mbps 的上传下载带宽
    • 证明者:500Mbps 的上传下载带宽
    • 验证者:1000Mbps 的上传下载带宽
  • 图形处理器
    • 客户端:目前不需要
    • 证明者:支持 CUDA 的 GPU(可选)
    • 验证人:目前不需要

请注意,为了运行具有竞争力的 Aleo Prover,机器需要的不仅仅是这些要求。

2.2 装置

在开始之前,请确保您的机器已安装。安装 Rust 的说明可以在这里找到。Rust v1.79+

首先克隆此 GitHub 存储库:

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

接下来,移动到目录中:snarkOS

cd snarkOS
git checkout tags/testnet-beta

[对于 Ubuntu 用户]提供了用于安装依赖项的帮助程序脚本。从目录中,运行:snarkOS

./build_ubuntu.sh

最后,安装 :snarkOS

cargo install --locked --path .

请确保路由器和操作系统防火墙上的端口和端口处于打开状态。4130/tcp3030/tcp

3. 运行 Aleo 节点

3.1 运行 Aleo 客户端

首先按照 Build Guide 中的说明进行操作。

接下来,要从该目录启动客户端节点,请运行:snarkOS

./run-client.sh

3.2 运行 Aleo Prover

首先按照 Build Guide 中的说明进行操作。

接下来,生成一个 Aleo 账户地址:

snarkos account new

这将在终端中输出一个新的 Aleo 帐户。

请记得保存账户私钥和查看密钥。下面是一个示例输出:

 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

接下来,要从该目录启动验证节点,请运行:snarkOS

./run-prover.sh

出现提示时,输入您的 Aleo 私钥:

Enter the Aleo Prover account private key:
APrivateKey1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

4. 常见问题

1. 我的节点无法编译。

  • 确保您的计算机已安装。安装 Rust 的说明可以在这里找到。Rust v1.66+
  • 如果在编译过程中出现较大错误,请尝试运行 。cargo clean
  • Ensure 已使用 或 启动。snarkOS./run-client.sh./run-prover.sh

2. 我的节点无法连接到网络上的对等节点。

  • 确保路由器和操作系统防火墙上的端口和打开。4130/tcp3030/tcp
  • Ensure is started using or .snarkOS./run-client.sh./run-prover.sh

3. I can’t generate a new address

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

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

  1. Generate an account with if you haven’t alreadysnarkos account new
  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 flag with the command will sign plaintext messages as bytes rather than Aleo values such as or .--raw1u8100field

5. Command Line Interface

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

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 command:snarkos start

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 快速启动

在第一个终端中,通过运行以下命令来启动第一个验证者:

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

在第二个终端中,通过运行以下命令来启动第二个验证器

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

在第三个终端中,通过运行以下命令来启动第三个验证者:

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

在第四个终端中,通过运行以下命令启动第四个 validator:

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

从这里开始,此过程可用于进一步启动验证者和客户。

6.2 运营

请务必从每个新节点开始初始化节点,并为每个新节点初始化节点。01

以下是初始化节点的选项列表(替换为以 开头的数字):<NODE_ID>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>

如果未指定节点类型,则节点将默认为 。--client

6.3 本地开发网

6.3.1 安装tmux

要使用脚本运行本地开发网络,请先安装 .tmux

macOS 的

要在 macOS 上安装,您可以使用包管理器。 如果您还没有安装,您可以在他们的网站上找到说明。tmuxHomebrewHomebrew

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

在 Ubuntu 和其他基于 Debian 的系统上,您可以使用包管理器:apt

sudo apt update
sudo apt install tmux
窗户

有几种方法可以在 Windows 上使用:tmux

使用适用于 Linux 的 Windows 子系统 (WSL)

  1. 首先,安装适用于 Linux 的 Windows 子系统
  2. 设置 WSL 并安装 Linux 发行版(例如 Ubuntu)后,打开 WSL 终端并像在本机 Linux 系统上一样进行安装:tmux
sudo apt update
sudo apt install tmux

6.3.2 启动本地开发网

要启动本地开发网,请运行:

./devnet.sh

按照终端中的说明启动 devnet。

6.3.3 查看本地开发网

Switch 节点 (forward)

要切换到本地开发网中的下一个节点,请运行:

Ctrl+b n

切换节点(向后)

要切换到本地开发网中的上一个节点,请运行:

Ctrl+b p

选择节点 (choose-tree)

要在本地开发网中选择节点,请运行:

Ctrl+b w

选择节点(手动)

要在本地开发网络中手动选择节点,请运行:

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

6.3.4 停止本地开发网

要停止本地开发网,请运行:

Ctrl+b :kill-session

然后,按 。Enter

收拾

要清理节点存储,请运行:

cargo run --release -- clean --dev <NODE_ID>
赞(0)
未经允许不得转载:Aleo之家 » snarkOS 操作系统