Crates.io | snarkos |
lib.rs | snarkos |
version | 3.0.0 |
source | src |
created_at | 2020-01-24 18:46:08.430992 |
updated_at | 2024-09-18 13:32:10.589953 |
description | A decentralized operating system |
homepage | https://aleo.org |
repository | https://github.com/AleoNet/snarkOS |
max_upload_size | |
id | 201599 |
size | 240,667 |
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.
The following are minimum requirements to run an Aleo node:
Please note that in order to run an Aleo Prover that is competitive, the machine will need more than these requirements.
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.
Start by following the instructions in the Build Guide.
Next, to start a client node, from the snarkOS
directory, run:
./run-client.sh
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
Rust v1.66+
installed. Instructions to install Rust can be found here.cargo clean
.snarkOS
is started using ./run-client.sh
or ./run-prover.sh
.4130/tcp
and 3030/tcp
are open on your router and OS firewall.snarkOS
is started using ./run-client.sh
or ./run-prover.sh
.snarkos account new
) try source ~/.bashrc
snarkos
. Note the directory is /snarkOS
, and the command is snarkos
snarkos account new
if you haven't alreadysnarkos account sign --raw -m "Message" --private-key-file=<PRIVATE_KEY_FILE>
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
.
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
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.
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
.
tmux
To run a local devnet with the script, start by installing tmux
.
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
On Ubuntu and other Debian-based systems, you can use the apt
package manager:
sudo apt update
sudo apt install tmux
There are a couple of ways to use tmux
on Windows:
tmux
as you would on a native Linux system:sudo apt update
sudo apt install tmux
To start a local devnet, run:
./devnet.sh
Follow the instructions in the terminal to start the devnet.
To toggle to the next node in a local devnet, run:
Ctrl+b n
To toggle to the previous node in a local devnet, run:
Ctrl+b p
To select a node in a local devnet, run:
Ctrl+b w
To select a node manually in a local devnet, run:
Ctrl+b :select-window -t {NODE_ID}
To stop a local devnet, run:
Ctrl+b :kill-session
Then, press Enter
.
To clean up the node storage, run:
cargo run --release -- clean --dev <NODE_ID>
Thank you for helping make snarkOS better!
π§ What do the emojis mean?
This project follows the all-contributors specification. Contributions of any kind are welcome!
We welcome all contributions to snarkOS
. Please refer to the license for the terms of contributions.