Blocks

Introduction

This chapter contains all the rules that apply to a block. Miner transactions are included in this section as the rules that apply to them are different to normal transactions.

Index

  1. Block Rules
  2. Difficulty
  3. Weights
  4. Block Reward
  5. Miner Transaction

Block Rules

Block Weight And Size

The block blob must not be bigger than (2 * the effective median weight + 100)1.

The block weight must not be more than 2 * the median weight for coinbase checks2.

Amount Of Transactions

The amount of transactions in a block (including the miner transaction) must be less than 0x100000003.

No Duplicate Transactions

There must be no duplicate transactions in the block or the blockchain4.

Key Images

There must be no duplicate key images in the block5, or the whole chain.

Previous ID

The blocks prev_id must equal the block hash of the last block6.

PoW Function

The proof of work function used depends on the hard-fork7:

hard-forkPoW function
1 to 6CryptoNight v0
7CryptoNight v1
8 to 9CryptoNight v2
10 to 11CryptoNight R
12 onwardsRandomX

For block 202612 always return the same PoW hash, no matter the network8.

PoW hash: 84f64766475d51837ac9efbef1926486e58563c95a19fef4aec3254f03000000

Checking PoW Hash

See checking PoW in the difficulty chapter.

RandomX Seed

The RandomX seed, which is used to set up the dataset, is a previous block hash in the blockchain.

The seed height is 0 if the current height is below or equal to \( 2048 + 64 \) otherwise is got by:

\( seedHeight = (height - 64 - 1) \land \lnot(2048 - 1) \)

with \( \land \) being a bit-and and \( \lnot \) being a bit-not.

You then get the block hash at seedHeight which is then the RandomX seed.9

Version And Vote

The block's major version must equal to the current hard-fork and the vote must be greater than or equal to the current hard-fork10.

Vote is not always the same as the minor version, see here.

Timestamp

The block's timestamp must not be more than the current UNIX time + 2 hours11 and the timestamp must not be less than the median timestamp over the last 60 blocks12, if there are less than 60 blocks in the chain then the timestamp is always valid.