snarkOPs
Snops Quickstart | snarkos-aot Quickstart
This repository is home to the snops
(snarkOS operations) ecosystem, and
snarkos-aot
, a crate for performing ahead-of-time ledger actions, transaction
authorizations, and various tools for helping with developing Aleo programs.
snops is a suite of tools that can be used to maintain Aleo network environments. The environments are defined in a manner similar to infrastructure-as-code, which means you can create repeatable infrastructure using the environment schema.
This can be used to create devnets, simulate events on the network like outages and attacks, and guarantee metrics.
To learn more about snops
we recommend checking out the mdbook here.
Snops Quickstart
Easy Setup
snops
contains several components that can be compiled separately. The release-big
build profile allows for faster near-release profile performance with faster near-debug profile build times.
-
Install rust
-
Clone the repo
-
Start + build the control plane:
./scripts/control_plane.sh
The controlplane is the webserver that communicates to agents how to run snarkOS, or what transactions to execute.
-
In another terminal, install the cli:
cargo install --path ./crates/snops-cli
, or build withcargo xtask build cli
and use fromtarget/release-big/snops-cli
.The cli is used to interact with the controlplane and manage environments. It provides JSON based output. We recommend pairing our cli with
jq
when leveraging other scripts and tools -
Build the agent:
cargo xtask build agent
The agent is a lightweight service that starts up
snarkos-aot
which automatically configures snarkos nodes, or executes transactions. -
Build
snarkos-aot
(for running nodes):cargo xtask build aot
snarkos-aot
is an alternative snarkOS CLI providing more developer-oriented features as well as tooling for distributed transaction generation and execution. -
In separate terminals, start up some agents with the following commands:
./script/agent.sh 0 ./script/agent.sh 1 ./script/agent.sh 2 ./script/agent.sh 3
Each of these can be dynamically configured as snarkos nodes. The default agent configuration should connect to a locally operated controlplane.
Local Isolated Networks (Isonets)
This example requires 4 agents and the control plane to be running. It allows you to run a devnet with a custom genesis block.
- Start the environment:
snops-cli env apply specs/test-4-validators.yaml
- Check the current network height:
snops-cli env height
- Look at the latest block:
snops-cli env block
- Look at the genesis block:
snops-cli env block 0
- Stop the environment:
snops-cli env delete
Isonet Transfers
Using the setup for a Local Isonet, executing Aleo programs has never been more convenient. Snops aliases locally generated keys automatically from configuration and reduces the need to keep track of individual key files.
-
Start an environment (see previous example)
-
Start a compute agent:
./scripts/agent_compute.sh 0
Compute agents are able to distribute the execution of transactions, offloading the compute task to different servers.
-
Check the balance of committee member 1's key:
$ snops-cli env balance committee.1 10000000000000
-
Transfer 1 credit to committee member 1 from committee member 0 (look on snarkos this command would require MANY more flags):
snops-cli env action execute transfer_public committee.1 1_000_000u64
-
Check the balance of committee member 1's key (it may take a few seconds for the block to advance):
snops-cli env balance committee.1 10000001000000
Isonet Program Deployments
Deploying and executing Aleo programs on your isonets is easiest with snops. You do not need any extra json files or tooling, only a standalone .aleo
file.
-
Use the same setup as before
-
Create a file
mapping_example.aleo
with the following contents:program mapping_example.aleo; mapping mymapping: key as u8.public; value as u8.public; function store: input r0 as u8.public; input r1 as u8.public; async store r0 r1 into r2; output r2 as mapping_example.aleo/store.future; finalize store: input r0 as u8.public; input r1 as u8.public; set r1 into mymapping[r0];
-
Deploy the program:
snops-cli env action deploy ./mapping_example.aleo
-
Verify the program is on the chain:
snops-cli env program mapping_example.aleo
-
Check an example mapping
$ snops-cli env mapping mapping_example.aleo mymapping 0u8 { "value": null }
-
Execute the
store
function on-chain:snops-cli env action execute mapping_example.aleo/store 0u8 5u8
-
Check the example mapping for its updated value
$ snops-cli env mapping mapping_example.aleo mymapping 0u8 { "value": "5u8" }
SnarkOS-aot Quickstart
snarkos-aot
provides various CLI tools to help with developing and executing
Aleo programs as well as interact with snarkOS ledgers.
Build snarkos-aot
with: cargo xtask build aot
.
The compiled binary can be found in target/release-big/snarkos-aot
.
Use the NETWORK
environment variable to specify mainnet
(default),
testnet
, or canary
.
Transaction Authorizations
Typically when executing snarkOS transactions you specify the program and inputs and receive a proof. Behind the scenes, snarkVM is using a private key to "authorize" the proof for the program execution, and "authorize" the proof for the fee.
Creating authorizations is much quicker than executing the transaction, and the process can be done airgapped or even on web clients.
# Create an authorization for a executing transfer_public to the "example.aleo" program for 1 microcredit
NETWORK=testnet snarkos-aot auth program --private-key <PK> credits.aleo/transfer_public example.aleo 1u64 > auth.json
# The same as above but with a different private key
NETWORK=testnet snarkos-aot auth program --private-key <PK> --fee-private-key <PK> credits.aleo/transfer_public example.aleo 1u64 > auth.json
# Create an authorization for deploying a program (from my_program.aleo)
NETWORK=testnet snarkos-aot auth deploy --private-key <PK> my_program.aleo
# Determine the cost to deploy a program (from stdin)
cat my_program.aleo | NETWORK=testnet snarkos-aot auth deploy --private-key <PK> - | NETWORK=testnet snarkos-aot auth cost -
# Execute an authorization from auth.json without broadcasting it (the - means stdin)
cat auth.json | NETWORK=testnet snarkos-aot auth execute - --query https://api.explorer.aleo.org/v1
# Get the cost of an authorization (program or deployment) without executing the transaction
cat auth.json | NETWORK=testnet snarkos-aot auth cost -
# Derive the transaction id from an authorization without executing it
cat auth.json | NETWORK=testnet snarkos-aot auth id -
Program Helpers
snarkos-aot
contains various tools to programmatically interact with aleo program.
If you don't have any Aleo programs you can download a program (credits.aleo
)
from Aleo Explorer with the following commands. You can find a list of
programs on Aleo Explorer's Programs List.
NETWORK=testnet
PROGRAM=credits.aleo
# Download a program, then un-jsonify it
curl https://api.explorer.aleo.org/v1/$NETWORK/program/$PROGRAM | jq -r > $PROGRAM
Below are some snarkos-aot
commands for interacting with programs.
# Get a program's id from a text file
$ snarkos-aot program id ./credits.aleo
credits.aleo
# Calculate the cost of deploying a program
$ snarkos-aot program cost ./example.aleo
2568400
# Get a list of imports for a program (output in a json format with --json)
$ snarkos-aot program imports ./staking_v1.aleo --json
["credits.aleo"]
# Get a list of functions (and respective inputs/outputs) for a program (jq for formatting)
$ snarkos-aot program functions ./domainnames.aleo --json | jq
{
"validate_name": {
"inputs": [
"[u128; 4u32].private"
],
"outputs": [
"boolean.private"
]
}
}
Account Helpers
Need to generate a bunch of vanity accounts for testing?
# Generate 5 accounts that have addresses that start with `aleo1f00`
snarkos-aot accounts 5 --vanity f00
Contributing
snops
is free and open source. You can find the source code on
GitHub and issues and feature requests can be posted on
the GitHub issue tracker. If you'd like to contribute, please read
the CONTRIBUTING guide and consider opening
a pull request.
License
The snops
source and documentation are released under
the MIT License
.
Architecture
A snops
"instance" is composed of multiple parts:
- A Control Plane
- Agents
- A runner which is: snarkos-aot: our own modified runner and aot wrapper around the official snarkOS.
Agent
The agent
is responsible for:
- Communicating with the running
control plane
. - Launching and running the
snarkos-aot
binary. - Communicating to the running
snarkos-aot
.
Running the Agent
The agent
can be run on the same machine as the control plane or a separate one.
Depending on the environment you specified, you will need the number agents listed in it, unless they are external.
Startup Options
The binary has several options you can run mess with at launch and some are required that we will go over here.
However, for a more in depth information you can read about the CLI options here.
endpoint
Is an optional argument that can be provided via the CLI or the SNOPS_ENDPOINT
environment variable.
NOTE: If both the CLI flag and the ENV variable are present, the ENV variable takes precedence over the CLI flag.
If not provided it will default to 127.0.0.1:1234
.
This is the endpoint of the Control Plane
.
If you want it to be a secure connection please specify https://
or wss://
at the beginning of the endpoint or it will default to http
and ws
.
id
The field where you can give this agent a specific ID, so it is identifiable within the snops
ecosystem.
labels
Optional comma separated list of labels you can apply to the agent, which are used for filtering and grouping.
private-key-file
An optional private key file. If provided is used when starting snarkOS
.
path
Optional path to the directory containing the stored data and configuration for the agent
.
By default it is snops-data
local to where the agent
was run from.
external
TODO
internal
TODO
bind_addr
The optional address for the agent
to bind to when running.
Defaults to 0.0.0.0
.
node
Optional port for the snarkOS
node server to run on.
Defaults to 4130
.
bft
Optional port for the snarkOS
BFT to run on.
Defaults to 5000
.
rest
Optional port for the snarkOS
REST API to run on.
Defaults to 3030
.
metrics
Optional port for the snarkOS
metrics to run on.
Defaults to 9000
.
validator
Enables validator
mode as an option for the agent's snarkOS
node.
prover
Enables prover
mode as an option for the agent's snarkOS
node.
client
Enables client
mode as an option for the agent's snarkOS
node.
compute
Enables compute
mode as an option for the agent to be able to run transactions fired from within snops
.
quiet
Run the agent in quiet mode which prevents snarkOS
node output.
How it Works
The agent
once running will connect to the control plane. If the control plane goes/offline or isn't online yet that's okay! The agent
will continuously try to reconnect to the control plane endpoint provided.
For running snarkOS
the agent
will download that binary from the control plane
.
Updating
You don't have to worry about updating the individual agents.
The control plane will serve the updated agent
binary to them once there is an update.
Control Plane
The control plane
is responsible for:
- Communicating to
agents
. - Delegating work to appropriate
agents
. - Various actions you can perform on agents and within an environment.
- Searching among agents.
- Forwarding logs and metrics.
- Serving
snarkos-aot
andagent
binaries. - Storing and querying environment information.
The binary has several options you can run mess with at launch and some are required that we will go over here.
However, for a more in depth information you can read about the CLI options here.
Running the Control Plane
The control plane
is the critical part of snops
as it delegates and handles all incoming information from agents
.
Startup Options
The binary has several options you can run mess with at launch and some are required that we will go over here.
However, for a more in depth information you can read about the CLI options here.
bind_addr
The optional address for the control plane
to bind to when running.
Defaults to 0.0.0.0
.
port
The optional address for the control plane
to bind to when running.
Defaults to 1234
.
prometheus
Is a optional argument that can be provided via the CLI or the PROMETHEUS_URL
environment variable.
NOTE: If both the CLI flag and the ENV variable are present, the ENV variable takes precedence over the CLI flag.
If provided it will send metric data to prometheus.
loki
Is a optional argument that can be provided via the CLI or the LOKI_URL
environment variable.
NOTE: If both the CLI flag and the ENV variable are present, the ENV variable takes precedence over the CLI flag.
If provided it will send log data to Loki.
prometheus_location
Optional value of where prometheus
is located.
This option only matters if you are running the agents
local to the control plane
.
The default is docker
.
The other two options are external
and internal
.
WARNING: For locally run
agents
an external prometheus server is not yet supported.
path
Optional path to the directory containing the stored data and configuration for the agent.
By default it is snops-control-data
local to where the control plane
was run from.
hostname
The optional hostname(IP or FQDN) for an external cannon
/compute
.
It must include http://
or https://
.
Updating
To update the control plane
simply stop the current one, and replace the binary.
When you run the control plane
again it will read it's data back from the path
specified during running.
Metrics and Logging
TODO
Cli Help
This section contains documentation on all the different CLIs we have.
Command-Line Help for snarkos-aot
This document contains the help content for the snarkos-aot
command-line program.
Command Overview:
snarkos-aot
↴snarkos-aot genesis
↴snarkos-aot accounts
↴snarkos-aot ledger
↴snarkos-aot ledger init
↴snarkos-aot ledger view
↴snarkos-aot ledger view top
↴snarkos-aot ledger view block
↴snarkos-aot ledger view balance
↴snarkos-aot ledger view records
↴snarkos-aot ledger rewind
↴snarkos-aot ledger replay
↴snarkos-aot ledger execute
↴snarkos-aot ledger query
↴snarkos-aot ledger hash
↴snarkos-aot ledger checkpoint
↴snarkos-aot ledger checkpoint create
↴snarkos-aot ledger checkpoint apply
↴snarkos-aot ledger checkpoint view
↴snarkos-aot ledger checkpoint clean
↴snarkos-aot auth
↴snarkos-aot auth execute
↴snarkos-aot auth program
↴snarkos-aot auth fee
↴snarkos-aot auth id
↴snarkos-aot auth cost
↴snarkos-aot auth deploy
↴snarkos-aot program
↴snarkos-aot program id
↴snarkos-aot program functions
↴snarkos-aot program imports
↴snarkos-aot program cost
↴snarkos-aot man
↴snarkos-aot md
↴snarkos-aot run
↴
snarkos-aot
The different AOT commands
Usage: snarkos-aot [OPTIONS] <COMMAND>
Subcommands:
genesis
— This command helps generate a custom genesis block given an initial private key, seed, and committee sizeaccounts
— Given a seed and a count, generate a number of accountsledger
— Commands for interacting with the ledgerauth
— A command to help generate various different types of authorizations and execute themprogram
— A command to help gather information about a program, including its cost and importsman
— For generating cli manpages. Only with the mangen feature enabledmd
— For generating cli markdown. Only with the clipages feature enabledrun
— A wrapper around the snarkos node run commands that provide additional logging and configurability
Options:
-
--enable-profiling
-
--log <LOG>
— The path to the log file -
--verbosity <VERBOSITY>
— The verbosity level of the logsDefault value:
4
-
--loki <LOKI>
— The optional loki url to send logs to
snarkos-aot genesis
This command helps generate a custom genesis block given an initial private key, seed, and committee size
Usage: snarkos-aot genesis [OPTIONS]
Options:
-
-g
,--genesis-key <GENESIS_KEY>
— The private key to use when generating the genesis block. Generates one randomly if not passed -
-o
,--output <OUTPUT>
— Where to write the genesis block toDefault value:
genesis.block
-
--committee-size <COMMITTEE_SIZE>
— The committee size. Not used if --bonded-balances is setDefault value:
4
-
--committee-output <COMMITTEE_OUTPUT>
— A place to optionally write out the generated committee private keys JSON -
--additional-accounts <ADDITIONAL_ACCOUNTS>
— Additional number of accounts that aren't validators to add balances toDefault value:
0
-
--additional-accounts-balance <additional-accounts-balance>
— The balance to add to the number of accounts specified by additional-accountsDefault value:
100000000
-
--additional-accounts-record-balance <ADDITIONAL_ACCOUNTS_RECORD_BALANCE>
— If --additional-accounts is passed you can additionally add an amount to give them in a record -
--additional-accounts-output <ADDITIONAL_ACCOUNTS_OUTPUT>
— A place to write out the additionally generated accounts by --additional-accounts -
--seed <SEED>
— The seed to use when generating committee private keys and the genesis block. If unpassed, uses DEVELOPMENT_MODE_RNG_SEED (1234567890u64) -
--bonded-balance <BONDED_BALANCE>
— The bonded balance each bonded address receives. Not used if--bonded-balances
is passedDefault value:
10000000000000
-
--bonded-balances <BONDED_BALANCES>
— An optional map from address to bonded balance. Overrides--bonded-balance
and--committee-size
-
--bonded-withdrawal <BONDED_WITHDRAWAL>
— An optional to specify withdrawal addresses for the genesis committee -
--bonded-commission <BONDED_COMMISSION>
— The bonded commission each bonded address uses. Not used if--bonded-commissions
is passed. Defaults to 0. Must be 100 or lessDefault value:
0
-
--bonded-commissions <BONDED_COMMISSIONS>
— An optional map from address to bonded commission. Overrides--bonded-commission
. Defaults to 0. Must be 100 or less -
--ledger <LEDGER>
— Optionally initialize a ledger as well
snarkos-aot accounts
Given a seed and a count, generate a number of accounts
Usage: snarkos-aot accounts [OPTIONS] [COUNT]
Arguments:
-
<COUNT>
— Number of accounts to generateDefault value:
1
Options:
-v
,--vanity <VANITY>
— Vanity prefix for addresses-o
,--output <OUTPUT>
— Where to write the output to-s
,--seed <seed>
— The seed to use when generating private keys If unpassed or used with --vanity, uses a random seed
snarkos-aot ledger
Commands for interacting with the ledger
Usage: snarkos-aot ledger [OPTIONS] --ledger <LEDGER> <COMMAND>
Subcommands:
init
— Used to initialize a new ledger given a genesis blockview
— Used to view information about the ledgerrewind
— Rewind the ledger to a specific checkpointreplay
— Replays blocks from a ledger to a specific height or amount to rollback toexecute
— A command to execute an authorizationquery
— Receive inquiries on/<network>/latest/stateRoot
hash
— Hash the ledgercheckpoint
— A command to interact with checkpoints
Options:
-
--enable-profiling
-
-g
,--genesis <GENESIS>
— A path to the genesis block to initialize the ledger fromDefault value:
./genesis.block
-
-l
,--ledger <LEDGER>
— The ledger from which to view a blockDefault value:
./ledger
snarkos-aot ledger init
Used to initialize a new ledger given a genesis block
Usage: snarkos-aot ledger init
snarkos-aot ledger view
Used to view information about the ledger
Usage: snarkos-aot ledger view <COMMAND>
Subcommands:
top
— View the top block of the ledgerblock
— View a specific block in the ledgerbalance
— View the balance of an addressrecords
— View records associated with a private key
snarkos-aot ledger view top
View the top block of the ledger
Usage: snarkos-aot ledger view top
snarkos-aot ledger view block
View a specific block in the ledger
Usage: snarkos-aot ledger view block <BLOCK_HEIGHT>
Arguments:
<BLOCK_HEIGHT>
— The height of the block to view
snarkos-aot ledger view balance
View the balance of an address
Usage: snarkos-aot ledger view balance <ADDRESS>
Arguments:
<ADDRESS>
— The address to view the balance of
snarkos-aot ledger view records
View records associated with a private key
Usage: snarkos-aot ledger view records <PRIVATE_KEY>
Arguments:
<PRIVATE_KEY>
— The private key to view records for
snarkos-aot ledger rewind
Rewind the ledger to a specific checkpoint
Usage: snarkos-aot ledger rewind <CHECKPOINT>
Arguments:
<CHECKPOINT>
— The checkpoint to rewind to
snarkos-aot ledger replay
Replays blocks from a ledger to a specific height or amount to rollback to
Usage: snarkos-aot ledger replay [OPTIONS]
Options:
-
--height <HEIGHT>
— The height to replay to -
--amount <AMOUNT>
— The amount of blocks to rollback to -
--skip <SKIP>
— How many blocks to skip when readingDefault value:
1
-
-c
,--checkpoint
— When checkpoint is enabled, checkpointsDefault value:
false
snarkos-aot ledger execute
A command to execute an authorization
Usage: snarkos-aot ledger execute [OPTIONS] --query <QUERY> [JSON]
Arguments:
-
<JSON>
— Authorization flags as json{"auth": Program Auth, "fee_auth": Fee Auth }
{"deployment": Deployment, "owner": Prog Owner, "fee_auth": Fee Auth }
Options:
-
-e
,--exec-mode <EXEC_MODE>
— The execution mode: local(local ledgr) or remote(api to another node)Default value:
local
Possible values:
local
,remote
-
-q
,--query <QUERY>
— Query endpoint -
-b
,--broadcast
— Whether to broadcast the transactionDefault value:
false
-
-a
,--auth <AUTH>
— Authorization for an execution of some kind -
-f
,--fee-auth <FEE_AUTH>
— The optional fee authorization for said execution -
-o
,--owner <OWNER>
— The owner of the program if deploying -
-d
,--deployment <DEPLOYMENT>
— The deployment of the program if deploying -
--seed <SEED>
— The seed to use for the execution
snarkos-aot ledger query
Receive inquiries on /<network>/latest/stateRoot
Usage: snarkos-aot ledger query [OPTIONS]
Options:
-
--port <PORT>
— Port to listen on for incoming messagesDefault value:
3030
-
--bind <BIND>
Default value:
0.0.0.0
-
--readonly
— When true, the POST/block
endpoint will not be available -
--record
— Receive messages from/<network>/transaction/broadcast
and record them to the output -
-o
,--output <OUTPUT>
— Path to the directory containing the stored dataDefault value:
transactions.json
snarkos-aot ledger hash
Hash the ledger
Usage: snarkos-aot ledger hash
snarkos-aot ledger checkpoint
A command to interact with checkpoints
Usage: snarkos-aot ledger checkpoint <COMMAND>
Subcommands:
create
— Create a checkpoint for the given ledgerapply
— Apply a checkpoint to the given ledgerview
— View the available checkpointsclean
— Cleanup old checkpoints
snarkos-aot ledger checkpoint create
Create a checkpoint for the given ledger
Usage: snarkos-aot ledger checkpoint create
snarkos-aot ledger checkpoint apply
Apply a checkpoint to the given ledger
Usage: snarkos-aot ledger checkpoint apply [OPTIONS] <CHECKPOINT>
Arguments:
<CHECKPOINT>
— Checkpoint file to apply
Options:
-
-c
,--clean
— When present, clean up old checkpoints that are no longer applicable after applying the checkpointDefault value:
false
snarkos-aot ledger checkpoint view
View the available checkpoints
Usage: snarkos-aot ledger checkpoint view
snarkos-aot ledger checkpoint clean
Cleanup old checkpoints
Usage: snarkos-aot ledger checkpoint clean
snarkos-aot auth
A command to help generate various different types of authorizations and execute them
Usage: snarkos-aot auth <COMMAND>
Subcommands:
execute
— A command to execute an authorizationprogram
— Authorize a program executionfee
— Authorize the fee for a program executionid
— Given an authorization (and fee), return the transaction IDcost
— Estimate the cost of a program execution or deploymentdeploy
— Deploy a program to the network
snarkos-aot auth execute
A command to execute an authorization
Usage: snarkos-aot auth execute [OPTIONS] --query <QUERY> [JSON]
Arguments:
-
<JSON>
— Authorization flags as json{"auth": Program Auth, "fee_auth": Fee Auth }
{"deployment": Deployment, "owner": Prog Owner, "fee_auth": Fee Auth }
Options:
-
-e
,--exec-mode <EXEC_MODE>
— The execution mode: local(local ledgr) or remote(api to another node)Default value:
local
Possible values:
local
,remote
-
-q
,--query <QUERY>
— Query endpoint -
-b
,--broadcast
— Whether to broadcast the transactionDefault value:
false
-
-a
,--auth <AUTH>
— Authorization for an execution of some kind -
-f
,--fee-auth <FEE_AUTH>
— The optional fee authorization for said execution -
-o
,--owner <OWNER>
— The owner of the program if deploying -
-d
,--deployment <DEPLOYMENT>
— The deployment of the program if deploying -
--seed <SEED>
— The seed to use for the execution
snarkos-aot auth program
Authorize a program execution
Usage: snarkos-aot auth program [OPTIONS] <--private-key <PRIVATE_KEY>|--private-key-file <PRIVATE_KEY_FILE>> <LOCATOR> [INPUTS]...
Arguments:
<LOCATOR>
— Program ID and function name (eg. credits.aleo/transfer_public)<INPUTS>
— Program inputs (eg. 1u64 5field)
Options:
-
--private-key <PRIVATE_KEY>
— Specify the account private key of the node -
--private-key-file <PRIVATE_KEY_FILE>
— Specify the account private key of the node -
--fee-private-key <FEE_PRIVATE_KEY>
— Specify the account private key of the node -
--fee-private-key-file <FEE_PRIVATE_KEY_FILE>
— Specify the account private key of the node -
--skip-fee
— Prevent the fee from being included in the authorization -
--priority-fee <PRIORITY_FEE>
— The priority fee in microcreditsDefault value:
0
-
--record <RECORD>
— The record for a private fee -
-q
,--query <QUERY>
— Query to load the program with -
--seed <SEED>
— The seed to use for the authorization generation -
--cost-v1
— Enable cost v1 for the transaction cost estimation (v2 by default)Default value:
false
snarkos-aot auth fee
Authorize the fee for a program execution
Usage: snarkos-aot auth fee [OPTIONS] <--private-key <PRIVATE_KEY>|--private-key-file <PRIVATE_KEY_FILE>>
Options:
-
--private-key <PRIVATE_KEY>
— Specify the account private key of the node -
--private-key-file <PRIVATE_KEY_FILE>
— Specify the account private key of the node -
--priority-fee <PRIORITY_FEE>
— The priority fee in microcreditsDefault value:
0
-
--record <RECORD>
— The record for a private fee -
--query <QUERY>
— The query to use for the program execution cost lookup -
-a
,--auth <AUTH>
— The Authorization for the program execution -
-d
,--deployment <DEPLOYMENT>
— The Authorization for a deployment -
-i
,--id <ID>
— The ID of the deployment or program execution -
-c
,--cost <COST>
— Estimated cost of the deployment or program execution -
--seed <SEED>
— The seed to use for the authorization generation -
--cost-v1
— Enable cost v1 for the transaction cost estimation (v2 by default)Default value:
false
snarkos-aot auth id
Given an authorization (and fee), return the transaction ID
Usage: snarkos-aot auth id [OPTIONS] [JSON]
Arguments:
-
<JSON>
— Authorization flags as json{"auth": Program Auth, "fee_auth": Fee Auth }
{"deployment": Deployment, "owner": Prog Owner, "fee_auth": Fee Auth }
Options:
-a
,--auth <AUTH>
— Authorization for an execution of some kind-f
,--fee-auth <FEE_AUTH>
— The optional fee authorization for said execution-o
,--owner <OWNER>
— The owner of the program if deploying-d
,--deployment <DEPLOYMENT>
— The deployment of the program if deploying
snarkos-aot auth cost
Estimate the cost of a program execution or deployment
Usage: snarkos-aot auth cost [OPTIONS] [JSON]
Arguments:
-
<JSON>
— Authorization flags as json{"auth": Program Auth, "fee_auth": Fee Auth }
{"deployment": Deployment, "owner": Prog Owner, "fee_auth": Fee Auth }
Options:
-
-q
,--query <QUERY>
— The query to use for the program -
-a
,--auth <AUTH>
— Authorization for an execution of some kind -
-f
,--fee-auth <FEE_AUTH>
— The optional fee authorization for said execution -
-o
,--owner <OWNER>
— The owner of the program if deploying -
-d
,--deployment <DEPLOYMENT>
— The deployment of the program if deploying -
--cost-v1
— Enable cost v1 for the transaction cost estimation (v2 by default)Default value:
false
snarkos-aot auth deploy
Deploy a program to the network
Usage: snarkos-aot auth deploy [OPTIONS] <--private-key <PRIVATE_KEY>|--private-key-file <PRIVATE_KEY_FILE>> <PROGRAM>
Arguments:
<PROGRAM>
— The program to deploy. This can be a file or stdin
Options:
-
--private-key <PRIVATE_KEY>
— Specify the account private key of the node -
--private-key-file <PRIVATE_KEY_FILE>
— Specify the account private key of the node -
--fee-private-key <FEE_PRIVATE_KEY>
— Specify the account private key of the node -
--fee-private-key-file <FEE_PRIVATE_KEY_FILE>
— Specify the account private key of the node -
--skip-fee
— Prevent the fee from being included in the authorization -
--priority-fee <PRIORITY_FEE>
— The priority fee in microcreditsDefault value:
0
-
--record <RECORD>
— The record for a private fee -
-q
,--query <QUERY>
— The query to use for the program -
--seed <SEED>
— The seed to use for the authorization generation -
--cost-v1
— Enable cost v1 for the transaction cost estimation (v2 by default)Default value:
false
snarkos-aot program
A command to help gather information about a program, including its cost and imports
Usage: snarkos-aot program <COMMAND>
Subcommands:
id
— Get the ID of a given programfunctions
— List the functions and their inputs/outputs of a given programimports
— List the inputs of a given programcost
— Compute the cost to execute a function in a given program
snarkos-aot program id
Get the ID of a given program
Usage: snarkos-aot program id [OPTIONS] <PROGRAM>
Arguments:
<PROGRAM>
— Path to .aleo program to get information about, or-
for stdin
Options:
-j
,--json
— Output as JSON
snarkos-aot program functions
List the functions and their inputs/outputs of a given program
Usage: snarkos-aot program functions [OPTIONS] <PROGRAM>
Arguments:
<PROGRAM>
— Path to .aleo program to get information about, or-
for stdin
Options:
-j
,--json
— Output as JSON
snarkos-aot program imports
List the inputs of a given program
Usage: snarkos-aot program imports [OPTIONS] <PROGRAM>
Arguments:
<PROGRAM>
— Path to .aleo program to get information about, or-
for stdin
Options:
-j
,--json
— Output as JSON
snarkos-aot program cost
Compute the cost to execute a function in a given program
Usage: snarkos-aot program cost [OPTIONS] <PROGRAM> [FUNCTION] [INPUTS]...
Arguments:
<PROGRAM>
— Program to estimate the cost of<FUNCTION>
— Program ID and function name (eg. credits.aleo/transfer_public). When not specified, the cost of deploying the program is estimated<INPUTS>
— Program inputs (eg. 1u64 5field)
Options:
-
-q
,--query <QUERY>
— Query to load the program with -
--cost-v1
— Enable cost v1 for the transaction cost estimation (v2 by default)Default value:
false
snarkos-aot man
For generating cli manpages. Only with the mangen feature enabled
Usage: snarkos-aot man [DIRECTORY]
Arguments:
-
<DIRECTORY>
— Directory to write manpages toDefault value:
target/man/snops-cli
snarkos-aot md
For generating cli markdown. Only with the clipages feature enabled
Usage: snarkos-aot md [DIRECTORY]
Arguments:
-
<DIRECTORY>
— Directory to write markdown toDefault value:
snops_book/user_guide/clis
snarkos-aot run
A wrapper around the snarkos node run commands that provide additional logging and configurability
Usage: snarkos-aot run [OPTIONS] --ledger <LEDGER> --type <type> <--private-key <PRIVATE_KEY>|--private-key-file <PRIVATE_KEY_FILE>>
Options:
-
-g
,--genesis <GENESIS>
— A path to the genesis block to initialize the ledger from -
-l
,--ledger <LEDGER>
— The ledger from which to view a blockDefault value:
./ledger
-
-t
,--type <type>
— The type of node to run: validator, prover, or client -
--private-key <PRIVATE_KEY>
— Specify the account private key of the node -
--private-key-file <PRIVATE_KEY_FILE>
— Specify the account private key of the node -
--bind <BIND_ADDR>
— Specify the IP(v4 or v6) address to bind toDefault value:
0.0.0.0
-
--node <NODE>
— Specify the IP address and port for the node serverDefault value:
4130
-
--bft <BFT>
— Specify the IP address and port for the BFTDefault value:
5000
-
--rest <REST>
— Specify the IP address and port for the REST serverDefault value:
3030
-
--metrics <METRICS>
— Specify the port for the metrics serverDefault value:
9000
-
--peers <PEERS>
— Specify the IP address and port of the peer(s) to connect to -
--validators <VALIDATORS>
— Specify the IP address and port of the validator(s) to connect to -
--rest-rps <REST_RPS>
— Specify the requests per second (RPS) rate limit per IP for the REST serverDefault value:
1000
-
--retention-policy <RETENTION_POLICY>
— The retention policy for the checkpoint manager. i.e. how often to create checkpoints -
--agent-rpc-port <AGENT_RPC_PORT>
— When present, connects to an agent RPC server on the given port
This document was generated automatically by
clap-markdown
.
Command-Line Help for snops-agent
This document contains the help content for the snops-agent
command-line program.
Command Overview:
snops-agent
Usage: snops-agent [OPTIONS] --id <ID> <COMMAND>
Subcommands:
man
— For generating cli manpages. Only with the mangen feature enabledmd
— For generating cli markdown. Only with the clipages feature enabled
Options:
-
--endpoint <ENDPOINT>
— Control plane endpoint address (IP, or wss://host, http://host) -
--id <ID>
— Agent ID, used to identify the agent in the network -
--private-key-file <PRIVATE_KEY_FILE>
— Locally provided private key file, used for envs where private keys are locally provided -
--labels <LABELS>
— Labels to attach to the agent, used for filtering and grouping -
--path <PATH>
— Path to the directory containing the stored data and configurationDefault value:
./snops-data
-
--external <EXTERNAL>
— Enable the agent to fetch its external address. Necessary to determine which agents are on shared networks, and for external-to-external connections -
--internal <INTERNAL>
— Manually specify internal addresses -
--bind <BIND_ADDR>
Default value:
0.0.0.0
-
--node <NODE>
— Specify the IP address and port for the node serverDefault value:
4130
-
--bft <BFT>
— Specify the IP address and port for the BFTDefault value:
5000
-
--rest <REST>
— Specify the IP address and port for the REST serverDefault value:
3030
-
--metrics <METRICS>
— Specify the port for the metricsDefault value:
9000
-
--validator
— Enable running a validator node -
--prover
— Enable running a prover node -
--client
— Enable running a client node -
--compute
— Enable functioning as a compute target when inventoried -
-q
,--quiet
— Run the agent in quiet mode, suppressing most node outputDefault value:
false
snops-agent man
For generating cli manpages. Only with the mangen feature enabled
Usage: snops-agent man [DIRECTORY]
Arguments:
-
<DIRECTORY>
— Directory to write manpages toDefault value:
target/man/snops-cli
snops-agent md
For generating cli markdown. Only with the clipages feature enabled
Usage: snops-agent md [DIRECTORY]
Arguments:
-
<DIRECTORY>
— Directory to write markdown toDefault value:
snops_book/user_guide/clis
This document was generated automatically by
clap-markdown
.
Command-Line Help for snops
This document contains the help content for the snops
command-line program.
Command Overview:
snops
Usage: snops [OPTIONS] <COMMAND>
Subcommands:
man
— For generating cli manpages. Only with the mangen feature enabledmd
— For generating cli markdown. Only with the clipages feature enabled
Options:
-
--bind <BIND_ADDR>
Default value:
0.0.0.0
-
--port <PORT>
— Control plane server portDefault value:
1234
-
--prometheus <PROMETHEUS>
— Optional URL referencing a Prometheus server -
--loki <LOKI>
— Optional URL referencing a Loki server -
--prometheus-location <PROMETHEUS_LOCATION>
Default value:
docker
-
--path <PATH>
— Path to the directory containing the stored dataDefault value:
snops-control-data
-
--hostname <HOSTNAME>
— Hostname to advertise to the control plane, used when resolving the control plane's address for external cannons can be an external IP or FQDN, will have the port appendedmust contain http:// or https://
snops man
For generating cli manpages. Only with the mangen feature enabled
Usage: snops man [DIRECTORY]
Arguments:
-
<DIRECTORY>
— Directory to write manpages toDefault value:
target/man/snops-cli
snops md
For generating cli markdown. Only with the clipages feature enabled
Usage: snops md [DIRECTORY]
Arguments:
-
<DIRECTORY>
— Directory to write markdown toDefault value:
snops_book/user_guide/clis
This document was generated automatically by
clap-markdown
.
Command-Line Help for snops-cli
This document contains the help content for the snops-cli
command-line program.
Command Overview:
snops-cli
↴snops-cli autocomplete
↴snops-cli agent
↴snops-cli agent find
↴snops-cli agent info
↴snops-cli agent kill
↴snops-cli agent list
↴snops-cli agent tps
↴snops-cli agent status
↴snops-cli agent set-log-level
↴snops-cli agent set-snarkos-log-level
↴snops-cli env
↴snops-cli env action
↴snops-cli env action offline
↴snops-cli env action online
↴snops-cli env action reboot
↴snops-cli env action execute
↴snops-cli env action deploy
↴snops-cli env action config
↴snops-cli env agent
↴snops-cli env agents
↴snops-cli env auth
↴snops-cli env balance
↴snops-cli env block
↴snops-cli env height
↴snops-cli env transaction
↴snops-cli env transaction-details
↴snops-cli env delete
↴snops-cli env info
↴snops-cli env list
↴snops-cli env topology
↴snops-cli env topology-resolved
↴snops-cli env apply
↴snops-cli env mapping
↴snops-cli env mappings
↴snops-cli env program
↴snops-cli env storage
↴snops-cli set-log-level
↴snops-cli events
↴snops-cli man
↴snops-cli md
↴
snops-cli
Usage: snops-cli [OPTIONS] <COMMAND>
Subcommands:
autocomplete
— Generate shell completionsagent
— For interacting with snop agentsenv
— For interacting with snop environmentsset-log-level
—events
— Listen to events from the control plane, optionally filteredman
— For generating cli manpages. Only with the mangen feature enabledmd
— For generating cli markdown. Only with the clipages feature enabled
Options:
-
-u
,--url <URL>
— The url the control plane is onDefault value:
http://localhost:1234
snops-cli autocomplete
Generate shell completions
Usage: snops-cli autocomplete <SHELL>
Arguments:
-
<SHELL>
— Which shell you want to generate completions forPossible values:
bash
,elvish
,fish
,powershell
,zsh
snops-cli agent
For interacting with snop agents
Usage: snops-cli agent [ID] <COMMAND>
Subcommands:
find
— Find agents by set criteria. If all of client/compute/prover/validator are not specified it can be any one of theminfo
— Get the specific agentkill
— Kill the specific agentlist
— List all agents. Ignores the agent idtps
— Get the specific agent's TPSstatus
— Get the specific agent's statusset-log-level
— Set the log level of the agentset-snarkos-log-level
— Set the log level of the node running on an agent
Arguments:
-
<ID>
— Show a specific agent's infoDefault value:
dummy_value___
snops-cli agent find
Find agents by set criteria. If all of client/compute/prover/validator are not specified it can be any one of them
Usage: snops-cli agent find [OPTIONS]
Options:
--client
— Whether the agent can be a client--compute
— Whether the agent can be a compute--prover
— Whether the agent can be a prover--validator
— Whether the agent can be a validator--env <ENV>
— Which env you are finding the agens from. Not specifing a env, means only inventoried agents are found--all
— Means regardless of connection status, and state we find them--labels <LABELS>
— The labels an agent should have--local-pk
— If the agent has a local private key or not--include-offline
— Whether to include offline agents as well
snops-cli agent info
Get the specific agent
Usage: snops-cli agent info
snops-cli agent kill
Kill the specific agent
Usage: snops-cli agent kill
snops-cli agent list
List all agents. Ignores the agent id
Usage: snops-cli agent list
snops-cli agent tps
Get the specific agent's TPS
Usage: snops-cli agent tps
snops-cli agent status
Get the specific agent's status
Usage: snops-cli agent status
snops-cli agent set-log-level
Set the log level of the agent
Usage: snops-cli agent set-log-level <LEVEL>
Arguments:
<LEVEL>
— The log level to set
snops-cli agent set-snarkos-log-level
Set the log level of the node running on an agent
Usage: snops-cli agent set-snarkos-log-level <VERBOSITY>
Arguments:
<VERBOSITY>
— The log verbosity to set
snops-cli env
For interacting with snop environments
Usage: snops-cli env [ID] <COMMAND>
Subcommands:
action
— Run an action on an environmentagent
— Get an env's specific agent byagents
— List an env's agentsauth
—balance
— Lookup an account's balanceblock
— Lookup a block or get the latest blockheight
— Get the latest height from all agents in the envtransaction
— Lookup a transaction's block by a transaction idtransaction-details
— Lookup a transaction's details by a transaction iddelete
— Delete a specific environmentinfo
— Get an env's latest block/state root infolist
— List all environments. Ignores the env idtopology
— Show the current topology of a specific environmenttopology-resolved
— Show the resolved topology of a specific environment. Shows only internal agentsapply
— Apply an environment specmapping
— Lookup a mapping by program id and mapping namemappings
— Lookup a program's mappings onlyprogram
— Lookup a program by its idstorage
— Get an env's storage info
Arguments:
-
<ID>
— Work with a specific envDefault value:
default
snops-cli env action
Run an action on an environment
Usage: snops-cli env action <COMMAND>
Subcommands:
offline
— Turn the specified agents(and nodes) offlineonline
— Turn the specified agents(and nodes) onlinereboot
— Reboot the specified agents(and nodes)execute
— Execute an aleo program function on the environment. i.e. credits.aleo/transfer_publicdeploy
— Deploy an aleo program to the environmentconfig
— Configure the state of the target nodes
snops-cli env action offline
Turn the specified agents(and nodes) offline
Usage: snops-cli env action offline [OPTIONS] [NODES]...
Arguments:
<NODES>
— The nodes to take offline. (eg.validator/any
)
Options:
--async
— When present, don't wait for reconciles to finish before returning
snops-cli env action online
Turn the specified agents(and nodes) online
Usage: snops-cli env action online [OPTIONS] [NODES]...
Arguments:
<NODES>
— The nodes to turn online (eg.validator/any
)
Options:
--async
— When present, don't wait for reconciles to finish before returning
snops-cli env action reboot
Reboot the specified agents(and nodes)
Usage: snops-cli env action reboot [OPTIONS] [NODES]...
Arguments:
<NODES>
— The nodes to reboot (eg.validator/any
)
Options:
--async
— When present, don't wait for reconciles to finish before returning
snops-cli env action execute
Execute an aleo program function on the environment. i.e. credits.aleo/transfer_public
Usage: snops-cli env action execute [OPTIONS] <LOCATOR> [INPUTS]...
Arguments:
<LOCATOR>
—transfer_public
ORcredits.aleo/transfer_public
<INPUTS>
— list of program inputs
Options:
--private-key <PRIVATE_KEY>
— Private key to use, can becommittee.0
to use committee member 0's key--fee-private-key <FEE_PRIVATE_KEY>
— Private key to use for the fee. Defaults to the same as --private-key-c
,--cannon <CANNON>
— Desired cannon to fire the transaction--priority-fee <PRIORITY_FEE>
— The optional priority fee to use--fee-record <FEE_RECORD>
— The fee record to use if you want to pay the fee privately--async
— When present, don't wait for transaction execution before returning
snops-cli env action deploy
Deploy an aleo program to the environment
Usage: snops-cli env action deploy [OPTIONS] <PROGRAM>
Arguments:
<PROGRAM>
— Path to program or program content in stdin
Options:
-p
,--private-key <PRIVATE_KEY>
— Private key to use, can becommittee.0
to use committee member 0's key--fee-private-key <FEE_PRIVATE_KEY>
— Private key to use for the fee. Defaults to the same as --private-key-c
,--cannon <CANNON>
— Desired cannon to fire the transaction--priority-fee <PRIORITY_FEE>
— The optional priority fee to use--fee-record <FEE_RECORD>
— The fee record to use if you want to pay the fee privately--async
— When present, don't wait for transaction execution before returning
snops-cli env action config
Configure the state of the target nodes
Usage: snops-cli env action config [OPTIONS] [NODES]...
Arguments:
<NODES>
— The nodes to configure. (eg.validator/any
)
Options:
-
-o
,--online <ONLINE>
— Configure the online state of the target nodesPossible values:
true
,false
-
--height <HEIGHT>
— Configure the height of the target nodes -
-p
,--peers <PEERS>
— Configure the peers of the target nodes, ornone
-
-v
,--validators <VALIDATORS>
— Configure the validators of the target nodes, ornone
-
-e
,--env <ENV>
— Set environment variables for a node:--env FOO=bar
-
-d
,--del-env <DEL_ENV>
-
-b
,--binary <BINARY>
— Configure the binary for a node -
--private-key <PRIVATE_KEY>
— Configure the private key for a node -
--async
snops-cli env agent
Get an env's specific agent by
Usage: snops-cli env agent <KEY>
Arguments:
<KEY>
— The agent's key. i.e validator/0, client/foo, prover/9, or combination
snops-cli env agents
List an env's agents
Usage: snops-cli env agents
snops-cli env auth
Usage: snops-cli env auth [OPTIONS] <AUTH>
Arguments:
<AUTH>
— Authorization to execute and broadcast
Options:
-
--async
— When present, don't wait for transaction execution before returning -
-c
,--cannon <CANNON>
— Desired cannon to fire the transactionDefault value:
default
snops-cli env balance
Lookup an account's balance
Usage: snops-cli env balance <ADDRESS>
Arguments:
<ADDRESS>
— Address to lookup balance for
snops-cli env block
Lookup a block or get the latest block
Usage: snops-cli env block [HEIGHT_OR_HASH]
Arguments:
-
<HEIGHT_OR_HASH>
— The block's height or hashDefault value:
latest
snops-cli env height
Get the latest height from all agents in the env
Usage: snops-cli env height
snops-cli env transaction
Lookup a transaction's block by a transaction id
Usage: snops-cli env transaction <ID>
Arguments:
<ID>
snops-cli env transaction-details
Lookup a transaction's details by a transaction id
Usage: snops-cli env transaction-details <ID>
Arguments:
<ID>
snops-cli env delete
Delete a specific environment
Usage: snops-cli env delete
snops-cli env info
Get an env's latest block/state root info
Usage: snops-cli env info
snops-cli env list
List all environments. Ignores the env id
Usage: snops-cli env list
snops-cli env topology
Show the current topology of a specific environment
Usage: snops-cli env topology
snops-cli env topology-resolved
Show the resolved topology of a specific environment. Shows only internal agents
Usage: snops-cli env topology-resolved
snops-cli env apply
Apply an environment spec
Usage: snops-cli env apply [OPTIONS] <SPEC>
Arguments:
<SPEC>
— The environment spec file
Options:
--async
— When present, don't wait for reconciles to finish before returning
snops-cli env mapping
Lookup a mapping by program id and mapping name
Usage: snops-cli env mapping <PROGRAM> <MAPPING> <KEY>
Arguments:
<PROGRAM>
— The program name<MAPPING>
— The mapping name<KEY>
— The key to lookup
snops-cli env mappings
Lookup a program's mappings only
Usage: snops-cli env mappings <PROGRAM>
Arguments:
<PROGRAM>
— The program name
snops-cli env program
Lookup a program by its id
Usage: snops-cli env program <ID>
Arguments:
<ID>
snops-cli env storage
Get an env's storage info
Usage: snops-cli env storage
snops-cli set-log-level
Usage: snops-cli set-log-level <LEVEL>
Arguments:
<LEVEL>
snops-cli events
Listen to events from the control plane, optionally filtered
Usage: snops-cli events [FILTER]
Arguments:
-
<FILTER>
— The event filter to apply, such asagent-connected
orall-of(env-is(default),node-target-is(validator/any))
Default value:
unfiltered
snops-cli man
For generating cli manpages. Only with the mangen feature enabled
Usage: snops-cli man [DIRECTORY]
Arguments:
-
<DIRECTORY>
— Directory to write manpages toDefault value:
target/man/snops-cli
snops-cli md
For generating cli markdown. Only with the clipages feature enabled
Usage: snops-cli md [DIRECTORY]
Arguments:
-
<DIRECTORY>
— Directory to write markdown toDefault value:
snops_book/user_guide/clis
This document was generated automatically by
clap-markdown
.
Developing
TODO
Glossary
A glossary of terms we use throughout the documentation.
The format will follow: link_with_more_details
: TLDR definition
- Actions: The
action
API offered by the control plane that allows for several conveniences. - IDs: A unique identifier that aligns with the regex
^[A-Za-z0-9][A-Za-z0-9\-_.]{0,63}$
. - Node Targets: An identifier to specify a node.
- Retention Rules: Syntax rules to define how long data should be retained for.
Actions
TODO
IDs
Node Targets
TODO describe the different syntaxes here.
Retention Rules
TODO move retention rules explanation here then link to it.