<p>You can use the <code>getblocktemplate</code> RPC command and look at the <code>target</code> field.</p>

CC BY-SA 3.0
2013-12-12T01:20:06.047Z
2017-09-03T23:25:40.970Z
2017-09-03T23:25:40.970Z
Nate Eldredge
<p>As is well known, testnet has a "20-minute rule": if no block is found within 20 minutes, the mining difficulty drops to 1 until a block is found.</p>

<p>From some experimentation, it appears that bitcoind's <code>getdifficulty</code> function reports the difficulty of the most recent block.  Thus, if the most recent block was mined under the 20-minute rule, <code>getdifficulty</code> returns 1.</p>

<p>In this case, how can I find the "real" difficulty level?  That is, the difficulty that would be required of a block submitted less than 20 minutes after the previous one?</p>

<p>The best approach I have found so far is to follow the blockchain back until I find a block with a difficulty other than 1 (or less than 20 minutes after the block preceding it).  But this will be prone to error if a difficulty adjustment has recently taken place.</p>

<p>bitcoind must know the real difficulty at all times; can I query it?</p>

CC BY-SA 3.0
2013-12-11T23:39:47.623Z
Why would bitcoind always have to know it? If the 20-minute-rule is hard, bitcoind will just accept any new block it receives after 20 minutes.
But I never heard of this rule, can you point out where you found out about it?
Steven Roose
CC BY-SA 3.0
2013-12-11T23:42:12.150Z
@StevenRoose: https://en.bitcoin.it/wiki/Testnet: "In addition, if no block has been found in 20 minutes, the difficulty automatically resets back to the minimum for a single block, after which it returns to its previous value."
Nate Eldredge
CC BY-SA 3.0
2013-12-11T23:43:18.937Z
@StevenRoose: If bitcoind receives a block that's less than 20 minutes newer than the previous one, it needs to use the "real" difficulty in deciding whether to accept it.
Nate Eldredge
<bitcoind><difficulty><testnet>
How can I find the "real" difficulty on testnet?
Nate Eldredge
# How can I find the "real" difficulty on testnet?

(Asked by: username_0 on 2013-12-11)

As is well known, testnet has a "20-minute rule": if no block is found within 20 minutes, the mining difficulty drops to 1 until a block is found.

From some experimentation, it appears that bitcoind's `getdifficulty` function reports the difficulty of the most recent block. Thus, if the most recent block was mined under the 20-minute rule, `getdifficulty` returns 1.

In this case, how can I find the "real" difficulty level? That is, the difficulty that would be required of a block submitted less than 20 minutes after the previous one?

The best approach I have found so far is to follow the blockchain back until I find a block with a difficulty other than 1 (or less than 20 minutes after the block preceding it). But this will be prone to error if a difficulty adjustment has recently taken place.

bitcoind must know the real difficulty at all times; can I query it?

**Tags:** bitcoind, difficulty, testnet

> **Comments:**
> **username_1**: Why would bitcoind always have to know it? If the 20-minute-rule is hard, bitcoind will just accept any new block it receives after 20 minutes. But I never heard of this rule, can you point out where you found out about it?  
> **username_0**: @StevenRoose: https://en.bitcoin.it/wiki/Testnet: "In addition, if no block has been found in 20 minutes, the difficulty automatically resets back to the minimum for a single block, after which it returns to its previous value."  
> **username_0**: @StevenRoose: If bitcoind receives a block that's less than 20 minutes newer than the previous one, it needs to use the "real" difficulty in deciding whether to accept it.  

---

## 1 answers

### Answer by username_0 on 2013-12-12. Score: 4 | Accepted answer

You can use the `getblocktemplate` RPC command and look at the `target` field.


---

