Block Structure and Validation

Block Header

Nakamoto utilizes tenure changes as a consensus critical artifact that links sortitions to the chosen miner as well as removes the support for microblocks. As such, the following is the updated block header to support the features in this proposal and remove support for those being deprecated:

The Nakamoto block header wire format is as follows.

NameDescriptionRepresentation

version

Version number to describe how to validate the block.

1 byte

chain length

The total number of StacksBlock and NakamotoBlocks preceding this block in this block's history.

8 bytes, big-endian

burn spent

Total amount of BTC spent producing the sortition that selected the miner whose tenure produced this block.

8 bytes, big-endian

consensus hash

The consensus hash of the burnchain block that selected this tenure. The consensus hash uniquely identifies this tenure, including across all Bitcoin forks.

20 bytes

parent block ID

The index block hash of the immediate parent of this block. This is the hash of the parent block's hash and consensus hash.

32 bytes

transaction Merkle root

The SHA512/256 root hash of the binary Merkle tree calculated over the sequence of transactions in this block.

32 bytes

state index Merkle root

The SHA512/256 root hash of the MARF once all of the contained transactions are processed.

32 bytes

miner signature

Recoverable ECDSA signature from the tenure's miner.

65 bytes

stacker signature

A Schnorr signature collectively generated by the set of Stackers over this block

65 bytes

Total bytes: 275

Absent from this header is the VRF proof, because it only needs to be included once per tenure. Instead, this information will be put into the updated Nakamoto Coinbase transaction, which has a different wire format than the current Coinbase transaction.

Maximum Block Size

The limit on Stacks block size is 16 MB.

The 16 MB limit is the largest-allowed network message size (in bytes, as it is encoded on the wire). If you mine a block that is 16.001 MB and try to broadcast it or serve it, no one will be able to receive or download it.

New Block Validation Rules

In Nakamoto, a block is valid if and only if the following are true:

  • The block is well-formed

    • It has the correct version and mainnet/testnet flag

    • (NEW) Its header contains the right number of Stacks blocks preceding this one.

    • (NEW) Its header contains the correct total Bitcoin spent in the sortition that elected the current tenure.

    • (NEW) Its header contains the same Bitcoin block hash as the Bitcoin block that contains its tenure's block-commit transaction

    • Its header contains the correct parent block ID of the immediate parent of this block.

    • The transaction Merkle tree root is consistent with the transactions

    • The state root hash matches the MARF tip root hash once all transactions are applied

    • (NEW) the block header has a valid ECDSA signature from the miner

    • (NEW) the block header has a valid WSTS Schnorr signature from the set of Stackers

  • (NEW) All Bitcoin transactions since the last valid sortition up to (but not including) this tenure's block-commit’s Bitcoin block have been applied to the Stacks chain state

  • In the case of a tenure start block:

    • (NEW) The first transaction is the TenureChange transaction.

    • (NEW) The first transaction after the TenureChange transaction is a Coinbase.

  • All transactions either run to completion, or fail due to runtime errors. That is:

    • The transaction is well-formed

    • All transactions' senders and sponsors are able to pay the transaction fee

    • The runtime budget for the tenure is not exceeded

    • (NEW) The total runtime budget is equal to the runtime budget for one tenure, multiplied by the number of valid TenureExtension transactions mined in this tenure.

    • No expression exceeds the maximum nesting depth

    • No supertype is too large

    • (NEW) The PoisonMicroblock transaction variant is no longer supported

    • (NEW) The current Coinbase transaction variant is no longer supported

In addition to the new TenureChange transaction, Nakamoto changes coinbase transactions to include VRF proof for the current tenure. As stated above, the existing Coinbase transaction variant is no longer supported.

Last updated