snarkOS - snarkOS是一个用于私有应用程序的去中心化操作系统。它构成了Aleo的主干,使应用程序能够以可公开验证的方式验证和存储状态。

Created at: 2020-02-17 05:46:21
Language: Rust
License: GPL-3.0

snarkOS

目录

1. 概述

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

2. 构建指南

2.1 要求

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

  • CPU:16 核(首选 32 核)
  • 内存:16GB 内存(首选 32GB)
  • 存储空间:128GB 磁盘空间
  • 网络:10 Mbps 的上传下载带宽

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

2.2 安装

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

Rust v1.65+

首先克隆这个 Github 存储库:

git clone https://github.com/AleoHQ/snarkOS.git --depth 1

接下来,进入目录:

snarkOS

cd snarkOS

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

snarkOS

./build_ubuntu.sh

最后,安装:

snarkOS

cargo install --path .

3. 运行一个 Aleo 节点

3一.运行 Aleo 客户端

首先按照构建指南中的说明进行操作。

接下来,要从目录中启动客户机节点,请运行:

snarkOS

./run-client.sh

3b.运行 Aleo Prover

首先按照构建指南中的说明进行操作。

接下来,生成一个 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.65+
  • 如果在编译过程中出现大错误,请尝试运行 。
    cargo clean
  • 确保使用 或 开始。
    snarkOS
    ./run-client.sh
    ./run-prover.sh

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

  • 确保路由器和操作系统防火墙上的端口和端口处于打开状态。
    4133/tcp
    3033/tcp
  • 确保使用 或 开始。
    snarkOS
    ./run-client.sh
    ./run-prover.sh

3. 我无法生成新地址

  • 在运行上述命令()之前,请尝试
    snarkos account new
    source ~/.bashrc
  • 还要仔细检查 的拼写。注意目录是 ,命令是
    snarkos
    /snarkOS
    snarkos

5. 命令行界面

要使用自定义设置运行节点,请参阅 CLI 中可用的选项和标志的完整列表。

snarkOS

CLI 标志和选项的完整列表可以通过以下方式查看:

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

以下是该命令的选项:

snarkos start

snarkos-start 
Starts the snarkOS node

USAGE:
    snarkos start [OPTIONS]

OPTIONS:
        --beacon <BEACON>          Specify this as a beacon, with the given account private key for this node
        --client <CLIENT>          Specify this as a client, with an optional account private key for this node
        --connect <CONNECT>        Specify the IP address and port of a peer to connect to [default: ]
        --dev <DEV>                Enables development mode, specify a unique ID for this node
    -h, --help                     Print help information
        --logfile <LOGFILE>        Specify the path to the file where logs will be stored [default: /tmp/snarkos.log]
        --network <NETWORK>        Specify the network of this node [default: 3]
        --node <NODE>              Specify the IP address and port for the node server [default: 0.0.0.0:4133]
        --nodisplay                If the flag is set, the node will not render the display
        --norest                   If the flag is set, the node will not initialize the REST server
        --prover <PROVER>          Specify this as a prover, with the given account private key for this node
        --rest <REST>              Specify the IP address and port for the REST server [default: 0.0.0.0:3033]
        --validator <VALIDATOR>    Specify this as a validator, with the given account private key for this node
        --verbosity <VERBOSITY>    Specify the verbosity of the node [options: 0, 1, 2, 3] [default: 2]

6. 发展

6.1 快速入门

在一个终端中, 通过运行以下命令启动信标:

cargo run --release -- start --nodisplay --dev 0 --beacon ""

在第二个终端中,运行:

cargo run --release -- start --nodisplay --dev 1 --prover ""

可以重复此过程以启动更多节点。

6.2 操作

对于每个新节点,初始化从 开始并递增的节点非常重要。

0
1

以下是初始化节点的选项列表(替换为以 开头的数字):

XX
0

cargo run --release -- start --nodisplay --dev XX --beacon ""
cargo run --release -- start --nodisplay --dev XX --validator ""
cargo run --release -- start --nodisplay --dev XX --prover ""
cargo run --release -- start --nodisplay --dev XX --client ""
cargo run --release -- start --nodisplay --dev XX

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

--client

收拾

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

cargo run --release -- clean --dev XX

7. 许可

我们欢迎所有对 的贡献。有关贡献条款,请参阅许可证

snarkOS

许可证: GPL v3