> Aztec.nr API reference, v6.0.0 (mainnet and testnet). Index: https://docs.aztec.network/aztec-nr-api/mainnet/llms.txt

# Struct UtilityContext

Module: `noir_aztec::context`

```rust
pub struct UtilityContext
{ /* private fields */ }
```

## Implementations

```rust
impl UtilityContext
```

```rust
pub unconstrained fn new() -> Self
```

```rust
pub unconstrained fn at(contract_address: AztecAddress) -> Self
```

```rust
pub fn block_header(self) -> BlockHeader
```

```rust
pub fn block_number(self) -> u32
```

```rust
pub fn timestamp(self) -> u64
```

```rust
pub fn this_address(self) -> AztecAddress
```

```rust
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.

```rust
pub fn version(self) -> Field
```

```rust
pub fn chain_id(self) -> Field
```

```rust
pub unconstrained fn raw_storage_read<let N: u32>(
    self,
    storage_slot: Field,
) -> [Field; N]
```

```rust
pub unconstrained fn storage_read<T>(self, storage_slot: Field) -> T
where
    T: Packable
```

## Trait implementations

```rust
impl From<UtilityContextData> for UtilityContext
```

```rust
pub fn from(data: UtilityContextData) -> Self
```
