pub struct VrfParameters {
pub V: AffinePoint,
pub h: Scalar,
pub s: Scalar,
}Expand description
Bundles values given to the smart contract to prove that a ticket is a win.
The VRF is thereby needed because it generates on-demand deterministic entropy that can only be derived by the ticket redeemer.
Fields§
§V: AffinePointthe pseudo-random point
h: Scalar§s: ScalarImplementations§
Source§impl VrfParameters
impl VrfParameters
Sourcepub fn verify<const T: usize>(
&self,
creator: &Address,
msg: &[u8; T],
dst: &[u8],
) -> Result<()>
pub fn verify<const T: usize>( &self, creator: &Address, msg: &[u8; T], dst: &[u8], ) -> Result<()>
Verifies that VRF values are valid. The SC performs the verification. This method is here just to test correctness.
Sourcepub fn get_v_encoded_point(&self) -> EncodedPoint
pub fn get_v_encoded_point(&self) -> EncodedPoint
Returns the encoded VRF V value as an uncompressed point in affine coordinates.
Sourcepub fn get_h_v_witness(&self) -> EncodedPoint
pub fn get_h_v_witness(&self) -> EncodedPoint
Performs a scalar point multiplication of self.h and self.v
and returns the point in affine coordinates.
Used to create the witness values needed by the smart contract.
Sourcepub fn get_s_b_witness<const T: usize>(
&self,
creator: &Address,
msg: &[u8; T],
dst: &[u8],
) -> Result<EncodedPoint>
pub fn get_s_b_witness<const T: usize>( &self, creator: &Address, msg: &[u8; T], dst: &[u8], ) -> Result<EncodedPoint>
Performs a scalar point multiplication with the encoded payload
and self.s. Expands the payload and applies the hash_to_curve
algorithm.
Used to create the witness values needed by the smart contract.
Trait Implementations§
Source§impl BytesEncodable<VRF_PARAMETERS_SIZE> for VrfParameters
impl BytesEncodable<VRF_PARAMETERS_SIZE> for VrfParameters
Source§impl Clone for VrfParameters
impl Clone for VrfParameters
Source§fn clone(&self) -> VrfParameters
fn clone(&self) -> VrfParameters
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more