Skip to main content

BlockSigner

Trait BlockSigner 

Source
pub trait BlockSigner {
    // Required method
    fn sign_block(
        &self,
        header_hash: &Bytes32,
    ) -> Result<Signature, SignerError>;
}
Expand description

Block header signing hook for [crate::builder::BlockBuilder::build] (SPEC §7.2, BLD-006).

The proposer calls sign_block(&header_hash) at the end of the build pipeline to produce the BLS signature stored in crate::L2Block::proposer_signature.

§Object safety

Same constraints as CoinLookup&self, no generics, returns concrete types. Box<dyn BlockSigner> is valid for dependency injection.

§Chia parity

Signing uses chia-bls::sign(secret_key, message) internally. The message is the header hash bytes (Bytes32::as_ref()&[u8; 32]), matching the pattern in chia-blockchain/chia/consensus/block_creation.py where the farmer signs the header hash.

Required Methods§

Source

fn sign_block(&self, header_hash: &Bytes32) -> Result<Signature, SignerError>

Sign the given block header hash, producing a BLS12-381 signature.

Returns SignerError if the key is unavailable or the signing backend fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§