Class BlockHeaderBuilder

  • All Implemented Interfaces:
    Serializer

    public class BlockHeaderBuilder
    extends java.lang.Object
    implements Serializer
    Binary layout for a block header
    • Constructor Detail

      • BlockHeaderBuilder

        protected BlockHeaderBuilder​(java.io.DataInputStream stream)
        Constructor - Creates an object from stream.
        Parameters:
        stream - Byte stream to use to serialize the object.
      • BlockHeaderBuilder

        protected BlockHeaderBuilder​(SignatureDto signature,
                                     KeyDto signerPublicKey,
                                     byte version,
                                     NetworkTypeDto network,
                                     EntityTypeDto type,
                                     HeightDto height,
                                     TimestampDto timestamp,
                                     DifficultyDto difficulty,
                                     VrfProofBuilder generationHashProof,
                                     Hash256Dto previousBlockHash,
                                     Hash256Dto transactionsHash,
                                     Hash256Dto receiptsHash,
                                     Hash256Dto stateHash,
                                     KeyDto beneficiaryPublicKey,
                                     BlockFeeMultiplierDto feeMultiplier)
        Constructor.
        Parameters:
        signature - Entity signature.
        signerPublicKey - Entity signer's public key.
        version - Entity version.
        network - Entity network.
        type - Entity type.
        height - Block height.
        timestamp - Number of milliseconds elapsed since creation of nemesis block.
        difficulty - Block difficulty.
        generationHashProof - Generation hash proof.
        previousBlockHash - Previous block hash.
        transactionsHash - Hash of the transactions in this block.
        receiptsHash - Hash of the receipts generated by this block.
        stateHash - Hash of the global chain state at this block.
        beneficiaryPublicKey - Beneficiary public key designated by harvester.
        feeMultiplier - Fee multiplier applied to block transactions.
    • Method Detail

      • loadFromBinary

        public static BlockHeaderBuilder loadFromBinary​(java.io.DataInputStream stream)
        Creates an instance of BlockHeaderBuilder from a stream.
        Parameters:
        stream - Byte stream to use to serialize the object.
        Returns:
        Instance of BlockHeaderBuilder.
      • create

        public static BlockHeaderBuilder create​(SignatureDto signature,
                                                KeyDto signerPublicKey,
                                                byte version,
                                                NetworkTypeDto network,
                                                EntityTypeDto type,
                                                HeightDto height,
                                                TimestampDto timestamp,
                                                DifficultyDto difficulty,
                                                VrfProofBuilder generationHashProof,
                                                Hash256Dto previousBlockHash,
                                                Hash256Dto transactionsHash,
                                                Hash256Dto receiptsHash,
                                                Hash256Dto stateHash,
                                                KeyDto beneficiaryPublicKey,
                                                BlockFeeMultiplierDto feeMultiplier)
        Creates an instance of BlockHeaderBuilder.
        Parameters:
        signature - Entity signature.
        signerPublicKey - Entity signer's public key.
        version - Entity version.
        network - Entity network.
        type - Entity type.
        height - Block height.
        timestamp - Number of milliseconds elapsed since creation of nemesis block.
        difficulty - Block difficulty.
        generationHashProof - Generation hash proof.
        previousBlockHash - Previous block hash.
        transactionsHash - Hash of the transactions in this block.
        receiptsHash - Hash of the receipts generated by this block.
        stateHash - Hash of the global chain state at this block.
        beneficiaryPublicKey - Beneficiary public key designated by harvester.
        feeMultiplier - Fee multiplier applied to block transactions.
        Returns:
        Instance of BlockHeaderBuilder.
      • getStreamSize

        public int getStreamSize()
        Gets entity size.
        Returns:
        Entity size.
      • getVerifiableEntityHeader_Reserved1

        public int getVerifiableEntityHeader_Reserved1()
        Gets reserved padding to align Signature on 8-byte boundary.
        Returns:
        Reserved padding to align Signature on 8-byte boundary.
      • getSignature

        public SignatureDto getSignature()
        Gets entity signature.
        Returns:
        Entity signature.
      • getSignerPublicKey

        public KeyDto getSignerPublicKey()
        Gets entity signer's public key.
        Returns:
        Entity signer's public key.
      • getEntityBody_Reserved1

        public int getEntityBody_Reserved1()
        Gets reserved padding to align end of EntityBody on 8-byte boundary.
        Returns:
        Reserved padding to align end of EntityBody on 8-byte boundary.
      • getVersion

        public byte getVersion()
        Gets entity version.
        Returns:
        Entity version.
      • getNetwork

        public NetworkTypeDto getNetwork()
        Gets entity network.
        Returns:
        Entity network.
      • getType

        public EntityTypeDto getType()
        Gets entity type.
        Returns:
        Entity type.
      • getHeight

        public HeightDto getHeight()
        Gets block height.
        Returns:
        Block height.
      • getTimestamp

        public TimestampDto getTimestamp()
        Gets number of milliseconds elapsed since creation of nemesis block.
        Returns:
        Number of milliseconds elapsed since creation of nemesis block.
      • getDifficulty

        public DifficultyDto getDifficulty()
        Gets block difficulty.
        Returns:
        Block difficulty.
      • getGenerationHashProof

        public VrfProofBuilder getGenerationHashProof()
        Gets generation hash proof.
        Returns:
        Generation hash proof.
      • getPreviousBlockHash

        public Hash256Dto getPreviousBlockHash()
        Gets previous block hash.
        Returns:
        Previous block hash.
      • getTransactionsHash

        public Hash256Dto getTransactionsHash()
        Gets hash of the transactions in this block.
        Returns:
        Hash of the transactions in this block.
      • getReceiptsHash

        public Hash256Dto getReceiptsHash()
        Gets hash of the receipts generated by this block.
        Returns:
        Hash of the receipts generated by this block.
      • getStateHash

        public Hash256Dto getStateHash()
        Gets hash of the global chain state at this block.
        Returns:
        Hash of the global chain state at this block.
      • getBeneficiaryPublicKey

        public KeyDto getBeneficiaryPublicKey()
        Gets beneficiary public key designated by harvester.
        Returns:
        Beneficiary public key designated by harvester.
      • getFeeMultiplier

        public BlockFeeMultiplierDto getFeeMultiplier()
        Gets fee multiplier applied to block transactions.
        Returns:
        Fee multiplier applied to block transactions.
      • getBlockHeader_Reserved1

        public int getBlockHeader_Reserved1()
        Gets reserved padding to align end of BlockHeader on 8-byte boundary.
        Returns:
        Reserved padding to align end of BlockHeader on 8-byte boundary.
      • getSize

        public int getSize()
        Gets the size of the object.
        Specified by:
        getSize in interface Serializer
        Returns:
        Size in bytes.
      • serialize

        public byte[] serialize()
        Serializes an object to bytes.
        Specified by:
        serialize in interface Serializer
        Returns:
        Serialized bytes.