2020-07-26 10:34:58 -07:00
|
|
|
|
//! Sapling notes
|
2020-07-24 17:57:52 -07:00
|
|
|
|
|
2020-07-09 01:20:20 -07:00
|
|
|
|
#![allow(clippy::unit_arg)]
|
2020-05-26 18:00:58 -07:00
|
|
|
|
#![allow(dead_code)]
|
2020-04-19 11:45:25 -07:00
|
|
|
|
|
2020-02-10 15:17:41 -08:00
|
|
|
|
#[cfg(test)]
|
2020-07-15 01:50:05 -07:00
|
|
|
|
mod arbitrary;
|
|
|
|
|
mod ciphertexts;
|
|
|
|
|
mod nullifiers;
|
2020-02-10 15:17:41 -08:00
|
|
|
|
|
2020-07-09 01:20:20 -07:00
|
|
|
|
use crate::{
|
2020-08-14 23:15:36 -07:00
|
|
|
|
amount::{Amount, NonNegative},
|
2020-07-27 16:02:33 -07:00
|
|
|
|
commitments::sapling::CommitmentRandomness,
|
2020-07-22 19:03:42 -07:00
|
|
|
|
keys::sapling::{Diversifier, TransmissionKey},
|
2020-07-15 01:50:05 -07:00
|
|
|
|
notes::memo::Memo,
|
2020-07-09 01:20:20 -07:00
|
|
|
|
};
|
|
|
|
|
|
2020-07-15 01:50:05 -07:00
|
|
|
|
pub use ciphertexts::{EncryptedCiphertext, OutCiphertext};
|
2020-07-27 16:02:33 -07:00
|
|
|
|
|
2020-07-15 01:50:05 -07:00
|
|
|
|
pub use nullifiers::Nullifier;
|
2020-07-09 18:20:50 -07:00
|
|
|
|
|
2020-07-09 01:20:20 -07:00
|
|
|
|
/// A Note represents that a value is spendable by the recipient who
|
|
|
|
|
/// holds the spending key corresponding to a given shielded payment
|
|
|
|
|
/// address.
|
2020-02-21 16:35:24 -08:00
|
|
|
|
pub struct Note {
|
2020-08-05 16:06:51 -07:00
|
|
|
|
/// The diversifer of the recipient’s shielded payment address.
|
2020-07-27 16:02:33 -07:00
|
|
|
|
pub diversifier: Diversifier,
|
2020-08-05 16:00:53 -07:00
|
|
|
|
/// The diversified transmission key of the recipient’s shielded
|
2020-07-27 16:02:33 -07:00
|
|
|
|
/// payment address.
|
|
|
|
|
pub transmission_key: TransmissionKey,
|
|
|
|
|
/// An integer representing the value of the note in zatoshi.
|
|
|
|
|
pub value: Amount<NonNegative>,
|
|
|
|
|
/// A random commitment trapdoor used to produce the associated
|
|
|
|
|
/// note commitment.
|
|
|
|
|
pub rcm: CommitmentRandomness,
|
2020-07-13 15:38:49 -07:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-22 15:22:28 -08:00
|
|
|
|
/// The decrypted form of encrypted Sapling notes on the blockchain.
|
2020-02-21 16:35:24 -08:00
|
|
|
|
pub struct NotePlaintext {
|
|
|
|
|
diversifier: Diversifier,
|
2020-07-09 18:20:50 -07:00
|
|
|
|
value: Amount<NonNegative>,
|
2020-07-14 01:56:53 -07:00
|
|
|
|
rcm: CommitmentRandomness,
|
2020-07-15 01:50:05 -07:00
|
|
|
|
memo: Memo,
|
2020-02-10 15:17:41 -08:00
|
|
|
|
}
|