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

# Function assert_nullifier_did_not_exist_by

Module: `noir_aztec::history::nullifier`

```rust
pub fn assert_nullifier_did_not_exist_by(
    block_header: BlockHeader,
    siloed_nullifier: Field,
)
```

Asserts that a nullifier did not exist by the time a block was mined.

This function takes a *siloed* nullifier, i.e. the value that is actually stored in the tree. Use [`crate::protocol::hash::compute_siloed_nullifier`](/aztec-nr-api/v6.0.0/protocol_types/hash/fn.compute_siloed_nullifier.md) to convert an inner nullifier (what [`PrivateContext::push_nullifier_unsafe`](/aztec-nr-api/v6.0.0/noir_aztec/context/struct.PrivateContext.md#push_nullifier_unsafe) takes) into a siloed one.

In order to prove that a nullifier **did** exist by `block_header`, use [`assert_nullifier_existed_by`](/aztec-nr-api/v6.0.0/noir_aztec/history/nullifier/fn.assert_nullifier_existed_by.md).

## Nullifier Non-Existence

Proving nullifier non-existence is always nuanced, as it is not possible to privately prove that a nullifier does not exist by the time a transaction is executed. What this function does instead is assert that once all transactions from `block_header` were executed, the nullifier was not in the tree.

If you **must** prove that a nullifier does not exist by the time a transaction is executed, there only two ways to do this: by actually emitting the nullifier via [`PrivateContext::push_nullifier_unsafe`](/aztec-nr-api/v6.0.0/noir_aztec/context/struct.PrivateContext.md#push_nullifier_unsafe) (which can of course only be done once), or by calling a public contract function that calls [`PublicContext::nullifier_exists_unsafe`](/aztec-nr-api/v6.0.0/noir_aztec/context/struct.PublicContext.md#nullifier_exists_unsafe) (which leaks that this nullifier is being checked):

```rust
#[external("public")]
#[only_self]
fn _assert_nullifier_does_not_exist(unsileod_nullifier: Field, contract_address: AztecAddress) {
    assert(!self.context.nullifier_exists_unsafe(unsiloed_nullifier, contract_address));
}
```

## Cost

This function performs a single merkle tree inclusion proof, which is \~4k gates.
