Package com.bradyrussell.uiscoin.block
Class Block
java.lang.Object
com.bradyrussell.uiscoin.block.Block
- All Implemented Interfaces:
SerializableAsBinaryData
,VerifiableWithBlockchain
public class Block extends java.lang.Object implements SerializableAsBinaryData, VerifiableWithBlockchain
-
Field Summary
Fields Modifier and Type Field Description BlockHeader
Header
java.util.ArrayList<Transaction>
Transactions
-
Constructor Summary
Constructors Constructor Description Block()
Block(BlockHeader header)
Block(BlockHeader header, java.util.ArrayList<Transaction> transactions)
-
Method Summary
Modifier and Type Method Description Block
addCoinbaseTransaction(Transaction transaction)
Block
addTransaction(Transaction transaction)
static long
calculateBlockReward(int BlockHeight)
byte[]
calculateMerkleRoot()
void
debugVerify(BlockchainStorage blockchain)
boolean
equals(java.lang.Object o)
byte[]
getBinaryData()
long
getFees(BlockchainStorage blockchain)
byte[]
getHash()
Deprecated.int
getSize()
static java.util.List<byte[]>
merkleRootStep(java.util.List<byte[]> Nodes)
int
setBinaryData(byte[] Data)
Block
setCoinbaseTransaction(Transaction transaction)
boolean
verify(BlockchainStorage blockchain)
boolean
verifyProofOfWork()
boolean
verifyTransactionsUnspent(BlockchainStorage blockchain)
-
Field Details
-
Constructor Details
-
Method Details
-
addTransaction
-
addCoinbaseTransaction
-
setCoinbaseTransaction
-
merkleRootStep
public static java.util.List<byte[]> merkleRootStep(java.util.List<byte[]> Nodes) -
calculateMerkleRoot
public byte[] calculateMerkleRoot() -
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
@Deprecated public byte[] getHash()Deprecated.- Specified by:
getHash
in interfaceSerializableAsBinaryData
-
debugVerify
public void debugVerify(BlockchainStorage blockchain) throws NoSuchTransactionException, NoSuchBlockException, InvalidBlockException -
verifyTransactionsUnspent
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
calculateBlockReward
public static long calculateBlockReward(int BlockHeight) -
verifyProofOfWork
public boolean verifyProofOfWork() -
getFees
public long getFees(BlockchainStorage blockchain) throws NoSuchTransactionException, NoSuchBlockException, InvalidBlockException -
verify
- Specified by:
verify
in interfaceVerifiableWithBlockchain
-