Struct miden_client::notes::Note
source · pub struct Note { /* private fields */ }Expand description
A note with all the data required for it to be consumed by executing it against the transaction kernel.
Notes consist of note metadata and details. Note metadata is always public, but details may be either public, encrypted, or private, depending on the note type. Note details consist of note assets, script, inputs, and a serial number, the three latter grouped into a recipient object.
Note details can be reduced to two unique identifiers: NoteId and Nullifier. The former is publicly associated with a note, while the latter is known only to entities which have access to full note details.
Fungible and non-fungible asset transfers are done by moving assets to the note’s assets. The note’s script determines the conditions required for the note consumption, i.e. the target account of a P2ID or conditions of a SWAP, and the effects of the note. The serial number has a double duty of preventing double spend, and providing unlikability to the consumer of a note. The note’s inputs allow for customization of its script.
To create a note, the kernel does not require all the information above, a user can create a note only with the commitment to the script, inputs, the serial number (i.e., the recipient), and the kernel only verifies the source account has the assets necessary for the note creation. See NoteRecipient for more details.
Implementations§
source§impl Note
impl Note
sourcepub fn new(
assets: NoteAssets,
metadata: NoteMetadata,
recipient: NoteRecipient,
) -> Note
pub fn new( assets: NoteAssets, metadata: NoteMetadata, recipient: NoteRecipient, ) -> Note
Returns a new Note created with the specified parameters.
sourcepub fn header(&self) -> &NoteHeader
pub fn header(&self) -> &NoteHeader
Returns the note’s header.
sourcepub fn id(&self) -> NoteId
pub fn id(&self) -> NoteId
Returns the note’s unique identifier.
This value is both an unique identifier and a commitment to the note.
sourcepub fn metadata(&self) -> &NoteMetadata
pub fn metadata(&self) -> &NoteMetadata
Returns the note’s metadata.
sourcepub fn assets(&self) -> &NoteAssets
pub fn assets(&self) -> &NoteAssets
Returns the note’s assets.
sourcepub fn serial_num(&self) -> [BaseElement; 4]
pub fn serial_num(&self) -> [BaseElement; 4]
Returns the note’s recipient serial_num, the secret required to consume the note.
sourcepub fn script(&self) -> &NoteScript
pub fn script(&self) -> &NoteScript
Returns the note’s recipient script which locks the assets of this note.
sourcepub fn inputs(&self) -> &NoteInputs
pub fn inputs(&self) -> &NoteInputs
Returns the note’s recipient inputs which customizes the script’s behavior.
sourcepub fn recipient(&self) -> &NoteRecipient
pub fn recipient(&self) -> &NoteRecipient
Returns the note’s recipient.
Methods from Deref<Target = NoteDetails>§
sourcepub fn id(&self) -> NoteId
pub fn id(&self) -> NoteId
Returns the note’s unique identifier.
This value is both an unique identifier and a commitment to the note.
sourcepub fn assets(&self) -> &NoteAssets
pub fn assets(&self) -> &NoteAssets
Returns the note’s assets.
sourcepub fn serial_num(&self) -> [BaseElement; 4]
pub fn serial_num(&self) -> [BaseElement; 4]
Returns the note’s recipient serial_num, the secret required to consume the note.
sourcepub fn script(&self) -> &NoteScript
pub fn script(&self) -> &NoteScript
Returns the note’s recipient script which locks the assets of this note.
sourcepub fn inputs(&self) -> &NoteInputs
pub fn inputs(&self) -> &NoteInputs
Returns the note’s recipient inputs which customizes the script’s behavior.
sourcepub fn recipient(&self) -> &NoteRecipient
pub fn recipient(&self) -> &NoteRecipient
Returns the note’s recipient.
Trait Implementations§
source§impl Deserializable for Note
impl Deserializable for Note
source§fn read_from<R>(source: &mut R) -> Result<Note, DeserializationError>where
R: ByteReader,
fn read_from<R>(source: &mut R) -> Result<Note, DeserializationError>where
R: ByteReader,
source, attempts to deserialize these bytes
into Self, and returns the result. Read moresource§fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
source§impl<'de> Deserialize<'de> for Note
impl<'de> Deserialize<'de> for Note
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Note, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Note, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl From<&Note> for NoteDetails
impl From<&Note> for NoteDetails
source§fn from(note: &Note) -> NoteDetails
fn from(note: &Note) -> NoteDetails
source§impl From<Note> for InputNoteRecord
impl From<Note> for InputNoteRecord
source§impl From<Note> for NoteDetails
impl From<Note> for NoteDetails
source§fn from(note: Note) -> NoteDetails
fn from(note: Note) -> NoteDetails
source§impl From<Note> for NoteRecordDetails
impl From<Note> for NoteRecordDetails
source§impl From<Note> for OutputNoteRecord
impl From<Note> for OutputNoteRecord
source§impl Serializable for Note
impl Serializable for Note
source§fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
self into bytes and writes these bytes into the target.source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
source§impl Serialize for Note
impl Serialize for Note
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§impl TryFrom<OutputNoteRecord> for Note
impl TryFrom<OutputNoteRecord> for Note
§type Error = ClientError
type Error = ClientError
source§impl TryInto<Note> for InputNoteRecord
impl TryInto<Note> for InputNoteRecord
impl Eq for Note
impl StructuralPartialEq for Note
Auto Trait Implementations§
impl Freeze for Note
impl RefUnwindSafe for Note
impl Send for Note
impl Sync for Note
impl Unpin for Note
impl UnwindSafe for Note
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moresource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more