aztec-nr - noir_aztec::macros::notes

Function custom_note

pub comptime fn custom_note(s: TypeDefinition) -> Quoted

Generates code for a custom note implementation that requires specialized note hash or nullifier computation.

Generated Code

Requirements

The note struct must:

Unlike the #[note] macro, there is no requirement for an owner field.

Registration

Registers the note in the global NOTES BoundedVec to enable note processing functionality.

Use Cases

Use this macro when implementing a note that needs custom:

The macro omits generating default NoteHash trait implementation, allowing you to provide your own.

Example

#[custom_note]
struct CustomNote {
    value: Field,
    metadata: Field
}

impl NoteHash for CustomNote {
    // Custom note hash computation...
    fn compute_note_hash(...) -> Field { ... }

    // Custom nullifier computation...
    fn compute_nullifier(...) -> Field { ... }
    fn compute_nullifier_unconstrained(...) -> Field { ... }
}