Package com.norswap.nanoeth.blocks
Class Block
java.lang.Object
com.norswap.nanoeth.blocks.Block
- All Implemented Interfaces:
RLPLayoutable
public final class Block extends Object implements RLPLayoutable
Where even to begin? The block in blockchain, the one that holds transactions.
-
Field Summary
Fields Modifier and Type Field Description BlockHeader
header
static int
MAX_UNCLE_DEGREE
Maximum uncle degree (e.g.static int
MAX_UNCLES
Maximum number of uncle that can be included in the block, which is 2, as per section 11.1 of the yellowpaper.Transaction[]
transactions
BlockHeader[]
uncles
Uncle (aka ommer) blocks are children of ancestors of this block that are not themselves ancestor of these block, and have not been included as uncles in ancestors. -
Constructor Summary
Constructors Constructor Description Block(BlockHeader header, Transaction[] transactions, BlockHeader[] uncles)
-
Method Summary
Modifier and Type Method Description boolean
equals(Object o)
static Block
from(RLP rlp)
Parses a RLP sequence into a block.int
hashCode()
RLP
rlpLayout()
Returns the RLP representation of this block, whose binary encoding is used to transmit the block over the network.String
toString()
BlockValidity
validate()
Validates the block, returning aBlockValidity
object to indicate if the block valid or invalid (and why).Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.norswap.nanoeth.rlp.RLPLayoutable
rlpEncode, rlpHexString
-
Field Details
-
MAX_UNCLES
public static final int MAX_UNCLESMaximum number of uncle that can be included in the block, which is 2, as per section 11.1 of the yellowpaper.- See Also:
- Constant Field Values
-
MAX_UNCLE_DEGREE
public static final int MAX_UNCLE_DEGREEMaximum uncle degree (e.g. degree 1 = sibling of parent, degree 2 = sibling of grandparent).- See Also:
- Constant Field Values
-
header
-
transactions
-
uncles
Uncle (aka ommer) blocks are children of ancestors of this block that are not themselves ancestor of these block, and have not been included as uncles in ancestors.When included in a block, the coinbase of the uncle is credited 7/8 of the normal mining reward. The miner also receives 1/32 of the mining reward per included uncle. Uncles disencentivize chain reorganizations, by making it profitable to publish uncles instead of continuing to mine on one's own fork. (However, unlike the in the GHOST protocol that inspired the use of uncles, Ethereum does not count unclestowards the weight of the chain in the fork-choice rule.)
-
-
Constructor Details
-
Block
public Block(BlockHeader header, @Retained Transaction[] transactions, @Retained BlockHeader[] uncles)
-
-
Method Details
-
from
Parses a RLP sequence into a block.- Throws:
RLPParsingException
- if the RLP sequence does not properly parse to a block
-
validate
Validates the block, returning aBlockValidity
object to indicate if the block valid or invalid (and why). -
rlpLayout
Returns the RLP representation of this block, whose binary encoding is used to transmit the block over the network.- Specified by:
rlpLayout
in interfaceRLPLayoutable
-
toString
-
equals
-
hashCode
public int hashCode()
-