Package com.norswap.nanoeth.data
Class MerkleRoot
java.lang.Object
com.norswap.nanoeth.data.Hash
com.norswap.nanoeth.data.MerkleRoot
- All Implemented Interfaces:
RLPLayoutable
@Wrapper public final class MerkleRoot extends Hash
A
Hash
that is marked as being a Merkle root.
A Merkle root is the hash associated with the root of a Merkle tree.
The hash ("label") associated with a Merkle tree node is the hash of the data for leaf nodes, and the hash of the children's labels for non-leaf nodes.
-
Field Summary
Fields Modifier and Type Field Description static MerkleRoot
ZERO
A merkle root composed of only zero bytes, which happens to be the merkle root of empty trees.Fields inherited from class com.norswap.nanoeth.data.Hash
bytes, EMPTY_SEQ_HASH
-
Constructor Summary
Constructors Constructor Description MerkleRoot(byte[] bytes)
MerkleRoot(Hash hash)
MerkleRoot(String hexString)
Creates a merkle root from a hex string (e.g. -
Method Summary
Modifier and Type Method Description static MerkleRoot
parse(RLP rlp)
Methods inherited from class com.norswap.nanoeth.data.Hash
equals, hashCode, rlpLayout, toFullHexString, toString
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
-
ZERO
A merkle root composed of only zero bytes, which happens to be the merkle root of empty trees.
-
-
Constructor Details
-
MerkleRoot
public MerkleRoot(byte[] bytes) -
MerkleRoot
-
MerkleRoot
Creates a merkle root from a hex string (e.g. 0x123).If the post-0x part of the hex string is not 64 characters long, the hash will be padded with zeroes at the start so that it is 32 bytes long.
-
-
Method Details
-
parse
- Throws:
RLPParsingException
-