bitcoin_wire/block

Deserialize, inspect, validate, and serialize Bitcoin blocks.

Types

A Bitcoin block.

A block is a container data structure that aggregates transactions for inclusion in the blockchain.

pub opaque type Block(state)

The result of computing a block’s transaction Merkle root.

pub type ComputedMerkleRoot {
  Mutated(hash256.Hash256)
  NonMutated(hash256.Hash256)
}

Constructors

  • Mutated(hash256.Hash256)

    The tree contained identical hashes in an actual pair before padding.

  • NonMutated(hash256.Hash256)

    The tree did not contain identical hashes in an actual pair before padding.

A violation of Bitcoin consensus rules detected during block validation.

Each variant identifies a specific context-free rule that the block breaks.

pub type ConsensusViolation {
  NoTransactions
  ImpossiblyLargeTransactionCount
  InvalidProofOfWork(reason: ProofOfWorkFailure)
  BaseSizeLimitExceeded(size: Int)
  WeightLimitExceeded(weight: Int)
  MerkleRootMismatch(
    actual: hash256.Hash256,
    expected: hash256.Hash256,
  )
  MutatedMerkleTree
  MissingCoinbase
  UnexpectedCoinbase(index: Int)
  LegacySigOpLimitExceeded(sigop_count: Int)
  InvalidTransaction(
    index: Int,
    violations: List(transaction.ConsensusViolation),
  )
}

Constructors

  • NoTransactions

    The block contains no transactions.

  • ImpossiblyLargeTransactionCount

    The transaction count exceeded the coarse consensus upper bound.

  • InvalidProofOfWork(reason: ProofOfWorkFailure)

    Proof-of-work validation failed under the supplied proof-of-work limit.

    The contained reason identifies whether the header’s compact target is zero, negative, or too large; whether its expanded target exceeds the supplied PowLimit; or whether the header hash exceeds the target. Constructing the PowLimit separately ensures this variant always identifies a failure attributable to the block.

  • BaseSizeLimitExceeded(size: Int)

    The stripped block serialization exceeded the consensus size limit.

    The contained value is the measured base size in bytes. The consensus maximum is 1,000,000 bytes.

  • WeightLimitExceeded(weight: Int)

    The block exceeded the consensus weight limit.

    The contained value is the measured block weight in weight units. The consensus maximum is 4,000,000 weight units.

  • MerkleRootMismatch(
      actual: hash256.Hash256,
      expected: hash256.Hash256,
    )

    The Merkle root recorded in the block header did not match the root computed from the block’s transaction IDs.

    actual is the root recorded in the header and expected is the computed root. Both use wire-order little-endian representation.

  • MutatedMerkleTree

    The transaction Merkle tree contained identical hashes in an actual pair at some level before odd-node padding.

    Duplicating the final unpaired hash during normal Merkle-tree construction does not itself count as mutation.

  • MissingCoinbase

    The transaction at index zero does not have coinbase shape.

    Empty blocks are reported separately as NoTransactions before coinbase placement is checked.

  • UnexpectedCoinbase(index: Int)

    A transaction after index zero has coinbase shape.

    index is the zero-based position of the first unexpected coinbase transaction.

  • LegacySigOpLimitExceeded(sigop_count: Int)

    The block’s legacy signature-operation count exceeded 20,000.

    sigop_count is the unscaled, structural total across all transaction scriptSigs and scriptPubKeys. It excludes witness data; the validator multiplies it by the witness scale factor when enforcing the 80,000 sigop-cost limit.

  • InvalidTransaction(
      index: Int,
      violations: List(transaction.ConsensusViolation),
    )

    A contained transaction failed context-free consensus validation.

    index is the transaction’s zero-based position in the block.

Phantom type indicating a block that has passed the context-free Bitcoin consensus checks performed by validate_context_free_consensus.

This does not indicate full block validity.

pub type ContextFreeValidated =
  @internal ContextFreeValidated

An error that occurred while decoding a Bitcoin block from bytes.

Carries the byte offset where the error occurred, the kind of error, and internal parser-location details used to build the public structural path.

pub opaque type DecodeError

The specific kind of error that occurred during block decoding.

Categorizes decode failures into distinct variants.

pub type DecodeErrorKind {
  NonByteAlignedInput(bit_count: Int)
  UnexpectedEof(bytes_needed: Int, remaining: Int)
  NonMinimalCompactSize(encoded_size: Int, value: Int)
  InsufficientBytes(claimed: Int, remaining: Int)
  IntegerOutOfRange(String)
  TransactionDecodeFailed(transaction.DecodeError)
  PolicyLimitExceeded(
    limit: DecodePolicyLimit,
    value: Int,
    max: Int,
  )
  TrailingBytes(Int)
}

Constructors

  • NonByteAlignedInput(bit_count: Int)

    The input does not contain a whole number of bytes.

    Bitcoin wire-format inputs are byte-aligned. The wrapped value is the exact total number of bits in the supplied input.

  • UnexpectedEof(bytes_needed: Int, remaining: Int)

    The input ended before enough bytes could be read.

    Arguments

    bytes_needed

    The number of bytes the decoder required.

    remaining

    The number of bytes available at that point.

  • NonMinimalCompactSize(encoded_size: Int, value: Int)

    A CompactSize-encoded integer used a non-minimal encoding.

    Bitcoin’s serialization rules require CompactSize integers to use the shortest possible encoding. This error occurs when a value could have been encoded in fewer bytes than were used.

    Arguments

    encoded_size

    The size of the encoded CompactSize in bytes.

    value

    The decoded integer value.

  • InsufficientBytes(claimed: Int, remaining: Int)

    A length or count requires more bytes than remain in the input.

    Unlike UnexpectedEof, which reports a failed read, this error reports a decoded length or count that is known in advance not to fit in the remaining input. This is distinct from PolicyLimitExceeded, which enforces configured resource limits.

    Examples:

    • A transaction count claims one transaction, whose smallest encoding is 10 bytes, but only 9 bytes remain.

    Arguments

    claimed

    The number of bytes required.

    This may be a conservative estimate, such as remaining + 1, rather than the exact requirement to avoid integer overflow on JavaScript.

    remaining

    The number of bytes available.

  • IntegerOutOfRange(String)

    A decoded 64-bit integer value exceeds the range representable by the runtime.

    The original value is preserved as a string for diagnostics.

  • TransactionDecodeFailed(transaction.DecodeError)

    A transaction contained in the block could not be decoded.

    The wrapped transaction decode error preserves the transaction-level failure details. The block decode error’s own offset and context identify where that transaction appears within the block.

  • PolicyLimitExceeded(
      limit: DecodePolicyLimit,
      value: Int,
      max: Int,
    )

    A policy limit was exceeded.

    Arguments

    limit

    The DecodePolicy limit that was violated.

    value

    The measured or decoded quantity that exceeded max.

    max

    The configured maximum.

  • TrailingBytes(Int)

    One block was successfully decoded, but extra bytes remain, so deserialization failed.

    This indicates the input buffer contains more data than a single valid block. The wrapped Int is the count of trailing bytes that were not consumed.

Configuration policy for block decoding limits.

This type controls byte and collection-count limits during block decoding. Callers can configure tighter limits to constrain work and allocation when decoding untrusted inputs.

Limits are enforced during decoding. If a limit is exceeded, decoding fails with PolicyLimitExceeded.

The block-size and transaction-count limits complement one another: one bounds input bytes, while the other bounds the number of transaction decodes. See the corresponding decode_policy_with_* functions for enforcement details.

Builder functions do not validate whether custom limits are useful for decoding consensus-valid blocks. Callers that override default_decode_policy are responsible for choosing sensible values for their use case. Overly strict or unusual values may simply cause decoding to fail with existing decode errors.

See Also

  • default_decode_policy for the default decoding limits
  • deserialize_with_policy to apply a custom policy
pub opaque type DecodePolicy

Identifies the configured DecodePolicy limit that was exceeded.

Carried by PolicyLimitExceeded. Use get_decode_error_path to identify where the violation occurred.

pub type DecodePolicyLimit {
  MaxBlockSize
  MaxTransactionCount
}

Constructors

  • MaxBlockSize

    The maximum input buffer size was exceeded.

    In PolicyLimitExceeded, value is the total byte size of the supplied buffer. This limit is checked before decoding begins.

  • MaxTransactionCount

    The maximum number of transactions was exceeded.

An error that occurred while deserializing a standalone Bitcoin block header from hexadecimal.

Distinguishes failures during hex-to-bytes conversion from an otherwise valid hex string whose decoded bit count is not the fixed header size.

pub type DeserializeHeaderHexError {
  InvalidHeaderHex
  HeaderDecodeFailed(HeaderDecodeError)
}

Constructors

  • InvalidHeaderHex

    The hexadecimal string could not be converted to bytes.

    This occurs for odd-length strings and strings containing non-hexadecimal characters.

  • HeaderDecodeFailed(HeaderDecodeError)

    The decoded bytes did not contain exactly one 80-byte block header.

An error that occurred while deserializing a Bitcoin block from hex.

Distinguishes invalid hexadecimal input from decode policy and block decoding failures.

pub type DeserializeHexError {
  InvalidHex
  DecodeFailed(DecodeError)
}

Constructors

  • InvalidHex

    The hexadecimal string could not be converted to bytes.

    This occurs before any block decoding begins, typically due to an odd-length hex string or the presence of invalid hexadecimal characters.

  • DecodeFailed(DecodeError)

    The input exceeded a decode policy limit or its decoded bytes were not a well-formed Bitcoin block encoding.

    A byte-size policy error can be returned before hex-to-bytes conversion. This wraps a DecodeError containing details about the failure.

A Bitcoin block header.

Its 80-byte wire encoding links to the previous block, records a hash derived from the block’s transactions, and contains the proof-of-work fields.

pub opaque type Header

An error that occurred while deserializing a standalone Bitcoin block header.

A standalone header has a fixed 80-byte representation, so the only possible decoding failure is an input with the wrong bit count.

pub type HeaderDecodeError {
  InvalidHeaderBitCount(actual: Int, expected: Int)
}

Constructors

  • InvalidHeaderBitCount(actual: Int, expected: Int)

    The supplied input did not contain exactly 640 bits.

    This covers inputs that are too short, too long, or not byte-aligned. actual is the supplied bit count and expected is always 640.

Phantom type indicating a block that has been successfully parsed from its canonical Bitcoin wire-format serialization but has not yet been validated against Bitcoin consensus rules.

pub type Parsed =
  @internal Parsed

A nonzero maximum proof-of-work target for a Bitcoin network.

Construct a PowLimit with new_pow_limit before validating blocks. The constructor validates only that its little-endian representation is exactly 32 bytes and nonzero; selecting the correct limit for the intended network remains the caller’s responsibility.

pub opaque type PowLimit

An error that occurred while constructing a PowLimit.

These errors describe only the supplied representation. They do not verify that a limit is appropriate for a particular Bitcoin network.

pub type PowLimitError {
  InvalidBitCount(actual: Int, expected: Int)
  ZeroPowLimit
}

Constructors

  • InvalidBitCount(actual: Int, expected: Int)

    The supplied limit did not contain exactly 256 bits.

    The fields contain the measured and required bit counts, respectively.

  • ZeroPowLimit

    The supplied 32-byte limit represented zero.

The reason a block’s proof-of-work validation failed.

Compact-target construction failures are distinguished from comparisons against the supplied proof-of-work limit and the computed block-header hash.

pub type ProofOfWorkFailure {
  ZeroTarget
  NegativeTarget
  TargetOverflow
  TargetExceedsLimit
  InsufficientWork
}

Constructors

  • ZeroTarget

    The header’s compact target encoding expands to zero.

  • NegativeTarget

    The header’s compact target encoding has a nonzero magnitude with its sign bit set.

  • TargetOverflow

    The header’s compact target encoding expands beyond 256 bits.

  • TargetExceedsLimit

    The expanded target exceeds the supplied PowLimit.

  • InsufficientWork

    The computed block-header hash exceeds the expanded target.

Values

pub fn compute_base_size(block: Block(state)) -> Int

Compute the block’s BIP 141 base size in bytes.

This is the size of the complete stripped block serialization: the 80-byte header, the canonical CompactSize transaction count, and every transaction serialized without its SegWit marker, flag, or witness data.

pub fn compute_block_hash(header: Header) -> hash256.Hash256

Compute the hash that identifies a Bitcoin block from its header.

Returns the double SHA-256 hash of the header’s exact 80-byte wire serialization. The transaction count and transactions are not included in this computation.

The returned hash uses the little-endian byte order carried by previous block hash fields on the Bitcoin wire. This function does not validate the header’s proof of work.

When starting with a complete block, obtain its header with get_header before calling this function.

See Also

  • serialize_header — produces the header serialization being hashed
pub fn compute_merkle_root(
  block: Block(state),
) -> ComputedMerkleRoot

Compute a block’s transaction Merkle root and mutation status.

Leaves are transaction IDs in block order. Parent hashes are produced by double-SHA-256 hashing each adjacent pair, duplicating the final hash when a level contains an odd number of hashes.

The contained root uses the wire-order little-endian representation. An empty transaction list produces a zero-valued NonMutated hash. The result is Mutated when an actual pair at any level contains identical hashes before odd-node padding and NonMutated otherwise.

This function does not compare the computed root with the block header or otherwise validate the block.

pub fn compute_total_size(block: Block(state)) -> Int

Compute the block’s BIP 141 total size in bytes.

This is the byte size of the complete canonical wire serialization produced by serialize, including SegWit marker, flag, and witness data.

pub fn compute_virtual_size(block: Block(state)) -> Int

Compute the block’s virtual size in virtual bytes (vbytes).

A virtual byte is four weight units. The result is the block’s BIP 141 weight divided by four and rounded up. For example, a block weighing 571 weight units has a virtual size of 143 vbytes.

This calculation does not allocate a serialized BitArray or enforce size or weight limits.

pub fn compute_weight(block: Block(state)) -> Int

Compute the block’s BIP 141 weight in weight units.

Weight is calculated as base_size * 3 + total_size. Equivalently, each byte in the stripped serialization contributes four weight units and each byte present only in the complete serialization contributes one.

This function only measures the block; it does not enforce the consensus maximum.

pub fn decode_policy_max_block_size(policy: DecodePolicy) -> Int

Get the maximum serialized block size.

pub fn decode_policy_max_tx_count(policy: DecodePolicy) -> Int

Get the maximum decoded transaction count.

pub fn decode_policy_transaction_policy(
  policy: DecodePolicy,
) -> transaction.DecodePolicy

Get the policy applied to every transaction contained in a block.

pub fn decode_policy_with_max_block_size(
  policy: DecodePolicy,
  max_block_size: Int,
) -> DecodePolicy

Return a policy with a custom maximum serialized block size.

For byte-aligned input, this limit is checked before decoding begins. It provides the absolute byte envelope for the block and all contained transactions. Because every structurally decodable transaction occupies at least ten bytes, it also provides an absolute bound on transaction-list allocation.

pub fn decode_policy_with_max_tx_count(
  policy: DecodePolicy,
  max_tx_count: Int,
) -> DecodePolicy

Return a policy with a custom maximum transaction count.

After the decoded count has been checked against the bytes remaining in the input, this limit is enforced before any contained transaction is decoded. It bounds transaction parsing and list allocation more tightly than the block-size limit alone, providing fail-fast protection against inputs with many small, consensus-invalid transactions.

pub fn decode_policy_with_transaction_policy(
  policy: DecodePolicy,
  transaction_policy: transaction.DecodePolicy,
) -> DecodePolicy

Return a policy with custom limits for every contained transaction.

The maximum serialized transaction size configured on the transaction policy is ignored during block decoding. The block’s maximum serialized size remains the only byte-envelope limit for the block and all of its contained transactions.

pub fn default_decode_policy() -> DecodePolicy

The default block decoding policy.

Provides permissive limits, applied automatically when using deserialize or deserialize_hex. They indirectly bound heap usage during binary decoding by limiting serialized size and collection counts. Callers with stricter resource budgets can configure lower limits.

By default, decoding accepts serialized blocks up to 4,000,000 bytes and transaction counts up to 20,000. Each contained transaction has limits of 100,000 inputs, 125,000 outputs, and 4,000,000 witness items in total across its input stacks.

These defaults cover canonical encodings of consensus-valid blocks within Bitcoin’s 4,000,000-weight-unit block limit. Consensus validation is separate.

pub fn deserialize(
  bytes: BitArray,
) -> Result(Block(Parsed), DecodeError)

Deserialize a Bitcoin block from its canonical Bitcoin wire-format serialization.

This is the standard entry point for converting a complete serialized Bitcoin block into a typed value. The entire input must contain exactly one block; trailing bytes are rejected.

This function applies the permissive default_decode_policy limits on block size, transaction count, and each transaction’s collection counts.

For custom resource limits, use deserialize_with_policy instead.

The returned block is marked as Parsed, meaning its structure was successfully parsed but it has not yet been checked against Bitcoin consensus rules.

Returns

  • Ok(Block(Parsed)): Successfully deserialized within the default policy limits.
  • Error(DecodeError): The bytes were not a well-formed block encoding within the default policy limits.
pub fn deserialize_header(
  bytes: BitArray,
) -> Result(Header, HeaderDecodeError)

Deserialize exactly one Bitcoin block header from its 80-byte wire form.

The supplied BitArray must contain exactly 640 bits. Inputs that are too short, too long, or not byte-aligned return InvalidHeaderBitCount.

A successfully decoded header exposes its fixed-width wire fields but has not had its proof of work, parent relationship, or any chain-level property validated.

pub fn deserialize_header_hex(
  hex: String,
) -> Result(Header, DeserializeHeaderHexError)

Deserialize exactly one Bitcoin block header from hexadecimal.

Hexadecimal conversion happens before header decoding. Invalid or odd-length hexadecimal strings return InvalidHeaderHex. Valid hexadecimal strings that do not decode to exactly 80 bytes return HeaderDecodeFailed.

pub fn deserialize_hex(
  hex: String,
) -> Result(Block(Parsed), DeserializeHexError)

Deserialize a Bitcoin block from its hexadecimal string representation.

This is a convenience function that combines hex-to-bytes conversion with block deserialization. It’s useful when working with block data in hexadecimal format, such as from block explorers, RPC responses, or test vectors.

This function applies default_decode_policy for resource limits. For custom resource limits, use deserialize_hex_with_policy instead.

Valid hex that exceeds the byte-size limit is rejected before conversion. Invalid hex takes precedence, including for oversized input. Checking an oversized string’s characters still requires work proportional to its length.

Returns

  • Ok(Block(Parsed)): Successfully deserialized within the default policy limits.
  • Error(InvalidHex): The hex string was invalid (odd length or invalid characters).
  • Error(DecodeFailed(error)): The decoded bytes were not a well-formed block encoding within the default policy limits.
pub fn deserialize_hex_with_policy(
  hex: String,
  policy: DecodePolicy,
) -> Result(Block(Parsed), DeserializeHexError)

Deserialize a Bitcoin block from hexadecimal with custom resource limits.

This function combines hex-to-bytes conversion with policy-based block deserialization, providing both the convenience of hexadecimal input and fine-grained control over resource limits. Use this when working with hex-encoded block data that requires custom resource constraints.

Valid hex that exceeds the byte-size limit is rejected before conversion. Invalid hex takes precedence, including for oversized input. Checking an oversized string’s characters still requires work proportional to its length.

Returns

  • Ok(Block(Parsed)): Successfully deserialized within the supplied policy limits.
  • Error(InvalidHex): The hex string was invalid (odd length or invalid characters).
  • Error(DecodeFailed(error)): The decoded bytes were not a well-formed block encoding within the supplied policy limits.
pub fn deserialize_with_policy(
  bytes: BitArray,
  policy: DecodePolicy,
) -> Result(Block(Parsed), DecodeError)

Deserialize a Bitcoin block with custom resource limits.

Like deserialize, but accepts a DecodePolicy to override the resource limits applied during decoding. Use default_decode_policy and the decode_policy_with_* builder functions to construct custom policies. Byte alignment is validated before resource limits. For byte-aligned inputs, limits that are exceeded produce a PolicyLimitExceeded error. See DecodePolicy and default_decode_policy for available options and defaults.

Returns

  • Ok(Block(Parsed)): Successfully deserialized within the supplied policy limits.
  • Error(DecodeError): The bytes were not a well-formed block encoding within the supplied policy limits.
pub fn get_decode_error_kind(err: DecodeError) -> DecodeErrorKind

Get the specific kind of block decoding error that occurred.

pub fn get_decode_error_offset(err: DecodeError) -> Int

Get the byte offset where a block decoding error occurred.

pub fn get_decode_error_path(err: DecodeError) -> String

Get the structural path where a block decoding error occurred.

Paths are rooted at block, and transaction indices are zero-based. For example, a truncated nonce is reported at block.header.nonce, while an error starting the third transaction is reported at block.transactions[2]. When the kind is TransactionDecodeFailed, inspect the wrapped transaction error for its path within that transaction.

pub fn get_header(block: Block(state)) -> Header

Get the header from a block.

Returns the 80-byte header that precedes the transaction count and transactions in the block wire encoding.

pub fn get_header_merkle_root(header: Header) -> hash256.Hash256

Get the transaction Merkle root from a block header.

The hash uses the same little-endian byte order found on the Bitcoin wire.

pub fn get_header_nonce(header: Header) -> Int

Get the unsigned 32-bit nonce from a block header.

The nonce is returned in the range 0 through 4_294_967_295. This function exposes the encoded value without validating the header’s proof of work.

pub fn get_header_previous_block_hash(
  header: Header,
) -> hash256.Hash256

Get the previous block header hash.

The hash uses the same little-endian byte order found on the Bitcoin wire.

pub fn get_header_target(header: Header) -> Int

Get the unsigned 32-bit compact target encoding (nBits) from a block header.

Returns the raw compact encoding in the range 0 through 4_294_967_295. This function does not expand nBits into a full target or validate the header’s proof of work.

pub fn get_header_timestamp(header: Header) -> Int

Get the unsigned 32-bit timestamp from a block header.

The value is the number of seconds since the Unix epoch recorded in the header. It is returned in the range 0 through 4_294_967_295.

pub fn get_header_version(header: Header) -> Int

Get the signed 32-bit version from a block header.

The version is encoded as four little-endian bytes in the block wire format. This function interprets those bytes as a signed integer, so ff ff ff ff is returned as -1.

pub fn get_transaction_count(block: Block(state)) -> Int

Get the number of transactions in a block.

Returns the decoded CompactSize transaction count from the block wire encoding.

pub fn get_transactions(
  block: Block(state),
) -> List(transaction.Transaction(state))

Get the transactions from a block.

Returns transactions in the same order they appear in the block wire encoding.

pub fn new_pow_limit(
  bytes: BitArray,
) -> Result(PowLimit, PowLimitError)

Construct a proof-of-work limit from 32 little-endian bytes.

The bytes must represent a nonzero unsigned 256-bit value. This validates only the representation; callers remain responsible for selecting the correct proof-of-work limit for the network whose blocks they validate.

pub fn serialize(block: Block(state)) -> BitArray

Serialize a block in its complete Bitcoin wire form.

Returns the 80-byte header followed by the minimal CompactSize transaction count and each transaction’s full wire serialization in block order. SegWit transactions include their marker, flag, and witness data.

See Also

  • serialize_header — serializes only the fixed-size block header
pub fn serialize_header(header: Header) -> BitArray

Serialize a block header in its 80-byte Bitcoin wire form.

Returns the signed version, previous block hash, merkle root, timestamp, compact target, and nonce in their wire order. Integer fields are encoded little-endian, while both hashes retain their existing wire-order bytes.

See Also

  • compute_block_hash — hashes this serialization to identify the block
  • serialize — serializes the header and the block’s transactions
pub fn validate_context_free_consensus(
  block: Block(Parsed),
  pow_limit: PowLimit,
) -> Result(Block(ContextFreeValidated), List(ConsensusViolation))

Validate a block against context-free Bitcoin consensus rules.

“Context-free” means these checks require only the block, its contained transactions, and the static proof-of-work limit supplied by the caller. No preceding headers, UTXO set, block height, or activation state is used.

pow_limit must be constructed with new_pow_limit from the network’s nonzero maximum proof-of-work target in little-endian order. Construction validates only the representation, so selecting the correct network limit remains the caller’s responsibility.

The following rules are enforced:

  • The compact target is valid, does not exceed pow_limit, and is satisfied by the block-header hash
  • The block contains at least one transaction and satisfies the transaction-count, stripped-size, and weight limits
  • The header Merkle root matches the transaction IDs and the Merkle tree is not mutated
  • The first transaction has coinbase shape and no later transaction does
  • The block does not exceed the legacy signature-operation limit
  • Every contained transaction passes its context-free consensus checks

This function does not determine the target required by preceding headers, evaluate timestamp or transaction-finality rules, enforce activation-based rules such as the BIP34 coinbase height or SegWit witness commitment, or perform UTXO lookup, script execution, signature verification, fee, or subsidy checks. Signet block-solution validation is outside this function’s scope.

Proof-of-work and block-size violations fail immediately and are returned as a single-element list. After those checks pass, independent block-level and transaction-level violations are collected in deterministic validation and wire order.

Returns Ok(Block(ContextFreeValidated)) when the block and every contained transaction pass these checks, or Error(violations) otherwise.

✨ Search Document