@Test public void testWork() throws Exception { BigInteger work = TESTNET.getGenesisBlock().getWork(); double log2Work = Math.log(work.longValue()) / Math.log(2); assertEquals(32.000022, log2Work, 0.0000001); }
public BigInteger getWork() throws VerificationException { BigInteger target = getDifficultyTargetAsInteger(); return LARGEST_HASH.divide(target.add(BigInteger.ONE)); }
Block extends Message { public BigInteger getWork() throws VerificationException { BigInteger target = getDifficultyTargetAsInteger(); return LARGEST_HASH.divide(target.add(BigInteger.ONE)); } }
Block extends Message { public BigInteger getWork() throws VerificationException { BigInteger target = getDifficultyTargetAsInteger(); return LARGEST_HASH.divide(target.add(BigInteger.ONE)); } Block(NetworkParameters params, long setVersion); @Deprecated  Block(NetworkParameters params, byte[] payloadBytes);  Block(NetworkParameters params, byte[] payloadBytes, MessageSerializer serializer, int length);  Block(NetworkParameters params, byte[] payloadBytes, int offset, MessageSerializer serializer, int length);  Block(NetworkParameters params, byte[] payloadBytes, int offset, @Nullable Message parent, MessageSerializer serializer, int length);  Block(NetworkParameters params, long version, Sha256Hash prevBlockHash, Sha256Hash merkleRoot, long time,
                 long difficultyTarget, long nonce, List<Transaction> transactions); }
Block extends Message { public BigInteger getWork() throws VerificationException { BigInteger target = getDifficultyTargetAsInteger(); return LARGEST_HASH.divide(target.add(BigInteger.ONE)); } Block(NetworkParameters params, long setVersion); @Deprecated  Block(NetworkParameters params, byte[] payloadBytes);  Block(NetworkParameters params, byte[] payloadBytes, MessageSerializer serializer, int length);  Block(NetworkParameters params, byte[] payloadBytes, int offset, MessageSerializer serializer, int length);  Block(NetworkParameters params, byte[] payloadBytes, int offset, @Nullable Message parent, MessageSerializer serializer, int length);  Block(NetworkParameters params, long version, Sha256Hash prevBlockHash, Sha256Hash merkleRoot, long time,
                 long difficultyTarget, long nonce, List<Transaction> transactions); Coin getBlockInflation(int height); int getOptimalEncodingMessageSize(); @Override byte[] bitcoinSerialize(); String getHashAsString(); @Override Sha256Hash getHash(); BigInteger getWork(); Block cloneAsHeader(); @Override String toString(); void solve(); BigInteger getDifficultyTargetAsInteger(); void verifyHeader(); void verifyTransactions(final int height, final EnumSet<VerifyFlag> flags); void verify(final int height, final EnumSet<VerifyFlag> flags); @Override boolean equals(Object o); @Override int hashCode(); Sha256Hash getMerkleRoot(); void addTransaction(Transaction t); long getVersion(); Sha256Hash getPrevBlockHash(); long getTimeSeconds(); Date getTime(); void setTime(long time); long getDifficultyTarget(); void setDifficultyTarget(long compactForm); long getNonce(); void setNonce(long nonce); @Nullable List<Transaction> getTransactions(); @VisibleForTesting Block createNextBlock(Address to, long version, long time, int blockHeight); @VisibleForTesting Block createNextBlock(@Nullable Address to, TransactionOutPoint prevOut); @VisibleForTesting Block createNextBlock(@Nullable Address to, Coin value); @VisibleForTesting Block createNextBlock(@Nullable Address to); @VisibleForTesting Block createNextBlockWithCoinbase(long version, byte[] pubKey, Coin coinbaseValue, final int height); boolean hasTransactions(); boolean isBIP34(); boolean isBIP66(); boolean isBIP65(); }
Block extends Message { public BigInteger getWork() throws VerificationException { BigInteger target = getDifficultyTargetAsInteger(); return LARGEST_HASH.divide(target.add(BigInteger.ONE)); } Block(NetworkParameters params, long setVersion); @Deprecated  Block(NetworkParameters params, byte[] payloadBytes);  Block(NetworkParameters params, byte[] payloadBytes, MessageSerializer serializer, int length);  Block(NetworkParameters params, byte[] payloadBytes, int offset, MessageSerializer serializer, int length);  Block(NetworkParameters params, byte[] payloadBytes, int offset, @Nullable Message parent, MessageSerializer serializer, int length);  Block(NetworkParameters params, long version, Sha256Hash prevBlockHash, Sha256Hash merkleRoot, long time,
                 long difficultyTarget, long nonce, List<Transaction> transactions); Coin getBlockInflation(int height); int getOptimalEncodingMessageSize(); @Override byte[] bitcoinSerialize(); String getHashAsString(); @Override Sha256Hash getHash(); BigInteger getWork(); Block cloneAsHeader(); @Override String toString(); void solve(); BigInteger getDifficultyTargetAsInteger(); void verifyHeader(); void verifyTransactions(final int height, final EnumSet<VerifyFlag> flags); void verify(final int height, final EnumSet<VerifyFlag> flags); @Override boolean equals(Object o); @Override int hashCode(); Sha256Hash getMerkleRoot(); void addTransaction(Transaction t); long getVersion(); Sha256Hash getPrevBlockHash(); long getTimeSeconds(); Date getTime(); void setTime(long time); long getDifficultyTarget(); void setDifficultyTarget(long compactForm); long getNonce(); void setNonce(long nonce); @Nullable List<Transaction> getTransactions(); @VisibleForTesting Block createNextBlock(Address to, long version, long time, int blockHeight); @VisibleForTesting Block createNextBlock(@Nullable Address to, TransactionOutPoint prevOut); @VisibleForTesting Block createNextBlock(@Nullable Address to, Coin value); @VisibleForTesting Block createNextBlock(@Nullable Address to); @VisibleForTesting Block createNextBlockWithCoinbase(long version, byte[] pubKey, Coin coinbaseValue, final int height); boolean hasTransactions(); boolean isBIP34(); boolean isBIP66(); boolean isBIP65(); static final int HEADER_SIZE; static final int MAX_BLOCK_SIZE; static final int MAX_BLOCK_SIGOPS; static final long EASIEST_DIFFICULTY_TARGET; static final int BLOCK_HEIGHT_UNKNOWN; static final int BLOCK_HEIGHT_GENESIS; static final long BLOCK_VERSION_GENESIS; static final long BLOCK_VERSION_BIP34; static final long BLOCK_VERSION_BIP66; static final long BLOCK_VERSION_BIP65; }