Module Simulator.Block

type node_id = int
type block_id = int
type balances = (node_id * float) list
type block_header = {
id : block_id;(*

id of the block

*)
height : int;(*

height of the block in the chain

*)
minter : node_id;(*

id of the node who minted the block

*)
parent : node_id option;(*

parent of the block

*)
timestamp : Clock.t;(*

timestamp when the block was created

*)
balances : balances;(*

the balance of each node

*)
difficulty : int;(*

difficulty of creating the block

*)
total_difficulty : int;(*

total difficulty of creating the chain up to this block

*)
}

Mandatory information that every block possesses.

type 'a t = {
header : block_header;
contents : 'a;
}

Type of a block: header + user-defined information

val id : 'a t -> block_id
module type BlockRewards = sig ... end

Module that contains the reward function to be called when creating a new block.

module NoRewards : sig ... end

Module for non-varying balances throughout the simulation.

module BaseRewards : sig ... end

Base module for rewarding the minter of a block.

module type BlockSig = sig ... end

The signature for a block module.

module type BlockContent = sig ... end

Wrapper for the type of a block's contents.

Functor for creating the implementation for a Block, given the Logger, BlockContent and BlockRewards modules.