Struct sn_dbc::DbcContent [−][src]
pub struct DbcContent { pub parents: BTreeSet<Hash>, pub amount_secrets_cipher: Ciphertext, pub commitment: CompressedRistretto, pub range_proof_bytes: Vec<u8>, pub owner: BlindedOwner, }
Fields
parents: BTreeSet<Hash>
amount_secrets_cipher: Ciphertext
commitment: CompressedRistretto
range_proof_bytes: Vec<u8>
owner: BlindedOwner
Implementations
Represents the content of a DBC.
pub fn new(
parents: BTreeSet<Hash>,
amount: u64,
owner_key: PublicKey,
blinding_factor: Scalar
) -> Result<Self, Error>
pub fn amount_secret_by_secret_key(
&self,
secret_key: &SecretKey
) -> Result<AmountSecrets, Error>
pub fn amount_secret_by_secret_key(
&self,
secret_key: &SecretKey
) -> Result<AmountSecrets, Error>
Decrypt AmountSecrets using a SecretKey
pub fn amount_secrets_by_secret_key_set(
&self,
secret_key_set: &SecretKeySet
) -> Result<AmountSecrets, Error>
pub fn amount_secrets_by_secret_key_set(
&self,
secret_key_set: &SecretKeySet
) -> Result<AmountSecrets, Error>
Decrypt AmountSecrets using a SecretKeySet
Decrypt AmountSecrets using threshold+1 SecretKeyShares
Decrypt AmountSecrets using threshold+1 DecryptionShares
This fn should be used when keys (SecretKeyShare) are distributed across multiple parties. In which case each party will need to call SecretKeyShare::decrypt_share() or decrypt_share_no_verify() to generate a DecryptionShare and one party will need to obtain/aggregate all the shares together somehow.
Verifies range proof, ie that the committed amount is a non-negative u64.
pub fn confirm_amount_matches_commitment(
&self,
public_key_set: &PublicKeySet,
decryption_shares: &BTreeMap<usize, DecryptionShare>
) -> Result<bool, Error>
pub fn confirm_amount_matches_commitment(
&self,
public_key_set: &PublicKeySet,
decryption_shares: &BTreeMap<usize, DecryptionShare>
) -> Result<bool, Error>
Checks if the secret (encrypted) amount matches the amount commitment. returns true if they match, false if not, or an error if decryption fails.
Checks if the provided AmountSecrets matches the amount commitment. note that both the amount and blinding_factor must be correct.
Calculates the blinding factor for the next output, typically used inside a loop.
is_last: must be true if this is the last output, else false. inputs_bf_sum: sum of blinding factors for all transaction inputs. outputs_bf_sum: sum of blinding factors for preceding transaction outputs.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for DbcContent
impl Send for DbcContent
impl Sync for DbcContent
impl Unpin for DbcContent
impl UnwindSafe for DbcContent
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self