Class Block

java.lang.Object
com.exonum.client.response.Block

public final class Block
extends Object
Exonum block header data structure.

A block is essentially a list of transactions, which is a result of the consensus algorithm (thus authenticated by the supermajority of validators) and is applied atomically to the blockchain state.

This structure only contains the amount of transactions and the transactions root hash as well as other information, but not the transactions themselves.

The JSON representation of this class is compatible with the format used by Exonum.

  • Method Details

    • getCommitTime

      public Optional<ZonedDateTime> getCommitTime()
      Returns the time when the block was committed to the blockchain. The time is equal to the median time of submission of precommit messages confirming this block by the validators.

      Can be empty if include time parameter is not specified in the request.

    • isEmpty

      public final boolean isEmpty()
      Returns true if this block is empty: contains no transactions.
    • builder

      public static Block.BlockBuilder builder()
    • getProposerId

      public int getProposerId()
      Identifier of the leader node which has proposed the block.
    • getHeight

      public long getHeight()
      The height of this block which is a distance between the last block and the "genesis" block. Genesis block has 0 height. Therefore, the blockchain height is equal to the number of blocks plus one.

      The height also identifies each block in the blockchain.

    • getNumTransactions

      public int getNumTransactions()
      Number of transactions in this block.
    • getPreviousBlockHash

      @NonNull public @NonNull HashCode getPreviousBlockHash()
      Hash link to the previous block in the blockchain.
    • getTxRootHash

      @NonNull public @NonNull HashCode getTxRootHash()
      Root hash of the Merkle tree of transactions in this block.
    • getStateHash

      @NonNull public @NonNull HashCode getStateHash()
      Hash of the blockchain state after applying transactions in the block.
    • equals

      public boolean equals​(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object