Package ch.bitagent.bitcoin.lib.block
Class MerkleBlock
- java.lang.Object
-
- ch.bitagent.bitcoin.lib.block.MerkleBlock
-
-
Constructor Summary
Constructors Constructor Description MerkleBlock(Int version, byte[] prevBlock, byte[] merkleRoot, Int timestamp, byte[] bits, byte[] nonce, int total, List<byte[]> hashes, byte[] flags)Constructor for MerkleBlock.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getBits()Getter for the fieldbits.byte[]getCommand()getCommand.byte[]getFlags()Getter for the fieldflags.List<byte[]>getHashes()Getter for the fieldhashes.byte[]getMerkleRoot()Getter for the fieldmerkleRoot.byte[]getNonce()Getter for the fieldnonce.byte[]getPrevBlock()Getter for the fieldprevBlock.IntgetTimestamp()Getter for the fieldtimestamp.intgetTotal()Getter for the fieldtotal.IntgetVersion()Getter for the fieldversion.booleanisValid()Verifies whether the merkle tree information validates to the merkle rootstatic MerkleBlockparse(ByteArrayInputStream stream)Takes a byte stream and parses a merkle block.byte[]serialize()serialize.
-
-
-
Field Detail
-
COMMAND
public static final String COMMAND
ConstantCOMMAND="merkleblock"- See Also:
- Constant Field Values
-
-
Method Detail
-
getCommand
public byte[] getCommand()
getCommand.
- Specified by:
getCommandin interfaceMessage- Returns:
- an array of
byteobjects
-
parse
public static MerkleBlock parse(ByteArrayInputStream stream)
Takes a byte stream and parses a merkle block. Returns a Merkle Block object- Parameters:
stream- aByteArrayInputStreamobject- Returns:
- a
MerkleBlockobject
-
isValid
public boolean isValid()
Verifies whether the merkle tree information validates to the merkle root- Returns:
- a boolean
-
serialize
public byte[] serialize()
serialize.
-
getMerkleRoot
public byte[] getMerkleRoot()
Getter for the field
merkleRoot.- Returns:
- an array of
byteobjects
-
getPrevBlock
public byte[] getPrevBlock()
Getter for the field
prevBlock.- Returns:
- an array of
byteobjects
-
getBits
public byte[] getBits()
Getter for the field
bits.- Returns:
- an array of
byteobjects
-
getNonce
public byte[] getNonce()
Getter for the field
nonce.- Returns:
- an array of
byteobjects
-
getTotal
public int getTotal()
Getter for the field
total.- Returns:
- a int
-
getFlags
public byte[] getFlags()
Getter for the field
flags.- Returns:
- an array of
byteobjects
-
-