Package com.exonum.binding.blockchain
Class Block
- java.lang.Object
-
- com.exonum.binding.blockchain.Block
-
public abstract class Block extends java.lang.ObjectExonum 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.
- See Also:
Blockchain
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBlock.Builder
-
Constructor Summary
Constructors Constructor Description Block()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Block.Builderbuilder()Creates a new block builder.abstract com.exonum.binding.common.hash.HashCodegetBlockHash()Returns the SHA-256 hash of this block.abstract longgetHeight()Returns the height of this block which is a distance between the last block and the "genesis" block.abstract intgetNumTransactions()Number of transactions in this block.abstract com.exonum.binding.common.hash.HashCodegetPreviousBlockHash()Hash link to the previous block in the blockchain.abstract intgetProposerId()Identifier of the leader node which has proposed the block.abstract com.exonum.binding.common.hash.HashCodegetStateHash()Hash of the blockchain state after applying transactions in the block.abstract com.exonum.binding.common.hash.HashCodegetTxRootHash()Root hash of the Merkle tree of transactions in this block.inthashCode()static com.google.gson.TypeAdapter<Block>typeAdapter(com.google.gson.Gson gson)Provides a Gson type adapter for this class.
-
-
-
Method Detail
-
getBlockHash
public abstract com.exonum.binding.common.hash.HashCode getBlockHash()
Returns the SHA-256 hash of this block.
-
getProposerId
public abstract int getProposerId()
Identifier of the leader node which has proposed the block.
-
getHeight
public abstract long getHeight()
Returns 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 abstract int getNumTransactions()
Number of transactions in this block.
-
getPreviousBlockHash
public abstract com.exonum.binding.common.hash.HashCode getPreviousBlockHash()
Hash link to the previous block in the blockchain.
-
getTxRootHash
public abstract com.exonum.binding.common.hash.HashCode getTxRootHash()
Root hash of the Merkle tree of transactions in this block. These transactions can be accessed withBlockchain.getBlockTransactions(Block).
-
getStateHash
public abstract com.exonum.binding.common.hash.HashCode getStateHash()
Hash of the blockchain state after applying transactions in the block.- See Also:
Schema.getStateHashes()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
typeAdapter
public static com.google.gson.TypeAdapter<Block> typeAdapter(com.google.gson.Gson gson)
Provides a Gson type adapter for this class.- See Also:
BlockAdapterFactory
-
builder
public static Block.Builder builder()
Creates a new block builder.
-
-