Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: konradp on August 05, 2014, 01:33:12 PM



Title: What's the difficulty of testnet
Post by: konradp on August 05, 2014, 01:33:12 PM
Hi.
Blockexplorer ( http://blockexplorer.com/testnet/q/getdifficulty ) shows that the testnet difficulty is 1.0, while bitcoin -testnet console window tells me it is 11.5

Why the difference?

edit: hmmm now blockexplorer shows 128167.76365264 and bitcoin client 1.0, what is happening?

Ah wait - the bitcoin client hasn't finished downloading the blockchain... does it explain it? But why blockexplorer jumped from 1.0 to 128167.76365264 ? Is the testnet difficulty being calculated more often than mainnet?

edit2: is that even possible that testnet's difficulty is 128167.76... that would make it useless...

edit3: blockexplorer again shows 1.0 - I can't find any info about this behaviour on https://en.bitcoin.it/wiki/Testnet except for "(...)introduced (...) a new rule to avoid the "difficulty was too high, is now too low, and transactions take too long to verify" problem (...) " - so what are the rules? Is the difficulty supposed to jump like that?


Title: Re: What's the difficulty of testnet
Post by: DeathAndTaxes on August 05, 2014, 02:13:34 PM
If no blocks are found on testnet in 20 minutes it will reset difficulty back to 1.  This is done because difficulty is suppose to remain low to allow easy block creation even with development CPU but at one time some idiots would dump TH/s on testnet drive difficulty to insane levels and leave.

Also difficulty 1 on testnet is equal to difficulty 0.5 on mainnet.  That threw me off the first I was looking at block hashes.


Title: Re: What's the difficulty of testnet
Post by: konradp on August 05, 2014, 02:16:29 PM
Thanks!
But regarding this:
Quote
"If no blocks are found on testnet in 20 minutes it will reset difficulty back to 1"
Does also this mean, that difficulty is 1 for the next 20 minutes?


Title: Re: What's the difficulty of testnet
Post by: DeathAndTaxes on August 05, 2014, 02:20:47 PM
Well no difficulty is also adjusted normally every 2016 blocks.

So in 2016 blocks the difficulty will rise based on the time of the last 2016 blocks just like it does on mainnet every 2016 blocks.  Exactly the same rules, exactly the same outcome.  If hashrate is constant that would be two weeks but it could be two months or two minutes.  

The only difference between the networks is that tesnet has an "anti-dirtbag reset" built into it.   If (in addition to all the normal difficulty adjustment rules) there is no block found in the last 20 minutes then difficulty is instantly and automatically reset to 1.  Note this is horribly insecure to use on a mainnet as it could easily be exploited by an attacker due to the loose timestamp rules but testnet isn't designed to be secure from reorgs.


Title: Re: What's the difficulty of testnet
Post by: drawingthesun on August 05, 2014, 02:22:05 PM
Thanks!
But regarding this:
Quote
"If no blocks are found on testnet in 20 minutes it will reset difficulty back to 1"
Does also this mean, that difficulty is 1 for the next 20 minutes?

I don't think so.

I think he means this:

So no matter the current difficulty, if no blocks are found within 20 minutes, the current difficulty is set to 1.

Now if someone starts mining using TH/s of power, nothing will stop the difficulty rising from 1.

So it's not forced at 1 whilst people are mining, it's just a change applied once every time the criteria of {no blocks for 20 minutes} is reached.

I hope that explains it a little more.


Title: Re: What's the difficulty of testnet
Post by: konradp on August 05, 2014, 02:26:13 PM
Thank you both, but... this means I have basically no chance to solve a block with my 5 MH/s?  or even 3 GH/s ???

(corrected 30 gh/s -> 3 gh/s)


Title: Re: What's the difficulty of testnet
Post by: shorena on August 05, 2014, 02:32:06 PM
Thank you both, but... this means I have basically no chance to solve a block with my 5 MH/s?  or even 3 GH/s ???

(corrected 30 gh/s -> 3 gh/s)

Sure you have a chance, depending on the current difficulty. But if you want coins to test with there is at least one faucet that gives out several btc at once. should be sufficient for testing.


Title: Re: What's the difficulty of testnet
Post by: konradp on August 05, 2014, 02:33:46 PM
Thank you both, but... this means I have basically no chance to solve a block with my 5 MH/s?  or even 3 GH/s ???

(corrected 30 gh/s -> 3 gh/s)

Sure you have a chance, depending on the current difficulty. But if you want coins to test with there is at least one faucet that gives out several btc at once. should be sufficient for testing.

Thanks - I already got 0.44 btc this way, I just wanted to solve a block at least once in my lifetime:)

But so I have a question guys - why aren't there *many* testnets? That would split those with GH/s i TH/s and I could choose one testnet. Why not?


Title: Re: What's the difficulty of testnet
Post by: Envrin on August 05, 2014, 02:45:47 PM
But so I have a question guys - why aren't there *many* testnets? That would split those with GH/s i TH/s and I could choose one testnet. Why not?

If wanted, you could always create your own Testnet in a Box (https://bitcointalk.org/index.php?topic=4483.0) :)


Title: Re: What's the difficulty of testnet
Post by: konradp on August 05, 2014, 02:47:42 PM
But so I have a question guys - why aren't there *many* testnets? That would split those with GH/s i TH/s and I could choose one testnet. Why not?

If wanted, you could always create your own Testnet in a Box (https://bitcointalk.org/index.php?topic=4483.0) :)


Thanks, but is there a way to explore blocks on such a thing? Explore using a nice interface, like blockexplorer? :)