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 Details

    • MAX_UNCLES

      public static final 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.
      See Also:
      Constant Field Values
    • MAX_UNCLE_DEGREE

      public static final int MAX_UNCLE_DEGREE
      Maximum uncle degree (e.g. degree 1 = sibling of parent, degree 2 = sibling of grandparent).
      See Also:
      Constant Field Values
    • transactions

      public final Transaction[] transactions
    • uncles

      public final 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.

      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

  • Method Details

    • from

      public static Block from​(RLP rlp) throws RLPParsingException
      Parses a RLP sequence into a block.
      Throws:
      RLPParsingException - if the RLP sequence does not properly parse to a block
    • validate

      public BlockValidity validate()
      Validates the block, returning a BlockValidity object to indicate if the block valid or invalid (and why).
    • rlpLayout

      public RLP rlpLayout()
      Returns the RLP representation of this block, whose binary encoding is used to transmit the block over the network.
      Specified by:
      rlpLayout in interface RLPLayoutable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals​(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object