Parameter Blockchain.3-Block

type block_contents

The user-defined contents of a block.

The type of the block. Application of block_contents to t.

Create a new block.

  • parameter node_id

    the id of the minter

  • parameter block

    the parent block

  • parameter block_contents

    the content for the new block

val null : block_contents -> block

Returns the null block

val height : 'a Simulator.Block.t -> int

Returns the height of a block.

  • parameter block

    a block

val parent : 'a Simulator.Block.t -> Simulator.Block.node_id option

Returns the parent of a block.

  • parameter block

    a block

Returns the id of the node that minted the block.

  • parameter block

    the block whose minter we want

Return the id of a block given block.

  • parameter block

    the block whose id we want

Return the id of a block option. Returns -1 if NONE.

  • parameter block_opt

    SOME(block) or NONE

Return the balances contained in a block.

  • parameter block

    a block

val timestamp : 'a Simulator.Block.t -> Simulator.Clock.t

Return the timestamp of the block's creation.

  • parameter block

    a block

val difficulty : 'a Simulator.Block.t -> int

Return the difficulty of the block.

  • parameter block

    a block

val total_difficulty : 'a Simulator.Block.t -> int

Return the total difficulty of the chain.

  • parameter block

    the head of the chain

val total_coins : 'a Simulator.Block.t -> float

Return the total amount of coins.

  • parameter block

    the head of the chain

val genesis_pow : Simulator.Block.node_id -> int -> block_contents -> block

Return the genesis block for PoW.

  • parameter node_id

    placeholder minter

  • parameter difficulty

    the initial difficulty

  • parameter contents

    the contents to be included in the genesis block

Return the genesis block for PoS.

  • parameter node_id

    placeholder minter

  • parameter contents

    the contents to be included in the genesis block

val equals : 'a Simulator.Block.t -> 'a Simulator.Block.t -> bool

Check if two blocks are equal (have the same ID).

  • parameter block1

    a block

  • parameter block2

    another block