pub struct Payment {Show 13 fields
pub kappa: G2Projective,
pub kappa_e: G2Projective,
pub sig: Signature,
pub sig_exp: Signature,
pub kappa_k: Vec<G2Projective>,
pub omega: Vec<Signature>,
pub ss: Vec<G1Projective>,
pub tt: Vec<G1Projective>,
pub aa: Vec<G1Projective>,
pub spend_value: u64,
pub cc: G1Projective,
pub t_type: u8,
pub zk_proof: SpendProof,
}Fields§
§kappa: G2Projective§kappa_e: G2Projective§sig: Signature§sig_exp: Signature§kappa_k: Vec<G2Projective>§omega: Vec<Signature>§ss: Vec<G1Projective>§tt: Vec<G1Projective>§aa: Vec<G1Projective>§spend_value: u64§cc: G1Projective§t_type: u8§zk_proof: SpendProofImplementations§
Source§impl Payment
impl Payment
Sourcepub fn check_signature_validity(
&self,
verification_key: &VerificationKeyAuth,
) -> Result<(), CompactEcashError>
pub fn check_signature_validity( &self, verification_key: &VerificationKeyAuth, ) -> Result<(), CompactEcashError>
Checks the validity of the payment signature.
This function performs two checks to ensure the payment signature is valid:
- Verifies that the element
hof the payment signature does not equal the identity. - Performs a bilinear pairing check involving the elements of the signature and the payment (
h,kappa, ands).
§Arguments
params- A reference to the system parameters required for the checks.
§Returns
A Result indicating success if the signature is valid or an error if any check fails.
§Errors
An error is returned if:
- The element
hof the payment signature equals the identity. - The bilinear pairing check for
kappafails.
Sourcepub fn check_exp_signature_validity(
&self,
verification_key: &VerificationKeyAuth,
spend_date: Scalar,
) -> Result<(), CompactEcashError>
pub fn check_exp_signature_validity( &self, verification_key: &VerificationKeyAuth, spend_date: Scalar, ) -> Result<(), CompactEcashError>
Checks the validity of the expiration signature encoded in the payment given a spending date. If the spending date is within the allowed range before the expiration date, the check is successful.
This function performs two checks to ensure the payment expiration signature is valid:
- Verifies that the element
hof the expiration signature does not equal the identity. - Performs a bilinear pairing check involving the elements of the expiration signature and the payment (
h,kappa_e, ands).
§Arguments
verification_key- The global verification key of the signing authorities.spend_date- The date associated with the payment.
§Returns
A Result indicating success if the expiration signature is valid or an error if any check fails.
§Errors
An error is returned if:
- The element
hof the payment expiration signature equals the identity. - The bilinear pairing check for
kappa_efails.
Sourcepub fn no_duplicate_serial_numbers(&self) -> Result<(), CompactEcashError>
pub fn no_duplicate_serial_numbers(&self) -> Result<(), CompactEcashError>
Checks that all serial numbers in the payment are unique.
This function verifies that each serial number in the payment’s serial number array (ss) is unique.
§Returns
A Result indicating success if all serial numbers are unique or an error if any serial number is duplicated.
§Errors
An error is returned if not all serial numbers in the payment are unique.
Sourcepub fn batch_check_coin_index_signatures(
&self,
verification_key: &VerificationKeyAuth,
) -> Result<(), CompactEcashError>
pub fn batch_check_coin_index_signatures( &self, verification_key: &VerificationKeyAuth, ) -> Result<(), CompactEcashError>
Checks the validity of all coin index signatures available.
Sourcepub fn verify_spend_proof(
&self,
verification_key: &VerificationKeyAuth,
pay_info: &PayInfo,
) -> Result<(), CompactEcashError>
pub fn verify_spend_proof( &self, verification_key: &VerificationKeyAuth, pay_info: &PayInfo, ) -> Result<(), CompactEcashError>
Checks the validity of the attached zk proof of spending.
Sourcepub fn spend_verify(
&self,
verification_key: &VerificationKeyAuth,
pay_info: &PayInfo,
spend_date: u32,
) -> Result<(), CompactEcashError>
pub fn spend_verify( &self, verification_key: &VerificationKeyAuth, pay_info: &PayInfo, spend_date: u32, ) -> Result<(), CompactEcashError>
Verifies the validity of a spend transaction, including signature checks, expiration date signature checks, serial number uniqueness, coin index signature checks, and zero-knowledge proof verification.
§Arguments
params- The cryptographic parameters.verification_key- The verification key used for validation.pay_info- The pay information associated with the transaction.spend_date- The date at which the spending transaction occurs.
§Returns
Returns Ok(true) if the spend transaction is valid; otherwise, returns an error.
pub fn encoded_serial_number(&self) -> Vec<u8> ⓘ
pub fn serial_number_bs58(&self) -> String
Trait Implementations§
Source§impl Bytable for Payment
impl Bytable for Payment
fn to_byte_vec(&self) -> Vec<u8> ⓘ
fn try_from_byte_slice(slice: &[u8]) -> Result<Payment, CompactEcashError>
Source§impl<'de> Deserialize<'de> for Payment
impl<'de> Deserialize<'de> for Payment
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Payment, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Payment, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Payment
impl Serialize for Payment
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Payment
Auto Trait Implementations§
impl Freeze for Payment
impl RefUnwindSafe for Payment
impl Send for Payment
impl Sync for Payment
impl Unpin for Payment
impl UnsafeUnpin for Payment
impl UnwindSafe for Payment
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more