Bitcoin Forum
March 28, 2024, 02:01:39 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Poll
Question: How should we solve the testnet difficulty problem?  (Voting closed: February 05, 2011, 05:31:53 PM)
Reset testnet with new genesis block regularly - 4 (33.3%)
Reset once with new difficulty adjustment rules - 2 (16.7%)
Do not reset, but add new difficulty rules - 2 (16.7%)
Hard-code testnet difficulty to 1 - 0 (0%)
Do nothing - 4 (33.3%)
Total Voters: 12

Pages: [1]
  Print  
Author Topic: [RFC] Testnet reset  (Read 4532 times)
Gavin Andresen (OP)
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2164


Chief Scientist


View Profile WWW
January 30, 2011, 06:25:56 PM
 #1

Difficulty on the -testnet is annoyingly high.   I propose resetting the -testnet with a new genesis block, and changing the -testnet rules for difficulty adjustment as follows:

1. Adjust difficulty on the testnet every 126 blocks (1/16'th the regular net adjustment).
2. Keep the "difficulty can adjust up at most *4", but remove the limit on how quickly difficulty can adjust down.  Minimal difficulty would remain the same.

Unless I hear howls of protest or better ideas, I'll generate a genesis block and submit a pull request with the changes.  I won't switch the -testnet faucet to the new chain until we've got 0.3.20 release candidate builds out.

How often do you get the chance to work on a potentially world-changing project?
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1711634499
Hero Member
*
Offline Offline

Posts: 1711634499

View Profile Personal Message (Offline)

Ignore
1711634499
Reply with quote  #2

1711634499
Report to moderator
1711634499
Hero Member
*
Offline Offline

Posts: 1711634499

View Profile Personal Message (Offline)

Ignore
1711634499
Reply with quote  #2

1711634499
Report to moderator
slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
January 30, 2011, 06:29:05 PM
 #2

I absolutely agree, those rules will make testnet more useful for software testing.

jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1091


View Profile
January 30, 2011, 06:42:35 PM
 #3

+1 agreed

Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
January 30, 2011, 08:41:56 PM
 #4

Yea, that's nice, but will we reset the main network the day someone pulls the same trick on it ?

Gavin Andresen (OP)
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2164


Chief Scientist


View Profile WWW
January 31, 2011, 01:07:31 AM
 #5

Yea, that's nice, but will we reset the main network the day someone pulls the same trick on it ?

No, if necessary we'd change the difficulty adjustment rules and make the code:

if (current block is > some_number)
  ... new rules for adjusting difficulty
else
  ... old rules for adjusting difficulty

I could have done that and kept the testnet block chain, but it is cleaner to just reset it with new rules.

And "pulling the same trick" means throwing an overwhelmingly massive amount of hashing power at the main network (like 16 times the current overall hashing power) for a significant amount of time, which is getting increasingly hard to do.

How often do you get the chance to work on a potentially world-changing project?
Gavin Andresen (OP)
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2164


Chief Scientist


View Profile WWW
January 31, 2011, 02:32:00 PM
 #6

Patch/pull request is:
  https://github.com/bitcoin/bitcoin/pull/53


How often do you get the chance to work on a potentially world-changing project?
Cdecker
Hero Member
*****
Offline Offline

Activity: 489
Merit: 504



View Profile WWW
January 31, 2011, 10:16:31 PM
 #7

Great work ^^
We do not need to be concerned too much about adjusting the testnet difficulty since it's all throw away anyway :-)

Want to see what developers are chatting about? http://bitcoinstats.com/irc/bitcoin-dev/logs/
Bitcoin-OTC Rating
davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
February 01, 2011, 12:31:29 AM
 #8

Well, I think it's kind of weird to have different rules for testnet than main net...
Usually, a staging environment is kept as close as possible to the production one.

Resetting it is not a bad thing per se, having different rules for each net is definitely not a good thing IMO. What if tomorrow we decide that testnet should have extra X, Y and Z features because it's more "convenient" ?

Maybe the lessons learned with the overtaking of test net should be applied to main net too, if one individual took test net over, what can an organization do ? And how can we anticipate that ?

What I vote for is the following :
 - reset testnet with the same rules than main net,
 - commit to the fact that the only difference between main and test are the port and the genesis block,
 - anticipate a way to deal with main net being overtaken by someone who decided it was worth doing it

A simple solution I can think of :
 - If no block has been generated for 24h,, 48h or whatever divide difficulty by 2

I don't think that :
 - accepting that main and test have different rules,
 - not anticipating this particular kind of attack
is a good thing.

slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
February 01, 2011, 12:58:55 AM
 #9

A simple solution I can think of :
 - If no block has been generated for 24h,, 48h or whatever divide difficulty by 2

...which doesn't solve current problem with testnet. Testnet difficulty is not insanely high, it is still possible to mine a block with a decent hardware in a hour or so. But it is too high to effective testing some software, where you need many blocks to pass all tests.

I see your point and partially agree. Some better algorithm to lower difficulty should be adopter both to testnet and main net. But for current situation, changes which Gavin proposed are fine for me.

Anonymous
Guest

February 01, 2011, 01:17:07 AM
 #10

If the testnet is a clone of bitcoin completely it could be a backup block chain in case of disaster. Might be good to have a separate network there just in case ,although the same thing could happen with a weaker network as happened to the first test network.


Is it possible to create a version of bitcoin you can run on lots of virtual machines that simulates the real network?

Bitcoin test network in a sandbox.



nanotube
Hero Member
*****
Offline Offline

Activity: 482
Merit: 501


View Profile WWW
February 01, 2011, 06:43:09 AM
 #11

Yea, that's nice, but will we reset the main network the day someone pulls the same trick on it ?

No, if necessary we'd change the difficulty adjustment rules and make the code:

if (current block is > some_number)
  ... new rules for adjusting difficulty
else
  ... old rules for adjusting difficulty

I could have done that and kept the testnet block chain, but it is cleaner to just reset it with new rules.

And "pulling the same trick" means throwing an overwhelmingly massive amount of hashing power at the main network (like 16 times the current overall hashing power) for a significant amount of time, which is getting increasingly hard to do.


i for one would prefer this approach to completely restarting the chain.

Join #bitcoin-market on freenode for real-time market updates.
Join #bitcoin-otc - an over-the-counter trading market. http://bitcoin-otc.com
OTC web of trust: http://bitcoin-otc.com/trust.php
My trust rating: http://bitcoin-otc.com/viewratingdetail.php?nick=nanotube
ribuck
Donator
Hero Member
*
Offline Offline

Activity: 826
Merit: 1039


View Profile
February 01, 2011, 10:48:58 AM
 #12

Keep testnet as close as possible to the live system. It will sort itself out in a few weeks.

Create an additional block chain for those whose development needs require something other than what testnet provides.
davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
February 01, 2011, 10:54:31 AM
 #13

I think that resetting testnet once in a while is a good thing, it will mean resetting the difficulty too, so specific difficulty rules for testnet are not only useless but adding complexity and prone to introducing bugs (this for example)

Gavin Andresen (OP)
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2164


Chief Scientist


View Profile WWW
February 02, 2011, 02:56:54 PM
Last edit: February 02, 2011, 03:15:54 PM by gavinandresen
 #14

Keep testnet as close as possible to the live system. It will sort itself out in a few weeks.

Create an additional block chain for those whose development needs require something other than what testnet provides.

No, it won't sort itself out "after a few weeks".  Let me see if I can do a back-of-the-envelope:

Difficulty on testnet currently at 373.  We want it no higher than, oh, 5, so with the typical 3-or-4 machines CPU-hashing on testnet generate a block in a reasonable amount of time.

So we generate 2016 blocks over 8 weeks.  That cuts difficulty by four: ~90
Then do it again: ~22
and again... ~5  SIX MONTHS later

That's optimistically assuming we can find people to cooperate to contribute hashing power to generate 2016 blocks at difficulty 300 in 8 weeks or less.

If you'd like to continue using the old testnet chain, be my guest.

I'm sympathetic to the "testnet and main net should have the same rules", but the truth is the testnet has, and always will have, many fewer people hashing on it.

Changing the main net downard-difficulty-adjustment code might make sense, but that's the topic for another thread.  Allowing main net difficulty to adjust all the way from 22,000 to 1 isn't the right answer (it makes sybil attacks where an attacker feeds you a bogus version of the block chain much easier).

How often do you get the chance to work on a potentially world-changing project?
davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
February 02, 2011, 03:03:32 PM
 #15

I'm sympathetic to the "testnet and main net should have the same rules", but the truth is the testnet has, and always will have, many fewer people hashing on it.
Let's make it a policy to reset testnet every month/release/whatever.
Problem solved, same rules for both, difficulty will stay really low since no one will want to mine for TBTC since it will be clear they will never be valuable.

davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
February 02, 2011, 05:32:06 PM
 #16

Why change the difficulty at all on the testnet?

Why not just keep it at 1 permanently? If we make it change every every 126 blocks, someone with a GPU could screw everyone with the difficulty change quickly, and then it takes 126 blocks for it to get back down (which could be a week or more)
The point of testnet is to make tests that are significant and reproductible on main net, if the two have different rules you might as well not test anything

What's so bad about changing the real network every 126 blocks too?
good question



lfm
Full Member
***
Offline Offline

Activity: 196
Merit: 104



View Profile
February 03, 2011, 12:04:54 PM
 #17

If testnet has different rules it looses some of its value as a testbed since you are not testing the production rules any more.
davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
February 03, 2011, 01:23:52 PM
 #18

If testnet has different rules it looses some of its value as a testbed since you are not testing the production rules any more.
Yes.

From what I understand, there are two different things testnet is used for testing generation -> you need low difficulty in order to make testing easy, testnet also has to have the same rules than main net, otherwise tests can't be very meaningful.

If you need some long running tests, you might as well test with a couple of main net coins.

I don't mind doing the coding associated with this task once in a while when difficulty makes testing harder.
Patch is here

LZ
Legendary
*
Offline Offline

Activity: 1722
Merit: 1072


P2P Cryptocurrency


View Profile
February 04, 2011, 12:58:50 AM
 #19

What about to use multiple chains with different rules?
Code:
-testnet=0
-testnet=1
-testnet=n

My OpenPGP fingerprint: 5099EB8C0F2E68C63B4ECBB9A9D0993E04143362
davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
February 04, 2011, 08:59:59 AM
 #20

Maybe the best would be to clearly document how to setup a different testnet.
I'll document what I did to reset the current test net, let's start from there.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!