Skip to content

Block (Sub)types explained

renesq edited this page May 27, 2019 · 3 revisions

With the introduction of state blocks, there is only 1 block type anymore (instead of the 4 that are mentioned in the original RaiBlocks whitepaper).

"State block" means that a block now contains the current state of an account, including the balance and the representative (which was not the case with the now-deprecated block types).

"Universal block" means that the same block type can have different purposes (=subtypes). How the block purpose is determined:

  • subtype send: if balance is smaller than previous block's balance (may still include a representative change). Used to send funds to others.
  • subtype receive: if balance is bigger than previous block's balance (may still include a representative change). Used to integrate incoming funds to the blockchain (they are safe before making this block, but you can only spend them after you made the receiving block)
  • subtype open: if "previous" is zero but doesn't have an epoch link. The first block of a new account. Can only be created if there is at least one pending incoming block, because the link has to be the hash of a pending block.
  • subtype change: if balance is the same as previous block's balance and link is 0. Used to change representatives.
  • subtype epoch: if link is an epoch link. Used to safely upgrade the ledger to the new block version. Only the owner of the genesis private key can create epoch blocks.

The node and wallets will handle most of this for you. You will only have to care about subtypes when you parse callback.