> 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_local_note_was_valid_by

Module: `noir_aztec::history::note`

```rust
pub fn assert_local_note_was_valid_by<Note>(
    block_header: BlockHeader,
    hinted_note: HintedNote<Note>,
    context: &mut PrivateContext,
)
where
    Note: NoteHash
```

Asserts a note existed and had not yet been nullified by a given block.

Combines [`assert_note_existed_by`](/aztec-nr-api/v6.0.0/noir_aztec/history/note/fn.assert_note_existed_by.md) and [`assert_local_note_was_not_nullified_by`](/aztec-nr-api/v6.0.0/noir_aztec/history/note/fn.assert_local_note_was_not_nullified_by.md): it proves both that the note existed at `block_header` and that it had not been nullified then. A contract typically uses this as a security gate before acting on a note whose validity at some past block matters.

## Local notes only

Like [`assert_local_note_was_not_nullified_by`](/aztec-nr-api/v6.0.0/noir_aztec/history/note/fn.assert_local_note_was_not_nullified_by.md), this can only be used for notes of the executing contract. Use [`assert_note_existed_by`](/aztec-nr-api/v6.0.0/noir_aztec/history/note/fn.assert_note_existed_by.md) on its own to prove existence of another contract's notes.
