{"id":19710902,"url":"https://github.com/monadicus/snarkops","last_synced_at":"2026-01-04T20:02:15.952Z","repository":{"id":255596789,"uuid":"767828028","full_name":"monadicus/snarkops","owner":"monadicus","description":"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.","archived":false,"fork":false,"pushed_at":"2024-09-17T21:56:40.000Z","size":2484,"stargazers_count":1,"open_issues_count":71,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-09-18T19:59:49.315Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/monadicus/snarkops","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monadicus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-06T00:53:59.000Z","updated_at":"2024-09-17T21:56:42.000Z","dependencies_parsed_at":"2024-09-17T19:31:23.285Z","dependency_job_id":"89c8a6ae-0971-444d-bfaa-9ed3a2623107","html_url":"https://github.com/monadicus/snarkops","commit_stats":null,"previous_names":["monadicus/snarkops"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monadicus%2Fsnarkops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monadicus%2Fsnarkops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monadicus%2Fsnarkops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monadicus%2Fsnarkops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monadicus","download_url":"https://codeload.github.com/monadicus/snarkops/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251549229,"owners_count":21607370,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T22:08:48.482Z","updated_at":"2026-01-04T20:02:15.939Z","avatar_url":"https://github.com/monadicus.png","language":"Rust","readme":"\u003c!-- TODO snops image \u003cp align=\"center\"\u003e\n  \u003ca href=\"https://monadic.us/\"\u003e\n    \u003cimg width=\"90%\" alt=\"snops\" src=\"\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e --\u003e\n\n\u003ch1 align=\"center\"\u003e\n  snarkOPs\n\u003c/h1\u003e\n\n[Snops Quickstart](#snops-quickstart) | [snarkos-aot Quickstart](#snarkos-aot-quickstart)\n\nThis repository is home to the `snops` (snarkOS operations) ecosystem, and\n`snarkos-aot`, a crate for performing ahead-of-time ledger actions, transaction\nauthorizations, and various tools for helping with developing Aleo programs.\n\nsnops is a suite of tools that can be used to maintain [Aleo](https://aleo.org/)\nnetwork environments. The environments are defined in a manner similar to\ninfrastructure-as-code, which means you can create repeatable infrastructure\nusing the environment schema.\n\nThis can be used to create devnets, simulate events on the network like outages\nand attacks, and guarantee metrics.\n\nTo learn more about `snops` we recommend checking out the mdbook [here](https://monadicus.github.io/snarkops/).\n\n## Snops Quickstart\n\n### Easy Setup\n\n`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.\n\n1. Install [rust](https://www.rust-lang.org/)\n1. Clone the repo\n1. Start + build the control plane: `./scripts/control_plane.sh`\n\n    The controlplane is the webserver that communicates to agents how to\n    run snarkOS, or what transactions to execute.\n\n1. In another terminal, install the cli: `cargo install --path ./crates/cli`, or build with `cargo xtask build cli` and use from `target/release-big/snops-cli`.\n\n    The cli is used to interact with the controlplane and manage environments.\n    It provides JSON based output. We recommend pairing our cli with [`jq`](https://jqlang.github.io/jq/) when leveraging other scripts and tools\n\n1. Build the agent: `cargo xtask build agent`\n\n    The agent is a lightweight service that starts up `snarkos-aot` which\n    automatically configures snarkos nodes, or executes transactions.\n\n1. Build `snarkos-aot` (for running nodes): `cargo xtask build aot`\n\n    `snarkos-aot` is an alternative snarkOS CLI providing more developer-oriented\n    features as well as tooling for distributed transaction generation and execution.\n\n1. In separate terminals, start up some agents with the following commands:\n\n    ```sh\n    ./scripts/agent.sh 0\n    ./scripts/agent.sh 1\n    ./scripts/agent.sh 2\n    ./scripts/agent.sh 3\n    ```\n\n    Each of these can be dynamically configured as snarkos nodes. The default\n    agent configuration should connect to a locally operated controlplane.\n\n### Local Isolated Networks (Isonets)\n\nThis example requires 4 agents and the control plane to be running. It allows you to run a devnet with a custom genesis block.\n\n1. Start the environment: `snops-cli env apply specs/test-4-validators.yaml`\n1. Check the current network height: `snops-cli env height`\n1. Look at the latest block: `snops-cli env block`\n1. Look at the genesis block: `snops-cli env block 0`\n1. Stop the environment: `snops-cli env delete`\n\n### Isonet Transfers\n\nUsing the setup for a [Local Isonet](#local-isonets), executing Aleo programs has never\nbeen more convenient. Snops aliases locally generated keys automatically from configuration and\nreduces the need to keep track of individual key files.\n\n1. Start an environment (see previous example)\n1. Start a compute agent: `./scripts/compute_agent.sh 0`\n\n    Compute agents are able to distribute the execution of transactions,\n    offloading the compute task to different servers.\n\n1. Check the balance of committee member 1's key:\n\n    ```sh\n    $ snops-cli env balance committee.1\n    10000000000000\n    ```\n\n1. Transfer 1 credit to committee member 1 from committee member 0 (look on snarkos this command would require MANY more flags):\n\n    ```sh\n    snops-cli env action execute transfer_public committee.1 1_000_000u64\n    ```\n\n1. Check the balance of committee member 1's key (it may take a few seconds for the block to advance):\n\n    ```sh\n    snops-cli env balance committee.1\n    10000001000000\n    ```\n\n\n### Isonet Program Deployments\n\nDeploying 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.\n\n1. Use the same setup as before\n1. Create a file `mapping_example.aleo` with the following contents:\n\n    ```js\n    program mapping_example.aleo;\n\n    mapping mymapping:\n      key as u8.public;\n      value as u8.public;\n\n    function store:\n        input r0 as u8.public;\n        input r1 as u8.public;\n        async store r0 r1 into r2;\n        output r2 as mapping_example.aleo/store.future;\n\n    finalize store:\n        input r0 as u8.public;\n        input r1 as u8.public;\n        set r1 into mymapping[r0];\n    ```\n1. Deploy the program: `snops-cli env action deploy ./mapping_example.aleo`\n1. Verify the program is on the chain: `snops-cli env program mapping_example.aleo`\n1. Check an example mapping\n    ```sh\n    $ snops-cli env mapping mapping_example.aleo mymapping 0u8\n    {\n      \"value\": null\n    }\n    ```\n1. Execute the `store` function on-chain: `snops-cli env action execute mapping_example.aleo/store 0u8 5u8`\n1. Check the example mapping for its updated value\n    ```sh\n    $ snops-cli env mapping mapping_example.aleo mymapping 0u8\n    {\n      \"value\": \"5u8\"\n    }\n    ```\n\n\n## SnarkOS-aot Quickstart\n\n`snarkos-aot` provides various CLI tools to help with developing and executing\nAleo programs as well as interact with snarkOS ledgers.\n\nBuild `snarkos-aot` with: `cargo xtask build aot`.\nThe compiled binary can be found in `target/release-big/snarkos-aot`.\n\nUse the `NETWORK` environment variable to specify `mainnet` (default),\n`testnet`, or `canary`.\n\nTo select a custom snarkOS branch/tag for source, run `./scripts/update_snarkos_dep.sh v3.3.1`. Be warned - sometimes there are breaking changes!\n\n### Transaction Authorizations\n\nTypically when executing snarkOS transactions you specify the program and inputs\nand receive a proof. Behind the scenes, snarkVM is using a private key to\n\"authorize\" the proof for the program execution, and \"authorize\" the proof for\nthe fee.\n\nCreating authorizations is much quicker than executing the transaction, and the\nprocess can be done airgapped or even on web clients.\n\n```sh\n# Create an authorization for a executing transfer_public to the \"example.aleo\" program for 1 microcredit\nNETWORK=testnet snarkos-aot auth program --private-key \u003cPK\u003e credits.aleo/transfer_public example.aleo 1u64 \u003e auth.json\n# The same as above but with a different private key\nNETWORK=testnet snarkos-aot auth program --private-key \u003cPK\u003e --fee-private-key \u003cPK\u003e credits.aleo/transfer_public example.aleo 1u64 \u003e auth.json\n\n# Create an authorization for deploying a program (from my_program.aleo)\nNETWORK=testnet snarkos-aot auth deploy --private-key \u003cPK\u003e my_program.aleo\n# Determine the cost to deploy a program (from stdin)\ncat my_program.aleo | NETWORK=testnet snarkos-aot auth deploy --private-key \u003cPK\u003e - | NETWORK=testnet snarkos-aot auth cost -\n\n# Execute an authorization from auth.json without broadcasting it (the - means stdin)\ncat auth.json | NETWORK=testnet snarkos-aot auth execute - --query https://api.explorer.aleo.org/v1\n\n# Get the cost of an authorization (program or deployment) without executing the transaction\ncat auth.json | NETWORK=testnet snarkos-aot auth cost -\n\n# Derive the transaction id from an authorization without executing it\ncat auth.json | NETWORK=testnet snarkos-aot auth id -\n\n```\n\n### Program Helpers\n\n`snarkos-aot` contains various tools to programmatically interact with aleo program.\n\nIf you don't have any Aleo programs you can download a program (`credits.aleo`)\nfrom Aleo Explorer with the following commands. You can find a list of\nprograms on [Aleo Explorer's Programs List](https://explorer.aleo.org/programs).\n\n```sh\nNETWORK=testnet\nPROGRAM=credits.aleo\n# Download a program, then un-jsonify it\ncurl https://api.explorer.aleo.org/v1/$NETWORK/program/$PROGRAM | jq -r \u003e $PROGRAM\n```\n\nBelow are some `snarkos-aot` commands for interacting with programs.\n\n```sh\n# Get a program's id from a text file\n$ snarkos-aot program id ./credits.aleo\ncredits.aleo\n\n# Calculate the cost of deploying a program\n$ snarkos-aot program cost ./example.aleo\n2568400\n\n# Calculate the cost of executing a function in a program\n$ snarkos-aot program cost ./credits.aleo transfer_public example.aleo 1u64\n34060\n\n# Calculate the cost of executing a function in a program for devnets below the specific consensus versions\n# Programs that call other programs will be much more expensive with consensus v1 costs\n$ snarkos-aot program cost --height 100 ./credits.aleo transfer_public example.aleo 1u64\n51060\n\n# Get a list of imports for a program (output in a json format with --json)\n$ snarkos-aot program imports ./staking_v1.aleo --json\n[\"credits.aleo\"]\n\n# Get a list of functions (and respective inputs/outputs) for a program (jq for formatting)\n$ snarkos-aot program functions ./domainnames.aleo --json | jq\n{\n  \"validate_name\": {\n    \"inputs\": [\n      \"[u128; 4u32].private\"\n    ],\n    \"outputs\": [\n      \"boolean.private\"\n    ]\n  }\n}\n```\n\n### Account Helpers\n\nNeed to generate a bunch of vanity accounts for testing?\n\n```\n# Generate 5 accounts that have addresses that start with `aleo1f00`\nsnarkos-aot accounts 5 --vanity f00\n```\n\n## Contributing\n\n`snops` is free and open source. You can find the source code on\n[GitHub](https://github.com/monadicus/snarkops) and issues and feature requests can be posted on\nthe [GitHub issue tracker](https://github.com/monadicus/snarkops/issues). If you'd like to contribute, please read\nthe [CONTRIBUTING](https://github.com/monadicus/snarkops/blob/main/CONTRIBUTING.md) guide and consider opening\na [pull request](https://github.com/monadicus/snarkops/pulls).\n\n## License\n\nThe `snops` source and documentation are released under\nthe [MIT License\n](https://github.com/monadicus/snarkops/blob/main/LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonadicus%2Fsnarkops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonadicus%2Fsnarkops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonadicus%2Fsnarkops/lists"}