For the complete documentation index, see llms.txt.
aztec-nr - noir_aztec::context

Struct UtilityContext

pub struct UtilityContext
{ /* private fields */ }

Implementations

impl UtilityContext

pub unconstrained fn new() -> Self pub unconstrained fn at(contract_address: AztecAddress) -> Self pub fn block_header(self) -> BlockHeader pub fn block_number(self) -> u32 pub fn timestamp(self) -> u64 pub fn this_address(self) -> AztecAddress pub unconstrained fn maybe_msg_sender(self) -> Option<AztecAddress>

Returns the address that initiated this utility call.

This is similar to msg.sender in Solidity (hence the name). A utility function called by another contract (via a nested utility call) sees that contract's address. A utility function invoked directly (e.g. by a wallet or dApp) has no caller and sees Option::none.

Important Note: utility functions are simulated client-side and never proven, so this value is whatever the simulator (PXE) set it to: nothing about it is verified onchain. It exists to assist simulation in a cooperative environment and must not be relied on as a security guarantee.

pub fn version(self) -> Field pub fn chain_id(self) -> Field pub unconstrained fn raw_storage_read<let N: u32>( self, storage_slot: Field, ) -> [Field; N] pub unconstrained fn storage_read<T>(self, storage_slot: Field) -> T
where T: Packable