Package com.bradyrussell.uiscoin.block
Class BlockHeader
java.lang.Object
com.bradyrussell.uiscoin.block.BlockHeader
- All Implemented Interfaces:
SerializableAsBinaryData
,VerifiableWithBlockchain
public class BlockHeader extends java.lang.Object implements SerializableAsBinaryData, VerifiableWithBlockchain
-
Field Summary
Fields Modifier and Type Field Description int
BlockHeight
int
DifficultyTarget
byte[]
HashMerkleRoot
byte[]
HashPreviousBlock
int
Nonce
long
Time
int
Version
-
Constructor Summary
Constructors Constructor Description BlockHeader()
BlockHeader(int version, long time, int difficultyTarget, byte[] hashPreviousBlock, byte[] hashMerkleRoot)
BlockHeader(int version, long time, int difficultyTarget, int blockHeight)
BlockHeader(int version, long time, int difficultyTarget, int nonce, int blockHeight)
BlockHeader(int version, long time, int difficultyTarget, int nonce, int blockHeight, byte[] hashPreviousBlock, byte[] hashMerkleRoot)
BlockHeader(BlockHeader toCopy)
-
Method Summary
Modifier and Type Method Description static int
calculateDifficultyTarget(long TimeSinceLastBlock, int LastBlockDifficulty)
byte[]
getBinaryData()
byte[]
getHash()
int
getSize()
int
setBinaryData(byte[] Data)
boolean
verify(BlockchainStorage blockchain)
-
Field Details
-
Version
public int Version -
HashPreviousBlock
public byte[] HashPreviousBlock -
HashMerkleRoot
public byte[] HashMerkleRoot -
Time
public long Time -
DifficultyTarget
public int DifficultyTarget -
Nonce
public int Nonce -
BlockHeight
public int BlockHeight
-
-
Constructor Details
-
BlockHeader
public BlockHeader() -
BlockHeader
public BlockHeader(int version, long time, int difficultyTarget, int blockHeight) -
BlockHeader
public BlockHeader(int version, long time, int difficultyTarget, byte[] hashPreviousBlock, byte[] hashMerkleRoot) -
BlockHeader
public BlockHeader(int version, long time, int difficultyTarget, int nonce, int blockHeight) -
BlockHeader
public BlockHeader(int version, long time, int difficultyTarget, int nonce, int blockHeight, byte[] hashPreviousBlock, byte[] hashMerkleRoot) -
BlockHeader
-
-
Method Details
-
getBinaryData
public byte[] getBinaryData()- Specified by:
getBinaryData
in interfaceSerializableAsBinaryData
-
setBinaryData
public int setBinaryData(byte[] Data)- Specified by:
setBinaryData
in interfaceSerializableAsBinaryData
-
getSize
public int getSize()- Specified by:
getSize
in interfaceSerializableAsBinaryData
-
getHash
public byte[] getHash()- Specified by:
getHash
in interfaceSerializableAsBinaryData
-
calculateDifficultyTarget
public static int calculateDifficultyTarget(long TimeSinceLastBlock, int LastBlockDifficulty) -
verify
- Specified by:
verify
in interfaceVerifiableWithBlockchain
-