From 0ee1a96b7b95c10eebd095b22dc5a48c8ee8ad29 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Fri, 6 Dec 2024 17:53:50 -0300 Subject: [PATCH 1/3] add cli doc --- docs/3_guides/9_aligned_cli.md | 118 +++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 docs/3_guides/9_aligned_cli.md diff --git a/docs/3_guides/9_aligned_cli.md b/docs/3_guides/9_aligned_cli.md new file mode 100644 index 000000000..18c118029 --- /dev/null +++ b/docs/3_guides/9_aligned_cli.md @@ -0,0 +1,118 @@ +# Aligned CLI + +The Aligned CLI serves as a interface for users to interact with and retrieve information from Alinged Layer. This document serves as a reference for commands of the Aligned CLI. + +## Installation: + +1. Download and install Aligned from the Aligned github repo `https://github.com/yetanotherco/aligned_layer`: + +```bash +curl -L https://raw.githubusercontent.com/yetanotherco/aligned_layer/main/batcher/aligned/install_aligned.sh | bash +``` + +2. Run the ```source``` command that should appear in the shell. + +```bash +aligned +``` + +## Commands: + +- `submit [OPTIONS] --proving_system --proof `: Submit a proof or (repetitions of a proof) to the Aligned Layer batcher. + + - Args: + - `--batcher_url `: Websocket URL for the Aligned Layer batcher. + - **default**: `ws://localhost:8080` i.e. `devnet` + - `--rpc_url `: User's Ethereum RPC Node URL. + - `--proving_system `: Proof system of the submitted proof. + - **possible values**: `GnarkPlonkBls12_381`, `GnarkPlonkBn254`, `Groth16Bn254`, `SP1`, `Risc0` + - `--proof `: Path to the file the proof being submitted for verification is written. + - `--public_input `: Path to a file where the public inputs of the proof being submitted for verification is written. + - `--vk `: Path to the file where the verification key of the proof being submitted for verification is written. Note, the following proof systems require a verification key to be supplied: `GnarkPlonkBls12_381`, `GnarkPlonkBn254`, `Groth16Bn254` + - `--vm_program `: Path to the file where the vm program code (ELF File) of the proof being submitted for verification is written. Note, the following proof systems require a vm program code (ELF File) to be supplied: `SP1`, `Risc0`. + - `--repetitions `: + Number of repetitions of this proof to be submitted. + - **default**: 1 + - `--proof_generator_addr `: An optional parameter that can be used in some applications to avoid front-running. + - **default**: `0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266` + - `--aligned_verification_data_path `: Path to the location the verification data of the proof will be written after it is submitted. + - **default**: `./aligned_verification_data/` + - `--keystore_path `: Path to the local keystore of the user's wallet. + - `--private_key `: User's wallet private key. + - `--max_fee `: Amount of Ethereum in Wei to deposit into the `BatcherPaymentService.sol` contract to pay for proof submission. + - `--nonce `: Nonce of the proof. + - `--network `: The Ethereum network of the Aligned Layer Network the user is submitting to. + - **default**: `devnet` + - **possible values**: `devnet`, `holesky`, `holesky-stage`, `mainnet` + +- `verify-proof-onchain [OPTIONS] --aligned-verification-data `: Verify the proof was included in a verified batch on Ethereum. + + - Args: + - `--aligned-verification-data `: Path to verification data file generated from proof submission with the Aligned CLI. + - `--rpc-url `: User's Ethereum RPC node URL. + - `--network `: The Ethereum network of the Aligned Layer network the user is querying their balance on. + - **default**: `devnet` + - **possible values**: `devnet`, `holesky`, `holesky-stage`, `mainnet` +- `get-vk-commitment [OPTIONS] --verification_key_file --proving_system `: Computes the verification data commitment specifically [provingSystemAuxDataCommitment](../2_architecture/components/3_service_manager_contract.md#verify-batch-inclusion) from the verification data file generated from submitting a proof to the batcher. + + - Args: + - `--verification_key_file `: Path to verification data file generated from proof submission with the Aligned CLI. + - `--proving_system `: Proof system of the supplied verification data file. + - **possible values**: `GnarkPlonkBls12_381`, `GnarkPlonkBn254`, `Groth16Bn254`, `SP1`, `Risc0` + - `--output `: File path for output to be written to. + +- `deposit-to-batcher [OPTIONS] --keystore_path --amount `: Deposits Ethereum into the Aligned Layer's `BatcherPaymentService.sol` contract to pay for users proof submission. + + - Args: + - `--keystore_path `: Path to the local keystore of the user's wallet. + - `--rpc-url `: User's Ethereum RPC Node URL. + - `--network `: The Ethereum network of the Aligned Layer Network the user is querying their balance on. + - **default**: `devnet` + - **possible values**: `devnet`, `holesky`, `holesky-stage`, `mainnet` + - `--amount `: Amount of Ethereum in Wei to deposit into the `BatcherPaymentService.sol` contract to pay for proof submission. + +- `get-user-balance [OPTIONS] --user_addr `: Retrieves the user's current balance in Aligned Layer's `BatcherPaymentService.sol` contract. + + - Args: + - `--network `: The Ethereum network of the Aligned Layer Network the user is querying their balance on. + - **default**: `devnet` + - **possible values**: `devnet`, `holesky`, `holesky-stage`, `mainnet` + - `--rpc_url `: User's Ethereum RPC Node URL. + - **default**: `http://localhost:8545` + - `--user_addr `: User's Ethereum address on the provided network. + +- `get-user-nonce [OPTIONS] --user_addr `: Retrieves the user's current nonce from the batcher. + + - Args: + - `--batcher_url `: Websocket URL for the Aligned Layer batcher. + - **default**: `ws://localhost:8080` i.e. `devnet` + - `--user_addr `: User's Ethereum address on Ethereum Mainnet. + +## Example: + +An workflow example workflow for using the Aligned CLI on Holesky would be the following: + +1. Deposit funds to the batcher. +```bash +aligned deposit-to-batcher --network holesky --amount 0.5ether --keystore_path +``` + +2. Check your balance in the aligned batcher. +```bash +aligned get-user-balance --user_addr --network holesky +``` + +3. Submit a Proof. +```bash +aligned submit --proving_system Risc0 --proof ../../scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci.proof --vm_program ../../scripts/test_files/risc_zero/fibonacci_proof_generator/fibonacci_id.bin --public_input ../../scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci.pub --repetitions --keystore_path --network holesky --max_fee 1300000000 +``` + +4. Verify that your proof has been found on chain. +```bash +aligned verify-proof-onchain --aligned-verification-data ./aligned_verification_data/ --network holesky +``` + +5. Check that the number of proofs you have submitted is incremented. +```bash +aligned get-user-nonce --user_addr --batcher_url wss://holesky.batcher.alignedlayer.com +``` From 113e844c0c9a768ff5611cb8bcfdd0dc33617db7 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Tue, 10 Dec 2024 11:58:21 -0300 Subject: [PATCH 2/3] nits --- docs/3_guides/9_aligned_cli.md | 35 +++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/docs/3_guides/9_aligned_cli.md b/docs/3_guides/9_aligned_cli.md index 18c118029..8290daaa2 100644 --- a/docs/3_guides/9_aligned_cli.md +++ b/docs/3_guides/9_aligned_cli.md @@ -10,17 +10,30 @@ The Aligned CLI serves as a interface for users to interact with and retrieve in curl -L https://raw.githubusercontent.com/yetanotherco/aligned_layer/main/batcher/aligned/install_aligned.sh | bash ``` -2. Run the ```source``` command that should appear in the shell. +2. A source command will be printed in your terminal after installation. Execute that command to update your shell environment. +3. Verify that the installation was successful: ```bash -aligned +aligned --help +``` + +## Help: + +To see the available commands run: +```bash +aligned --help +``` + +To see the usage of a command run: +```bash +aligned [COMMAND] --help ``` ## Commands: - `submit [OPTIONS] --proving_system --proof `: Submit a proof or (repetitions of a proof) to the Aligned Layer batcher. - - Args: + - Options: - `--batcher_url `: Websocket URL for the Aligned Layer batcher. - **default**: `ws://localhost:8080` i.e. `devnet` - `--rpc_url `: User's Ethereum RPC Node URL. @@ -47,7 +60,7 @@ aligned - `verify-proof-onchain [OPTIONS] --aligned-verification-data `: Verify the proof was included in a verified batch on Ethereum. - - Args: + - Options: - `--aligned-verification-data `: Path to verification data file generated from proof submission with the Aligned CLI. - `--rpc-url `: User's Ethereum RPC node URL. - `--network `: The Ethereum network of the Aligned Layer network the user is querying their balance on. @@ -55,7 +68,7 @@ aligned - **possible values**: `devnet`, `holesky`, `holesky-stage`, `mainnet` - `get-vk-commitment [OPTIONS] --verification_key_file --proving_system `: Computes the verification data commitment specifically [provingSystemAuxDataCommitment](../2_architecture/components/3_service_manager_contract.md#verify-batch-inclusion) from the verification data file generated from submitting a proof to the batcher. - - Args: + - Options: - `--verification_key_file `: Path to verification data file generated from proof submission with the Aligned CLI. - `--proving_system `: Proof system of the supplied verification data file. - **possible values**: `GnarkPlonkBls12_381`, `GnarkPlonkBn254`, `Groth16Bn254`, `SP1`, `Risc0` @@ -63,7 +76,7 @@ aligned - `deposit-to-batcher [OPTIONS] --keystore_path --amount `: Deposits Ethereum into the Aligned Layer's `BatcherPaymentService.sol` contract to pay for users proof submission. - - Args: + - Options: - `--keystore_path `: Path to the local keystore of the user's wallet. - `--rpc-url `: User's Ethereum RPC Node URL. - `--network `: The Ethereum network of the Aligned Layer Network the user is querying their balance on. @@ -73,7 +86,7 @@ aligned - `get-user-balance [OPTIONS] --user_addr `: Retrieves the user's current balance in Aligned Layer's `BatcherPaymentService.sol` contract. - - Args: + - Options: - `--network `: The Ethereum network of the Aligned Layer Network the user is querying their balance on. - **default**: `devnet` - **possible values**: `devnet`, `holesky`, `holesky-stage`, `mainnet` @@ -83,14 +96,14 @@ aligned - `get-user-nonce [OPTIONS] --user_addr `: Retrieves the user's current nonce from the batcher. - - Args: + - Options: - `--batcher_url `: Websocket URL for the Aligned Layer batcher. - **default**: `ws://localhost:8080` i.e. `devnet` - `--user_addr `: User's Ethereum address on Ethereum Mainnet. ## Example: -An workflow example workflow for using the Aligned CLI on Holesky would be the following: +An example workflow for using the Aligned CLI (Runnable from the root directory of the Aligned Layer Repository): 1. Deposit funds to the batcher. ```bash @@ -104,7 +117,7 @@ aligned get-user-balance --user_addr --network holesky 3. Submit a Proof. ```bash -aligned submit --proving_system Risc0 --proof ../../scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci.proof --vm_program ../../scripts/test_files/risc_zero/fibonacci_proof_generator/fibonacci_id.bin --public_input ../../scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci.pub --repetitions --keystore_path --network holesky --max_fee 1300000000 +aligned submit --proving_system Risc0 --proof ./scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci.proof --vm_program ./scripts/test_files/risc_zero/fibonacci_proof_generator/fibonacci_id.bin --public_input ./scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci.pub --repetitions --keystore_path --network holesky --max_fee 1300000000 ``` 4. Verify that your proof has been found on chain. @@ -114,5 +127,5 @@ aligned verify-proof-onchain --aligned-verification-data ./aligned_verification_ 5. Check that the number of proofs you have submitted is incremented. ```bash -aligned get-user-nonce --user_addr --batcher_url wss://holesky.batcher.alignedlayer.com +aligned get-user-nonce --user_addr --batcher_url wss://holesky.batcher.alignedlayer.com ``` From 835a62d595c422055072f364acc9cb5f2e7ca0b1 Mon Sep 17 00:00:00 2001 From: PatStiles Date: Tue, 10 Dec 2024 14:27:54 -0300 Subject: [PATCH 3/3] added docs to summary + added missing link in summary for Submitting Batch without batcher --- docs/SUMMARY.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 9a5c69d91..9e6826642 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -33,6 +33,8 @@ * [Generating & submitting proofs of Rust code with ZKRust](3_guides/5_using_zkrust.md) * [Setup Aligned Infrastructure Locally](3_guides/6_setup_aligned.md) * [Contract Addresses](3_guides/7_contract_addresses.md) +* [Submitting Batch Without Batcher](3_guides/8_submitting_batch_without_batcher.md) +* [Aligned CLI](3_guides/9_aligned_cli.md) ## Operators