pub trait PoSWScheme<N: Network>: Clone + Send + Sync {
    fn setup<R: Rng + CryptoRng>(
        srs: &mut SRS<'_, R, <<N as Network>::PoSWSNARK as SNARK>::UniversalSetupParameters>
    ) -> Result<Self, PoSWError>;
fn load(is_prover: bool) -> Result<Self, PoSWError>;
fn proving_key(&self) -> &Option<<N::PoSWSNARK as SNARK>::ProvingKey>;
fn verifying_key(&self) -> &<N::PoSWSNARK as SNARK>::VerifyingKey;
fn mine<R: Rng + CryptoRng>(
        &self,
        block_template: &BlockTemplate<N>,
        terminator: &AtomicBool,
        rng: &mut R
    ) -> Result<BlockHeader<N>, PoSWError>;
fn prove_once_unchecked<R: Rng + CryptoRng>(
        &self,
        circuit: &mut PoSWCircuit<N>,
        block_template: &BlockTemplate<N>,
        terminator: &AtomicBool,
        rng: &mut R
    ) -> Result<PoSWProof<N>, PoSWError>;
fn verify_from_block_header(&self, block_header: &BlockHeader<N>) -> bool;
fn verify(
        &self,
        block_height: u32,
        difficulty_target: u64,
        inputs: &[N::InnerScalarField],
        proof: &PoSWProof<N>
    ) -> bool; }

Required methods

Sets up an instance of PoSW using an SRS.

Loads an instance of PoSW using stored parameters.

Returns a reference to the PoSW circuit proving key.

Returns a reference to the PoSW circuit verifying key.

Given the block template, compute a PoSW proof and nonce such that they are under the difficulty target.

Given the block template, compute a PoSW proof. WARNING - This method does not ensure the resulting proof satisfies the difficulty target.

Verifies the Proof of Succinct Work against the nonce, root, and difficulty target.

Verifies the Proof of Succinct Work against the nonce, root, and difficulty target.

Implementors