Struct StmInitializer

Source
pub struct StmInitializer {
    pub stake: Stake,
    pub params: Parameters,
    /* private fields */
}
Expand description

Initializer for Signer. This is the data that is used during the key registration procedure. Once the latter is finished, this instance is consumed into an Signer.

Fields§

§stake: Stake

This participant’s stake.

§params: Parameters

Current protocol instantiation parameters.

Implementations§

Source§

impl Initializer

Source

pub fn new<R: RngCore + CryptoRng>( params: Parameters, stake: Stake, rng: &mut R, ) -> Self

Builds an Initializer that is ready to register with the key registration service. This function generates the signing and verification key with a PoP, and initialises the structure.

Source

pub fn setup<R: RngCore + CryptoRng>( params: Parameters, stake: Stake, rng: &mut R, ) -> Self

👎Deprecated since 0.4.9: Use new instead

Builds an Initializer that is ready to register with the key registration service. This function generates the signing and verification key with a PoP, and initialises the structure.

Source

pub fn get_verification_key_proof_of_possession( &self, ) -> VerificationKeyProofOfPossession

Extract the verification key with proof of possession.

Source

pub fn verification_key(&self) -> VerificationKeyProofOfPossession

👎Deprecated since 0.4.9: Use get_verification_key_proof_of_possession instead

Extract the verification key.

Source

pub fn create_signer<D: Digest + Clone + FixedOutput>( self, closed_reg: ClosedKeyRegistration<D>, ) -> Result<Signer<D>, RegisterError>

Build the avk for the given list of parties.

Note that if this Initializer was modified between the last call to register, then the resulting Signer may not be able to produce valid signatures.

Returns an Signer specialized to

  • this Signer’s ID and current stake
  • this Signer’s parameter valuation
  • the avk as built from the current registered parties (according to the registration service)
  • the current total stake (according to the registration service)
§Error

This function fails if the initializer is not registered.

Source

pub fn new_signer<D: Digest + Clone + FixedOutput>( self, closed_reg: ClosedKeyRegistration<D>, ) -> Result<Signer<D>, RegisterError>

👎Deprecated since 0.4.9: Use create_signer instead

Build the avk for the given list of parties.

Note that if this Initializer was modified between the last call to register, then the resulting Signer may not be able to produce valid signatures.

Returns an Signer specialized to

  • this Signer’s ID and current stake
  • this Signer’s parameter valuation
  • the avk as built from the current registered parties (according to the registration service)
  • the current total stake (according to the registration service)
§Error

This function fails if the initializer is not registered.

Source

pub fn create_basic_signer<D: Digest + Clone + FixedOutput>( self, eligible_parties: &[MerkleTreeLeaf], ) -> Option<Signer<D>>

Creates a new basic signer that does not include closed registration. Takes eligible_parties as a parameter and determines the signer’s index in the parties. eligible_parties is verified and trusted which is only run by a full-node that has already verified the parties.

Source

pub fn new_core_signer<D: Digest + Clone + FixedOutput>( self, eligible_parties: &[MerkleTreeLeaf], ) -> Option<Signer<D>>

👎Deprecated since 0.4.9: Use create_basic_signer instead

Creates a new basic signer that does not include closed registration. Takes eligible_parties as a parameter and determines the signer’s index in the parties. eligible_parties is verified and trusted which is only run by a full-node that has already verified the parties.

Source

pub fn to_bytes(&self) -> [u8; 256]

Convert to bytes

§Layout
  • Stake (u64)
  • Params
  • Secret Key
  • Public key (including PoP)
Source

pub fn from_bytes(bytes: &[u8]) -> Result<Initializer, RegisterError>

Convert a slice of bytes to an Initializer

§Error

The function fails if the given string of bytes is not of required size.

Trait Implementations§

Source§

impl Clone for Initializer

Source§

fn clone(&self) -> Initializer

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Initializer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Initializer

Source§

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 Serialize for Initializer

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,