Skip to content

Block

Heart of the blockchain

Blocks are the basic entity of a blockchain. It encodes a set of actions that are executed in a single atomic operation. It also includes the commitment to the state of the application that was changed by the actions included in that block.

Blocks on Stackr

A block in Stackr framework looks like this

block.ts
interface BlockData {
  // header
  appId: number;
  parentHash: string;
  height: number;
  timestamp: number;
  actionRoot: string;
  acknowledgementRoot: string;
  stateRoot: string;
  hooksRoot: string;
  builderSignature: SignatureLike;
  executionStatus: number;
  // body
  hash: string;
  operatorSignature: SignatureLike;
  actions: {
    action: {
      hash: string;
      name: string;
      payload: AllowedInputTypes;
      msgSender: AddressLike;
      signature: SignatureLike;
    };
    acknowledgement: {
      hash: string;
      height: number;
      timestamp: number;
      operatorSignature: SignatureLike;
    };
  }[];
  hooksLogs?: BlockHookLog[];
  batchInfo?: BatchInfo;
}

Block header attributes

  • appId: The application id to which this block belongs to.
  • parentHash: The hash of the parent block.
  • height: The height of the block in the chain.
  • timestamp: The timestamp at which the block was created.
  • actionRoot: The root hash of the actions included in the block.
  • acknowledgementRoot: The root hash of the acknowledgements of the actions included in the block.
  • stateRoot: The root hash of the state after applying the actions in the block.
  • hooksRoot: The root hash of a merkle tree of block hook names executed in the block.
  • builderSignature: The signature of the builder on the block.
  • executionStatus: The status of the block execution. It is an encoded value that represents which action succeeded and which failed.

Block body attributes

  • hash: The hash of the block. This is Keccak-256 of encoded header.
  • operatorSignature: The signature of the operator on the block's hash.
  • actions: The list of actions included in the block along with their acknowledgements.
  • hooksLogs: Logs emitted by the block hooks. Undefined, if block is not yet executed, otherwise an array.
  • batchInfo: Metadata of the batch that includes this block. It is not populated by default and is later fetched from Vulcan (Verification layer).