Struct phoenix_core::note::Note [−][src]
pub struct Note { /* fields omitted */ }
Expand description
A note that does not encrypt its value
Implementations
pub fn new<R: RngCore + CryptoRng>(
rng: &mut R,
note_type: NoteType,
psk: &PublicSpendKey,
value: u64,
blinding_factor: JubJubScalar
) -> Self
pub fn new<R: RngCore + CryptoRng>(
rng: &mut R,
note_type: NoteType,
psk: &PublicSpendKey,
value: u64,
blinding_factor: JubJubScalar
) -> Self
Creates a new phoenix output note
pub fn transparent<R: RngCore + CryptoRng>(
rng: &mut R,
psk: &PublicSpendKey,
value: u64
) -> Self
pub fn transparent<R: RngCore + CryptoRng>(
rng: &mut R,
psk: &PublicSpendKey,
value: u64
) -> Self
Creates a new transparent note
The blinding factor will be constant zero since the value commitment exists only to shield the value. The value is not hidden for transparent notes, so this can be trivially treated as a constant.
pub fn obfuscated<R: RngCore + CryptoRng>(
rng: &mut R,
psk: &PublicSpendKey,
value: u64,
blinding_factor: JubJubScalar
) -> Self
pub fn obfuscated<R: RngCore + CryptoRng>(
rng: &mut R,
psk: &PublicSpendKey,
value: u64,
blinding_factor: JubJubScalar
) -> Self
Creates a new obfuscated note
The provided blinding factor will be used to calculate the value commitment of the note. The tuple (value, blinding_factor), known by the caller of this function, must be later used to prove the knowledge of the value commitment of this note.
pub fn deterministic(
note_type: NoteType,
r: &JubJubScalar,
nonce: BlsScalar,
psk: &PublicSpendKey,
value: u64,
blinding_factor: JubJubScalar
) -> Self
pub fn deterministic(
note_type: NoteType,
r: &JubJubScalar,
nonce: BlsScalar,
psk: &PublicSpendKey,
value: u64,
blinding_factor: JubJubScalar
) -> Self
Create a new phoenix output note without inner randomness
Create a unique nullifier for the note
This nullifier is represeted as H(sk_r · G', pos)
Return the internal representation of scalars to be hashed
Return a hash represented by `H(note_type, value_commitment, H(StealthAddress), pos, encrypted_data)
Set the position of the note on the tree. This, naturally, won’t reflect immediatelly on the data storage
Nonce used for the encrypt / decrypt of data for this note
Return the value commitment H(value, blinding_factor)
Attempt to decrypt the note value provided a ViewKey
. Always
succeeds for transparent notes, might fails or return random values for
obfuscated notes if the provided view key is wrong.
Decrypt the blinding factor with the provided ViewKey
If the decrypt fails, a random value is returned
Trait Implementations
Returns the associated StealthAddress
Attempts to convert a byte representation of a note into a Note
,
failing if the input is invalid
type Error = BytesError
type Error = BytesError
The type returned in the event of a conversion error.
Auto Trait Implementations
impl RefUnwindSafe for Note
impl UnwindSafe for Note
Blanket Implementations
Mutably borrows from an owned value. Read more
fn from_hex_str(s: &str) -> Result<Self, Self::Error> where
Self::Error: BadLength,
Self::Error: InvalidChar,
fn from_hex_str(s: &str) -> Result<Self, Self::Error> where
Self::Error: BadLength,
Self::Error: InvalidChar,
Parse a string slice as bytes hex representation and returns `