public abstract class Block extends Object
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.
Blockchain| Modifier and Type | Class and Description |
|---|---|
static class |
Block.Builder |
| Constructor and Description |
|---|
Block() |
| Modifier and Type | Method and Description |
|---|---|
static Block.Builder |
builder()
Creates a new block builder.
|
abstract com.exonum.binding.common.hash.HashCode |
getBlockHash()
Returns the SHA-256 hash of this block.
|
abstract long |
getHeight()
Returns the height of this block which is a distance between the last block and the "genesis"
block.
|
abstract int |
getNumTransactions()
Number of transactions in this block.
|
abstract com.exonum.binding.common.hash.HashCode |
getPreviousBlockHash()
Hash link to the previous block in the blockchain.
|
abstract int |
getProposerId()
Identifier of the leader node which has proposed the block.
|
abstract com.exonum.binding.common.hash.HashCode |
getStateHash()
Hash of the blockchain state after applying transactions in the block.
|
abstract com.exonum.binding.common.hash.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.
|
static com.google.gson.TypeAdapter<Block> |
typeAdapter(com.google.gson.Gson gson)
Provides a Gson type adapter for this class.
|
public abstract com.exonum.binding.common.hash.HashCode getBlockHash()
public abstract int getProposerId()
public abstract long getHeight()
The height also identifies each block in the blockchain.
public final boolean isEmpty()
public abstract int getNumTransactions()
public abstract com.exonum.binding.common.hash.HashCode getPreviousBlockHash()
public abstract com.exonum.binding.common.hash.HashCode getTxRootHash()
Blockchain.getBlockTransactions(Block).public abstract com.exonum.binding.common.hash.HashCode getStateHash()
Schema.getStateHashes()public static com.google.gson.TypeAdapter<Block> typeAdapter(com.google.gson.Gson gson)
CoreTypeAdapterFactorypublic static Block.Builder builder()
Copyright © 2019 Exonum. All rights reserved.