pub struct VrfParameters {
pub V: CurvePoint,
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: CurvePoint
the pseudo-random point
h: Scalar
§s: Scalar
Implementations§
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_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
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for VrfParameters
impl Debug for VrfParameters
Source§impl Default for VrfParameters
impl Default for VrfParameters
Source§fn default() -> VrfParameters
fn default() -> VrfParameters
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for VrfParameters
impl<'de> Deserialize<'de> for VrfParameters
Source§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
Source§impl From<VrfParameters> for [u8; 97]
impl From<VrfParameters> for [u8; 97]
Source§fn from(value: VrfParameters) -> Self
fn from(value: VrfParameters) -> Self
Converts to this type from the input type.
Source§impl Serialize for VrfParameters
impl Serialize for VrfParameters
Auto Trait Implementations§
impl !Freeze for VrfParameters
impl RefUnwindSafe for VrfParameters
impl Send for VrfParameters
impl Sync for VrfParameters
impl Unpin for VrfParameters
impl UnwindSafe for VrfParameters
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
Mutably borrows from an owned value. Read more