Skip to main content

History Reference

Note inclusion

Note inclusion proves that a note existed (its hash was included in a note hash tree) in a block header.

prove_note_inclusion

prove_note_inclusion takes 1 parameter:

NameTypeDescription
noteNoteThe note you are proving inclusion for

Example

prove_note_inclusion
header.prove_note_inclusion(note);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L67-L69

Note validity

This proves that a note exists and has not been nullified in a specific block header.

prove_note_validity

prove_note_validity takes 2 parameters:

NameTypeDescription
note_with_headerNoteThe note you are proving inclusion for
contextPrivateContextPrivate context

Example

prove_note_validity
header.prove_note_validity(note, &mut context);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L143-L145

Nullifier inclusion

This proves that a nullifier exists in a given block header (can be used to prove that a note had been nullified).

prove_nullifier_inclusion

prove_nullifier_inclusion takes 1 parameter:

NameTypeDescription
nullifierFieldThe nullifier you are proving inclusion for

Example

prove_nullifier_inclusion
header.prove_nullifier_inclusion(nullifier);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L175-L177

prove_note_is_nullified

Instead of passing the nullifier, you can check that a note has been nullified by passing the note.

Implementation

prove_note_is_nullified
fn prove_note_is_nullified<Note, N, M>(self, note: Note, context: &mut PrivateContext) where Note: NoteInterface<N, M> {
let nullifier = compute_siloed_nullifier(note, context);

self.prove_nullifier_inclusion(nullifier);
}
Source code: noir-projects/aztec-nr/aztec/src/history/nullifier_inclusion.nr#L39-L45

Nullifier non inclusion

This proves that a nullifier was not included in a certain block, given the block header (can be used to prove that a note had not yet been nullified in a given block).

prove_nullifier_non_inclusion

prove_nullifier_non_inclusion takes 1 parameters:

NameTypeDescription
nullifierFieldThe nullifier you are proving inclusion for

Example

prove_nullifier_non_inclusion
self.prove_nullifier_non_inclusion(nullifier);
Source code: noir-projects/aztec-nr/aztec/src/history/contract_inclusion.nr#L34-L36

prove_note_not_nullified

Instead of passing the nullifier, you can check that a note has not been nullified by passing the note.

Implementation

prove_note_not_nullified
fn prove_note_not_nullified<Note, N, M>(self, note: Note, context: &mut PrivateContext) where Note: NoteInterface<N, M> {
let nullifier = compute_siloed_nullifier(note, context);

self.prove_nullifier_non_inclusion(nullifier);
}
Source code: noir-projects/aztec-nr/aztec/src/history/nullifier_non_inclusion.nr#L47-L53

Public storage historical reads

These return the value stored in a public storage slot of a given contract at the end of the execution of a certain block (the latest one if using public_storage_historical_read).

Note that it is never possible to read the current value in a public storage slot in private since private execution is local and by definition always works on historical state.

public_storage_historical_read

public_storage_historical_read takes 2 parameters:

NameTypeDescription
storage_slotFieldStorage slot
contract_addressAztecAddressThe contract that owns the storage slot

Example

public_storage_historical_read
header.public_storage_historical_read(
storage.public_unused_value.storage_slot,
context.this_address()
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L197-L201

Contract inclusion

This proves that a contract exists in, ie had been deployed before or in, a certain block.

prove_contract_deployment

prove_contract_deployment takes 1 parameter:

NameTypeDescription
contract_addressAztecAddressThe contract address to prove deployment of

Example

prove_contract_deployment
header.prove_contract_deployment(contract_address);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L234-L236

prove_contract_non_deployment

prove_contract_non_deployment takes 1 parameter:

NameTypeDescription
contract_addressAztecAddressThe contract address to prove non-deployment of

Example

prove_contract_non_deployment
header.prove_contract_non_deployment(contract_address);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L256-L258

prove_contract_initialization

prove_contract_initialization takes 1 parameter:

NameTypeDescription
contract_addressAztecAddressThe contract address to prove initialization of

Example

prove_contract_initialization
header.prove_contract_initialization(contract_address);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L239-L241

prove_contract_non_initialization

prove_contract_non_initialization takes 1 parameter:

NameTypeDescription
contract_addressAztecAddressThe contract address to prove non-initialization of

Example

prove_contract_non_initialization
header.prove_contract_non_initialization(contract_address);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L261-L263