Struct miden_objects::notes::Nullifier
source · pub struct Nullifier(/* private fields */);Expand description
A note’s nullifier.
A note’s nullifier is computed as hash(serial_num, script_hash, input_hash, asset_hash).
This achieves the following properties:
- Every note can be reduced to a single unique nullifier.
- We cannot derive a note’s hash from its nullifier, or a note’s nullifier from its hash.
- To compute the nullifier we must know all components of the note: serial_num, script_hash, input_hash and asset_hash.
Implementations§
source§impl Nullifier
impl Nullifier
sourcepub fn new(
script_hash: Digest,
inputs_hash: Digest,
asset_hash: Digest,
serial_num: Word
) -> Self
pub fn new( script_hash: Digest, inputs_hash: Digest, asset_hash: Digest, serial_num: Word ) -> Self
Returns a new note Nullifier instantiated from the provided digest.
sourcepub fn as_elements(&self) -> &[Felt]
pub fn as_elements(&self) -> &[Felt]
Returns the elements of this nullifier.
sourcepub fn most_significant_felt(&self) -> Felt
pub fn most_significant_felt(&self) -> Felt
Returns the most significant felt (the last element in array)
sourcepub fn from_hex(hex_value: &str) -> Result<Self, HexParseError>
pub fn from_hex(hex_value: &str) -> Result<Self, HexParseError>
Creates a Nullifier from a hex string. Assumes that the string starts with “0x” and that the hexadecimal characters are big-endian encoded.
Trait Implementations§
source§impl Deserializable for Nullifier
impl Deserializable for Nullifier
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 Nullifier
impl Ord for Nullifier
source§impl PartialEq for Nullifier
impl PartialEq for Nullifier
source§impl PartialOrd for Nullifier
impl PartialOrd for Nullifier
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 Nullifier
impl Serializable for Nullifier
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 Nullifier
impl Eq for Nullifier
impl StructuralPartialEq for Nullifier
Auto Trait Implementations§
impl RefUnwindSafe for Nullifier
impl Send for Nullifier
impl Sync for Nullifier
impl Unpin for Nullifier
impl UnwindSafe for Nullifier
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