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

# Struct OnchainUnconstrainedDelivery

Module: `noir_aztec::messages::delivery`

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

On-chain unconstrained delivery. Returned by [`MessageDelivery::onchain_unconstrained`](/aztec-nr-api/v6.0.0/noir_aztec/messages/delivery/struct.MessageDelivery.md#onchain_unconstrained).

By default the tag reuses a handshake already registered for the pair, and otherwise falls back to the wallet-resolved \[tagging secret strategy][`crate::messages::delivery::ResolvedTaggingStrategy`](/aztec-nr-api/v6.0.0/noir_aztec/messages/delivery/struct.ResolvedTaggingStrategy.md). The contract can also fix the derivation, and its choice is honored over this default.

## Implementations

```rust
impl OnchainUnconstrainedDelivery
```

```rust
pub fn with_sender(&mut self, sender: AztecAddress) -> Self
```

Overrides the sender address used for discovery tag derivation.

On-chain messages are tagged so that the recipient can find them efficiently without scanning all logs. The tag is derived from a shared secret between a "sender" and the recipient. By default, the sender is the wallet-supplied address (typically the account that initiated the transaction), but some contracts need to override it so that recipients can discover the notes correctly. This is the case for account contracts in their constructor: the deployer is the one that initiated the transaction, but any notes generated during deployment should be tagged by the account contract itself.

#### Examples

```rust
MessageDelivery::onchain_unconstrained().with_sender(self.address)
```

```rust
pub fn via_non_interactive_handshake(&mut self) -> Self
```

Derives the discovery tag from a non-interactive handshake for the pair, reusing an existing one and creating a fresh one only when none exists.

```rust
pub fn via_interactive_handshake(&mut self) -> Self
```

Derives the discovery tag from an interactive handshake.

Reuses an existing handshake for the pair, creating a fresh interactive one only when none exists.

Unlike a non-interactive handshake, establishing an interactive one announces nothing onchain, but it requires the recipient's cooperation: they must answer the registry's signed-authorization request, so the send fails if they cannot be reached.

```rust
pub fn via_address_derived_secret(&mut self) -> Self
```

Derives the discovery tag from the address-derived secret for the `(sender, recipient)` pair, established via Diffie-Hellman between their addresses. Leaves no on-chain trace and never consults the handshake registry.

#### Examples

```rust
MessageDelivery::onchain_unconstrained().via_address_derived_secret()
```

## Trait implementations

```rust
impl MessageDeliveryBuilder for OnchainUnconstrainedDelivery
```

```rust
pub fn build_message_delivery(self) -> MessageDelivery
```
