Class BlockHeader
- All Implemented Interfaces:
- RLPLayoutable
public final class BlockHeader extends Object implements RLPLayoutable
- 
Field SummaryFields Modifier and Type Field Description AddresscoinbaseAddress that will receive the block reward (aka "beneficiary", aka "miner's address").NaturaldifficultyThe difficult level of the block, calculated from the previous' block difficulty level and thetimestamp(cf.byte[]extraDataAn arbitrary byte array containing data relevant to this block.NaturalgasLimitCurrent maximum amount of gas usable per block.NaturalgasUsedThe amount of gas used in this block.BloomFilterlogsBloomThe Bloom filter composed from indexable information (logger address and log topics) contained in each log entry from the receipt of each transaction in the transactions list.HashmixHashA hash which, combined with thenonce, proves that a sufficient amount of computation has been carried out on this block.longnonceA 64-bit scalar value which, combined with themixHash, proves that a sufficient amount of computation has been carried out on this block.NaturalnumberThe number of ancestor blocks (aka "height").HashparentHashThehashof the parent block.MerkleRootreceiptsRootThe Merkle root of the receipts list of the block.MerkleRootstateRootThe Merkle root of the state tree.NaturaltimestampA value equal to the reasonable output of Unix’s time() at this block’s inception.MerkleRoottransactionsRootThe Merkle root of the transactions list of the block.HashuncleHashHash of the the uncles (aka "ommers") list of the block.
- 
Constructor SummaryConstructors Constructor Description BlockHeader(Hash parentHash, Hash uncleHash, Address coinbase, MerkleRoot stateRoot, MerkleRoot transactionsRoot, MerkleRoot receiptsRoot, BloomFilter logsBloom, Natural difficulty, Natural number, Natural gasLimit, Natural gasUsed, Natural timestamp, byte[] extraData, Hash mixHash, long nonce)Constructs a header from header data, and computes the header hash from this data.
- 
Method SummaryModifier and Type Method Description booleanequals(Object o)static BlockHeaderfrom(RLP rlp)Parses a RLP sequence into a block header.Hashhash()Hash of all the other data in the header.inthashCode()booleanhasUncles()Return true iff theuncleHashis not the hash of the empty sequence.RLPrlpLayout()Returns the RLP representation of this block header, which is stored in the block (itself RLP-encoded) when circulated over the network.StringtoString()BlockValidityStatusvalidate()Validates the block header against its parent (automatically retrieved fromBlocks.DB).BlockValidityStatusvalidate(BlockHeader parent)Validates the block header against its parent.Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.norswap.nanoeth.rlp.RLPLayoutablerlpEncode, rlpHexString
- 
Field Details- 
parentHashThehashof the parent block.Yellowpaper notation: Hp 
- 
uncleHashHash of the the uncles (aka "ommers") list of the block.Yellowpaper notation: Ho 
- 
coinbaseAddress that will receive the block reward (aka "beneficiary", aka "miner's address").Yellowpaper notation: Hc 
- 
stateRootThe Merkle root of the state tree.Yellowpaper notation: Hr 
- 
transactionsRootThe Merkle root of the transactions list of the block.Yellowpaper notation: Ht 
- 
receiptsRootThe Merkle root of the receipts list of the block.Yellowpaper notation: He 
- 
logsBloomThe Bloom filter composed from indexable information (logger address and log topics) contained in each log entry from the receipt of each transaction in the transactions list.Yellowpaper notation: Hb 
- 
difficultyThe difficult level of the block, calculated from the previous' block difficulty level and thetimestamp(cf.Difficulty).
- 
numberThe number of ancestor blocks (aka "height"). The genesis block has number 0.Yellowpaper notation: Hi 
- 
gasLimitCurrent maximum amount of gas usable per block.Yellowpaper notation: Hl A block's miner can choose to update the gas limit incrementally (up or down) within the limit set by the protocol (cf. validate(BlockHeader)).
- 
gasUsedThe amount of gas used in this block.Yellowpaper notation: Hg 
- 
timestampA value equal to the reasonable output of Unix’s time() at this block’s inception.Yellowpaper notation: Hs The yellowpaper puts a 256 bytes limit on this, but it doesn't seem to affect serialization. 
- 
extraDatapublic final byte[] extraDataAn arbitrary byte array containing data relevant to this block. This must be 32 bytes or fewer.Yellowpaper notaion: Hx 
- 
mixHashA hash which, combined with thenonce, proves that a sufficient amount of computation has been carried out on this block.Yellowpaper notation: Hm 
- 
noncepublic final long nonceA 64-bit scalar value which, combined with themixHash, proves that a sufficient amount of computation has been carried out on this block.Miners iterate the nonce value until they can find a mixHashthat satisfies thedifficultyrequirement.Yellowpaper notation: Hn Note that unlike other scalar values, by like addresses, hashes, ... the nonce gets serialized in full, even if it has leading zeroes. 
 
- 
- 
Constructor Details- 
BlockHeaderpublic BlockHeader(Hash parentHash, Hash uncleHash, Address coinbase, MerkleRoot stateRoot, MerkleRoot transactionsRoot, MerkleRoot receiptsRoot, BloomFilter logsBloom, Natural difficulty, Natural number, Natural gasLimit, Natural gasUsed, Natural timestamp, byte[] extraData, Hash mixHash, long nonce)Constructs a header from header data, and computes the header hash from this data.
 
- 
- 
Method Details- 
hashHash of all the other data in the header. This is not serialized in the block (but will be serialized in the children asparentHash). This is computed lazily and cached.
- 
fromParses a RLP sequence into a block header.- Throws:
- RLPParsingException- if the RLP sequence does not properly parse to a block header
 
- 
validateValidates the block header against its parent (automatically retrieved fromBlocks.DB).- Returns:
- BlockValidityStatus.VAL_VALIDif the header is valid, or a- BlockValidityStatusvalue that indicates the reason for the failure.
- See Also:
- for full block validation, including running the transactions.
 
- 
validateValidates the block header against its parent. The parent is expected to have been retrieve from this header'sparentHash(can be null for the genesis block).- Returns:
- BlockValidityStatus.VAL_VALIDif the header is valid, or a- BlockValidityStatusvalue that indicates the reason for the failure.
- See Also:
- for full block validation, including running the transactions.
 
- 
hasUnclespublic boolean hasUncles()Return true iff theuncleHashis not the hash of the empty sequence.
- 
rlpLayoutReturns the RLP representation of this block header, which is stored in the block (itself RLP-encoded) when circulated over the network. Uncle block headers are similarly encoded.- Specified by:
- rlpLayoutin interface- RLPLayoutable
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
 
-