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 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
Source§impl<'de> Deserialize<'de> for VrfParameters
Available on crate feature serde only.
impl<'de> Deserialize<'de> for VrfParameters
serde only.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>,
Source§impl From<VrfParameters> for [u8; 97]
impl From<VrfParameters> for [u8; 97]
Source§fn from(value: VrfParameters) -> Self
fn from(value: VrfParameters) -> Self
Source§impl Serialize for VrfParameters
Available on crate feature serde only.
impl Serialize for VrfParameters
serde only.Source§impl TryFrom<&[u8]> for VrfParameters
impl TryFrom<&[u8]> for VrfParameters
impl Copy 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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