Struct miden_objects::notes::NoteId
source · pub struct NoteId(/* private fields */);Expand description
Returns a unique identifier of a note, which is simultaneously a commitment to the note.
Note ID is computed as:
hash(recipient, asset_hash),
where recipient is defined as:
hash(hash(hash(serial_num, [0; 4]), script_hash), input_hash)
This achieves the following properties:
- Every note can be reduced to a single unique ID.
- To compute a note ID, we do not need to know the note’s serial_num. Knowing the hash of the serial_num (as well as script hash, input hash, and note assets) is sufficient.
Implementations§
source§impl NoteId
impl NoteId
source§impl NoteId
impl NoteId
sourcepub fn try_from_hex(hex_value: &str) -> Result<NoteId, HexParseError>
pub fn try_from_hex(hex_value: &str) -> Result<NoteId, HexParseError>
Attempts to convert from a hexadecimal string to NoteId.
Trait Implementations§
source§impl Deserializable for NoteId
impl Deserializable for NoteId
source§fn read_from<R: ByteReader>(
source: &mut R
) -> Result<Self, DeserializationError>
fn read_from<R: ByteReader>( source: &mut R ) -> Result<Self, DeserializationError>
Reads a sequence of bytes from the provided
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 Ord for NoteId
impl Ord for NoteId
source§impl PartialEq for NoteId
impl PartialEq for NoteId
source§impl PartialOrd for NoteId
impl PartialOrd for NoteId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl Serializable for NoteId
impl Serializable for NoteId
source§fn write_into<W: ByteWriter>(&self, target: &mut W)
fn write_into<W: ByteWriter>(&self, target: &mut W)
Serializes
self into bytes and writes these bytes into the target.source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
Returns an estimate of how many bytes are needed to represent self. Read more
impl Copy for NoteId
impl Eq for NoteId
impl StructuralPartialEq for NoteId
Auto Trait Implementations§
impl RefUnwindSafe for NoteId
impl Send for NoteId
impl Sync for NoteId
impl Unpin for NoteId
impl UnwindSafe for NoteId
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
Mutably borrows from an owned value. Read more