Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

aztec-pxe-client

The PXE trait and shared request / response types. Depend on this crate when you want to accept any PXE backend (embedded, remote, mock).

Source: crates/pxe-client/src/.

The Pxe Trait

#[async_trait]
pub trait Pxe: Send + Sync {
    // --- Sync / state ---
    async fn get_synced_block_header(&self) -> Result<BlockHeader, Error>;
    async fn get_contracts(&self) -> Result<Vec<AztecAddress>, Error>;
    async fn get_contract_instance(&self, address: &AztecAddress) -> Result<Option<ContractInstanceWithAddress>, Error>;
    async fn get_contract_artifact(&self, id: &Fr) -> Result<Option<ContractArtifact>, Error>;

    // --- Accounts & senders ---
    async fn register_account(&self, secret_key: &Fr, partial: &PartialAddress) -> Result<CompleteAddress, Error>;
    async fn get_registered_accounts(&self) -> Result<Vec<CompleteAddress>, Error>;
    async fn register_sender(&self, sender: &AztecAddress) -> Result<AztecAddress, Error>;
    async fn get_senders(&self) -> Result<Vec<AztecAddress>, Error>;
    async fn remove_sender(&self, sender: &AztecAddress) -> Result<(), Error>;

    // --- Contracts ---
    async fn register_contract_class(&self, artifact: &ContractArtifact) -> Result<(), Error>;
    async fn register_contract(&self, request: RegisterContractRequest) -> Result<(), Error>;
    async fn update_contract(&self, /* ... */) -> Result<(), Error>;

    // --- Transactions ---
    async fn simulate_tx(&self, request: &TxExecutionRequest, opts: SimulateTxOpts) -> Result<TxSimulationResult, Error>;
    async fn prove_tx(&self, request: &TxExecutionRequest) -> Result<TxProvingResult, Error>;
    async fn profile_tx(&self, request: &TxExecutionRequest, opts: ProfileTxOpts) -> Result<TxProfileResult, Error>;

    // --- Utility execution ---
    async fn execute_utility(&self, call: &FunctionCall, opts: ExecuteUtilityOpts) -> Result<UtilityExecutionResult, Error>;

    // --- Events ---
    async fn get_private_events(&self, filter: PrivateEventFilter) -> Result<Vec<PackedPrivateEvent>, Error>;

    // --- Lifecycle ---
    async fn stop(&self) -> Result<(), Error>;
}

Object-safe (see pxe_is_object_safe test). Implementations MUST be Send + Sync.

Key Types

TypePurpose
BlockHeaderHeader returned from get_synced_block_header
BlockHash32-byte block hash
TxExecutionRequestEverything needed to simulate / prove a tx (origin, calls, authwits, capsules)
TxSimulationResultOutput of simulate_tx
TxProvingResultOutput of prove_tx — carries the wire-format Tx
TxProfileResultOutput of profile_tx (gate counts, execution steps)
UtilityExecutionResultOutput of execute_utility (return values, logs)
SimulateTxOptsSkip-verification / fee-enforcement / public-simulation toggles
ProfileTxOptsProfileMode + capture toggles
ProfileModeGate-count vs execution-step profiling mode
ExecuteUtilityOptsScopes + arguments for utility calls
PrivateEventFilterFilter for get_private_events
PackedPrivateEventDecoded private event payload
RegisterContractRequestInstance + optional artifact payload for register_contract
LogIdLocator for a specific log entry

Full API

Bundled rustdoc: api/aztec_pxe_client/. Local regeneration:

cargo doc -p aztec-pxe-client --open

See Also