> For the complete documentation index, see [llms.txt](https://docs.alignedlayer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.alignedlayer.com/guides/10.1_aggregation_mode_cli.md).

# Aggregation Mode CLI

The Aggregation Mode CLI serves as an interface for users to interact with Aligned Aggregation Mode.

This document serves as a reference for the commands of the Aggregation Mode CLI.

> **Note:** Aggregation Mode is currently available on the [`staging` branch](https://github.com/yetanotherco/aligned_layer/tree/staging).

## Installation

1. Clone the Aligned Layer repository:

   ```bash
   git clone https://github.com/yetanotherco/aligned_layer.git
   cd aligned_layer
   git checkout staging
   ```
2. Build and install the Aggregation Mode CLI using the Makefile:

   ```bash
   make agg_mode_install_cli
   ```
3. Verify that the installation was successful:

   ```bash
   agg-mode-cli --version
   ```

> **Note:** A standalone installation script will be available soon for easier installation without cloning the repository.

## Help

To see the available commands, run:

```bash
agg_mode_cli --help
```

To see the usage of a command, run:

```bash
agg_mode_cli [COMMAND] --help
```

## CLI Commands

### **deposit**

#### Description

Send ether to the Aggregation Mode payment service to fund your proof submission quota.

#### Command

`deposit [OPTIONS] --rpc-url <rpc_url>`

#### Options

* `--keystore-path <keystore_path>`: Path to the local keystore file.
* `--private-key <private_key>`: User's wallet private key.
  * Note: Either `--keystore-path` or `--private-key` must be provided, but not both.
* `-n, --network <network>`: Network to interact with.
  * Default: `devnet`
  * Possible values: `devnet`, `hoodi`, `mainnet`
* `--rpc-url <rpc_url>`: Ethereum RPC provider URL.
  * Mainnet: `https://ethereum-rpc.publicnode.com`
  * Hoodi: `https://ethereum-hoodi-rpc.publicnode.com`

#### Example

```bash
agg_mode_cli deposit \
  --keystore-path ~/.ethereum/keystore/my-key.json \
  --network hoodi \
  --rpc-url https://ethereum-hoodi-rpc.publicnode.com
```

***

### **submit sp1**

#### Description

Submit an SP1 proof to the Aggregation Mode Gateway for verification.

#### Command

`submit sp1 [OPTIONS] --proof <proof_path> --vk <verifying_key_path>`

#### Options

* `-p, --proof <proof_path>`: Path to the SP1 proof file (bincode serialized).
* `--vk <verifying_key_path>`: Path to the SP1 verifying key file (bincode serialized).
* `--keystore-path <keystore_path>`: Path to the local keystore file.
* `--private-key <private_key>`: User's wallet private key.
  * Note: Either `--keystore-path` or `--private-key` must be provided, but not both.
* `-n, --network <network>`: Network to interact with.
  * Default: `devnet`
  * Possible values: `devnet`, `hoodi`, `mainnet`

#### Example

```bash
agg_mode_cli submit sp1 \
  --proof ./my_proof.bin \
  --vk ./my_vk.bin \
  --keystore-path ~/.ethereum/keystore/my-key.json \
  --network hoodi
```

#### Notes

* The proof will be aggregated and settled to L1 within the configured aggregation window (default: 24 hours).
* A task ID is returned upon successful submission, which can be used to track the proof status.

***

### **verify-on-chain**

#### Description

Check whether a proof has been verified on the AlignedProofAggregationService contract.

#### Command

`verify-on-chain [OPTIONS] --rpc-url <rpc_url> --beacon-url <beacon_url> --proving-system <proving_system> --vk-hash <vk_hash_path>`

#### Options

* `-n, --network <network>`: Network to interact with.
  * Default: `devnet`
  * Possible values: `devnet`, `hoodi`, `mainnet`
* `--rpc-url <rpc_url>`: Ethereum RPC provider URL.
* `--beacon-url <beacon_url>`: Beacon chain client URL.
* `--from-block <block_number>`: Block number to start searching from.
  * Default: Current block minus 7500 blocks (\~25 hours)
* `--proving-system <proving_system>`: The proving system used.
  * Possible values: `SP1`, `Risc0`
* `--vk-hash <vk_hash_path>`: Path to the file containing the program verification key hash (32 bytes).
* `--public-inputs <public_inputs_path>`: Path to the public inputs file.

#### Example

```bash
agg-mode-cli verify-on-chain \
  --network hoodi \
  --rpc-url https://ethereum-hoodi-rpc.publicnode.com \
  --beacon-url https://ethereum-hoodi-beacon-api.publicnode.com \
  --proving-system SP1 \
  --vk-hash ./my_vk_hash.bin \
  --public-inputs ./my_public_inputs.bin
```

#### Notes

* If your proof isn't found, try specifying an earlier `--from-block` to search further back in history.
* The command verifies the proof's inclusion in the Merkle tree of the aggregated batch.
