Skip to main content

History Reference

Note inclusion

Note inclusion proves that a note existed (its hash was included in a note hash tree) at a specific block number. There exists a version that tests for note inclusion at current block number. It is recommended to use this version whenever possible to reduce cost.

prove_note_inclusion

prove_note_inclusion_at takes 3 parameters:

NameTypeDescription
note_with_headerNoteThe note you are proving inclusion for
block_numberu32Block number for proving note's existence
contextPrivateContextPrivate context

prove_note_commitment_inclusion

A commitment, also referred to as a note hash is a public acknowledgment of the existence of a note without revealing the content of the note. You can learn more about how to compress a note to a note hash here.

prove_note_commitment_inclusion takes 2 parameters:

NameTypeDescription
note_with_headerNoteThe note you are proving inclusion for
contextPrivateContextPrivate context

Note validity

This proves that a note exists and has not been nullified at a specified block. Again as above, there exists a version that tests for validity at current block. It is recommended to use this version whenever possible to reduce cost.

prove_note_validity

prove_note_validity_at takes 3 parameters:

NameTypeDescription
note_with_headerNoteThe note you are proving inclusion for
block_numberu32Block number for proving note's existence
contextPrivateContextPrivate context

prove_note_validity takes 2 parameters:

NameTypeDescription
note_with_headerNoteThe note you are proving inclusion for
contextPrivateContextPrivate context

Nullifier inclusion

This proves that a nullifier was included in a certain block (can be used to prove that a note had been nullified). The same disclaimer above holds true for this, and subsequent functions that specify another version without a block_number argument.

prove_nullifier_inclusion

prove_nullifier_inclusion_at takes 3 parameters:

NameTypeDescription
nullifierFieldThe nullifier you are proving inclusion for
block_numberu32Block number for proving note's existence
contextPrivateContextPrivate context

prove_nullifier_inclusion takes 2 parameters:

NameTypeDescription
nullifierFieldThe nullifier you are proving inclusion for
contextPrivateContextPrivate context

prove_note_is_nullified_at / prove_note_is_nullified

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

Nullifier non inclusion

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

prove_nullifier_not_included

prove_nullifier_not_included_at takes 3 parameters:

NameTypeDescription
nullifierFieldThe nullifier you are proving inclusion for
block_numberu32Block number for proving note's existence
contextPrivateContextPrivate context

prove_nullifier_not_included takes 2 parameters:

NameTypeDescription
nullifierFieldThe nullifier you are proving inclusion for
contextPrivateContextPrivate context

prove_note_not_nullified_at / prove_note_not_nullified

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

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_at takes 4 parameters:

NameTypeDescription
contextPrivateContextPrivate context
storage_slotFieldStorage slot
contract_addressAztecAddressThe contract that owns the storage slot
block_numberu32Historical block number in which to read

public_storage_historical_read takes 3 parameters. block_number is implicitly the historical block number from the context:

NameTypeDescription
contextPrivateContextPrivate context
storage_slotFieldStorage slot
contract_addressAztecAddressThe contract that owns the storage slot

Contract inclusion

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

prove_contract_inclusion

prove_contract_inclusion_at takes 7 parameters:

NameTypeDescription
deployer_public_keyGrumpkinPointPublic key of the contract deployer
contract_address_saltFieldUnique identifier for the contract's address
function_tree_rootFieldRoot of the contract's function tree
constructor_hashFieldHash of the contract's constructor
portal_contract_addressEthAddressEthereum address of the associated portal contract
block_numberu32Block number for proof verification
contextPrivateContextPrivate context

If there is no associated portal contract, you can use a zero Ethereum address:

new EthAddress(Buffer.alloc(EthAddress.SIZE_IN_BYTES));