pub trait Verifier: Debug + Encode + Decode + Clone {
    type Redeemer: Debug + Encode + Decode;

    // Required method
    fn verify(
        &self,
        simplified_tx: &[u8],
        block_height: u32,
        redeemer: &Self::Redeemer
    ) -> bool;

    // Provided method
    fn new_unspendable() -> Option<Self> { ... }
}
Expand description

A means of checking that an output can be spent. This check is made on a per-output basis and neither knows nor cares anything about the validation logic that will be applied to the transaction as a whole. Nonetheless, in order to avoid malleability, we we take the entire stripped and serialized transaction as a parameter.

Information available when verifying an input includes:

  • The simplified transaction - a stripped encoded version of the transaction
  • Some environmental information such as the block current block number
  • An redeemer supplied by the user attempting to spend the input.

Required Associated Types§

source

type Redeemer: Debug + Encode + Decode

The type that will be supplied to satisfy the verifier and redeem the UTXO.

Required Methods§

source

fn verify( &self, simplified_tx: &[u8], block_height: u32, redeemer: &Self::Redeemer ) -> bool

Main function in the trait. Does the checks to make sure an output can be spent.

Provided Methods§

source

fn new_unspendable() -> Option<Self>

A way to create a new instance of the verifier whose semantics cannot be spent. This may be a signature check with a pubkey of 0 or a hashlock with a hash o 0 or a bitcoin script that directly returns false, etc.

This is only required in chains that use inherents, and thus a default implementation is provided.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Verifier for BlakeTwoHashLock

§

type Redeemer = Vec<u8>

source§

impl Verifier for P2PKH

§

type Redeemer = (CryptoBytes<sp_core::::sr25519::Public::{constant#0}, Sr25519PublicTag>, CryptoBytes<sp_core::::sr25519::Signature::{constant#0}, (SignatureTag, Sr25519Tag)>)

source§

impl Verifier for Sr25519Signature

§

type Redeemer = CryptoBytes<sp_core::::sr25519::Signature::{constant#0}, (SignatureTag, Sr25519Tag)>

source§

impl Verifier for TestVerifier

§

type Redeemer = ()

source§

impl Verifier for ThresholdMultiSignature

§

type Redeemer = Vec<SignatureAndIndex>

source§

impl Verifier for TimeLock

§

type Redeemer = ()

source§

impl Verifier for Unspendable

§

type Redeemer = ()

source§

impl Verifier for UpForGrabs

§

type Redeemer = ()