Aggregation Mode SDK

API Reference

AggregationModeGatewayProvider

The gateway provider handles communication with the Aggregation Mode Gateway for submitting proofs and querying proof status.


AggregationModeGatewayProvider::new

Creates a new gateway provider without a signer. Useful for read-only operations like checking nonces or receipts.

pub fn new(network: Network) -> Result<Self, GatewayError>

Arguments

  • network - The network to connect to (Devnet | Hoodi | Mainnet)

Returns

  • Result<AggregationModeGatewayProvider, GatewayError> - A gateway provider instance or an error.


AggregationModeGatewayProvider::new_with_signer

Creates a new gateway provider with a signer. Required for submitting proofs.

Arguments

  • network - The network to connect to (Devnet | Hoodi | Mainnet)

  • signer - A signer implementing the Signer trait (e.g., PrivateKeySigner)

Returns

  • Result<AggregationModeGatewayProvider, GatewayError> - A gateway provider instance or an error.


get_nonce_for

Retrieves the current nonce for a given address.

Arguments

  • address - The Ethereum address to query the nonce for.

Returns

  • Result<GatewayResponse<NonceResponse>, GatewayError> - The nonce response or an error.


get_receipts_for

Retrieves proof submission receipts for a given address.

Arguments

  • address - The Ethereum address to query receipts for.

  • nonce - Optional nonce to filter receipts by a specific submission.

Returns

  • Result<GatewayResponse<ReceiptsResponse>, GatewayError> - The receipts response or an error.


submit_sp1_proof

Submits an SP1 proof to the Aggregation Mode Gateway.

Arguments

  • proof - The SP1 proof with public values.

  • vk - The SP1 verifying key.

Returns

  • Result<GatewayResponse<SubmitProofResponse>, GatewayError> - The submission response containing a task ID, or an error.

Errors

  • SignerNotConfigured - If the provider was created without a signer.

  • ProofSerialization - If there is an error serializing the proof or verifying key.

  • MessageSignature - If there is an error signing the submission message.

  • Request - If there is a network error communicating with the gateway.

  • Api - If the gateway returns an error response.


ProofAggregationServiceProvider

The blockchain provider handles verification of proofs on-chain by querying the AlignedProofAggregationService contract.


ProofAggregationServiceProvider::new

Creates a new blockchain provider for verifying proofs on-chain.

Arguments

  • network - The network to connect to (Devnet | Hoodi | Mainnet)

  • rpc_url - The Ethereum RPC provider URL.

  • beacon_client_url - The Beacon chain client URL.

Returns

  • ProofAggregationServiceProvider - A blockchain provider instance.


check_proof_verification

Checks if a proof has been verified on-chain.

Arguments

  • from_block - Optional block number to start searching from. Defaults to current block minus 7500 blocks (~25 hours).

  • verification_data - The verification data containing the proving system type, verifying key hash, and public inputs.

Returns

  • Result<ProofStatus, ProofVerificationAggModeError> - The proof status or an error.

Proof Status

  • Verified { merkle_path, merkle_root } - The proof was found and verified in an aggregated batch.

  • Invalid - The proof was found but Merkle root verification failed.

  • NotFound - The proof was not found in any aggregated batch.

Errors

  • EthereumProviderError - If there is an error communicating with the Ethereum RPC.

  • BeaconClient - If there is an error communicating with the Beacon chain.

  • EventDecoding - If there is an error decoding the on-chain event data.


Types

Network

AggregationModeVerificationData

GatewayError

ProofStatus

Last updated