Package com.exonum.client.response
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.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Block.BlockBuilder
-
Method Summary
Modifier and Type Method Description static Block.BlockBuilder
builder()
boolean
equals(Object o)
Optional<ZonedDateTime>
getCommitTime()
Returns the time when the block was committed to the blockchain.long
getHeight()
The height of this block which is a distance between the last block and the "genesis" block.int
getNumTransactions()
Number of transactions in this block.@NonNull HashCode
getPreviousBlockHash()
Hash link to the previous block in the blockchain.int
getProposerId()
Identifier of the leader node which has proposed the block.@NonNull HashCode
getStateHash()
Hash of the blockchain state after applying transactions in the block.@NonNull HashCode
getTxRootHash()
Root hash of the Merkle tree of transactions in this block.int
hashCode()
boolean
isEmpty()
Returns true if this block is empty: contains no transactions.String
toString()
-
Method Details
-
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
-
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
Hash link to the previous block in the blockchain. -
getTxRootHash
Root hash of the Merkle tree of transactions in this block. -
getStateHash
Hash of the blockchain state after applying transactions in the block. -
equals
-
hashCode
public int hashCode() -
toString
-