Block extends Message { public byte[] getBlockHash() { if (blockHash == null) blockHash = calculateHash(); return blockHash; } Block();  Block(byte[] blockHash, long version, byte[] prevBlock, byte[] merkleRoot, int timestamp
            , long target, long nonce, int blockNo, boolean isMain);  Block(byte[] payloadBytes);  Block(byte[] payloadBytes, int length);  Block(long version, String prevBlock, String merkleRoot, int timestamp
            , long target, long nonce, int height); String getHashAsString(); int getBlockNo(); void setBlockNo(int blockNo); byte[] getBlockHash(); void setBlockHash(byte[] blockHash); byte[] getBlockRoot(); void setBlockRoot(byte[] blockRoot); long getBlockVer(); void setBlockVer(long blockVer); long getBlockBits(); void setBlockBits(long blockBits); long getBlockNonce(); void setBlockNonce(long blockNonce); int getBlockTime(); void setBlockTime(int blockTime); byte[] getBlockPrev(); void setBlockPrev(byte[] blockPrev); boolean isMain(); void setMain(boolean isMain); List<byte[]> getTxHashes(); void setTxHashes(List<byte[]> txHashes); List<Tx> getTransactions(); void setTransactions(List<Tx> transactions); byte[] calculateHash(); void verifyDifficultyFromPreviousBlock(Block prev); void verifyDifficultyFromPreviousBlock(Block prev, int transitionTime); @Nullable Block get(byte[] hash); @Override boolean equals(Object o); void verifyHeader(); void verifyTransactions(); void verify(); BigInteger getDifficultyTargetAsInteger(); int getOptimalEncodingMessageSize(); byte[] bitcoinSerialize(); @Override void bitcoinSerializeToStream(OutputStream stream); Block cloneAsHeader(); static final int MAX_BLOCK_SIZE; static final int MAX_BLOCK_SIGOPS; static final int HEADER_SIZE; }
@Test public void testText() { assertEquals("", ""); Block block = new Block(2, "00000000000000003711b624fbde8c77d4c7e25334cfa8bc176b7248ca67b24b", "d1ce608b0e83f5b0c134d27ea6952fc55bc68b5ccf0490bbb47ea1906a7075d0", 1407474112 , 406305378, 2798738616L, 314496); String str = Utils.bytesToHexString(Utils.reverseBytes(block.getBlockHash())); assertEquals("000000000000000030e597a72386c512d830b08ecc70b254f46033fd06f2bf93", str); AbstractDb.blockProvider.addBlock(block); Block testBlock = AbstractDb.blockProvider. getBlock(Utils.reverseBytes(Utils.hexStringToByteArray( "000000000000000030e597a72386c512d830b08ecc70b254f46033fd06f2bf93"))); assertEquals(Utils.bytesToHexString(testBlock.getBlockHash()), Utils.bytesToHexString(block.getBlockHash())); }