Struct BlockHeader

The block header which contains a link to the previous block header, unless it's the genesis header.

struct BlockHeader ;

Fields

NameTypeDescription
enrollments Enrollment[]Enrolled validators
height HeightBlock height (genesis is #0)
merkle_root geod24.bitblob.BitBlob!(64L)The hash of the merkle root of the transactions
preimages geod24.bitblob.BitBlob!(64L)[]The pre-images propagated in this block
prev_block geod24.bitblob.BitBlob!(64L)Hash of the previous block in the chain of blocks
signature agora.crypto.Schnorr.SignatureSchnorr multisig of all validators which signed this block
validators agora.common.BitMask.BitMaskBitMask containing the validators' key indices which signed the block

Methods

NameDescription
clone () Create a mutable clone
computeHash (dg) Implements hashing support
randomSeed () Convenience function
sign (secret_key, preimage) Create the block signature for the given keypair
updateSignature (signature, validators)
verify (pubkey, preimage, sig) Verify that the provided signature is a valid signature for pubkey

Example

hashing test

import std.conv : to;
auto address = `boa1xrra39xpg5q9zwhsq6u7pw508z2let6dj8r5lr4q0d0nff240fvd27yme3h`;
PublicKey pubkey = PublicKey.fromString(address);

Output[1] outputs = [ Output(Amount(100), pubkey) ];
Transaction tx = Transaction(outputs[]);
BlockHeader header = { merkle_root : tx.hashFull() };

assert(hashFull(header) != Hash.init);