Class MerkleBlock

  • All Implemented Interfaces:
    Message

    public class MerkleBlock
    extends Object
    implements Message

    MerkleBlock class.

    • Constructor Detail

      • MerkleBlock

        public MerkleBlock​(Int version,
                           byte[] prevBlock,
                           byte[] merkleRoot,
                           Int timestamp,
                           byte[] bits,
                           byte[] nonce,
                           int total,
                           List<byte[]> hashes,
                           byte[] flags)

        Constructor for MerkleBlock.

        Parameters:
        version - a Int object
        prevBlock - an array of byte objects
        merkleRoot - an array of byte objects
        timestamp - a Int object
        bits - an array of byte objects
        nonce - an array of byte objects
        total - a int
        hashes - a List object
        flags - an array of byte objects
    • Method Detail

      • getCommand

        public byte[] getCommand()

        getCommand.

        Specified by:
        getCommand in interface Message
        Returns:
        an array of byte objects
      • isValid

        public boolean isValid()
        Verifies whether the merkle tree information validates to the merkle root
        Returns:
        a boolean
      • serialize

        public byte[] serialize()

        serialize.

        Specified by:
        serialize in interface Message
        Returns:
        an array of byte objects
      • getVersion

        public Int getVersion()

        Getter for the field version.

        Returns:
        a Int object
      • getMerkleRoot

        public byte[] getMerkleRoot()

        Getter for the field merkleRoot.

        Returns:
        an array of byte objects
      • getPrevBlock

        public byte[] getPrevBlock()

        Getter for the field prevBlock.

        Returns:
        an array of byte objects
      • getTimestamp

        public Int getTimestamp()

        Getter for the field timestamp.

        Returns:
        a Int object
      • getBits

        public byte[] getBits()

        Getter for the field bits.

        Returns:
        an array of byte objects
      • getNonce

        public byte[] getNonce()

        Getter for the field nonce.

        Returns:
        an array of byte objects
      • getTotal

        public int getTotal()

        Getter for the field total.

        Returns:
        a int
      • getHashes

        public List<byte[]> getHashes()

        Getter for the field hashes.

        Returns:
        a List object
      • getFlags

        public byte[] getFlags()

        Getter for the field flags.

        Returns:
        an array of byte objects