Bitcoin Forum
June 21, 2021, 05:43:36 PM *
News: Latest Bitcoin Core release: 0.21.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Difficulty vs target on testnet  (Read 500 times)
Hawkix
Hero Member
*****
Offline Offline

Activity: 531
Merit: 505



View Profile WWW
May 17, 2014, 07:05:54 PM
 #1

I'm trying to test mine solo some testnet bitcoins, using external miner (USB Erupter). The difficulty is pretty high - 28.6K as of now. Moreover, I found a discrepancy between target in getwork RPC call and difficulty in e.g. getmininginfo RPC call.

I know that when there is no block in 20 minutes on testnet, the difficulty should lower temporarily to 1.0. However, the target remains high (now "target" : "0000000000000000000000000000000000000000000000001d4b020000000000"). This causes problems when using external miner as it does not report difficulty 1 shares, but wait for share satisfying target.

Is this a bug in bitcoind or did I miss something?

Donations: 1Hawkix7GHym6SM98ii5vSHHShA3FUgpV6
http://btcportal.net/ - All about Bitcoin - coming soon!
1624297416
Hero Member
*
Offline Offline

Posts: 1624297416

View Profile Personal Message (Offline)

Ignore
1624297416
Reply with quote  #2

1624297416
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
piotr_n
Legendary
*
Offline Offline

Activity: 2047
Merit: 1115


aka tonikt


View Profile WWW
May 17, 2014, 09:38:15 PM
Last edit: May 17, 2014, 10:03:53 PM by piotr_n
 #2

the difficulty is calculated in a different way for testnet3.
there is at lest one special case when it falls back to 1. and on top of that there is also some special bug that may kick in each 2016 blocks that nobody seems to understand or even give a shit about Smiley
i'm not surprised that there is at least one more on rpc calls.

there is some old topic on this forum where gavin explained how he planted the rules there. or at least what was the plan.
but better look into the code - it's probably easier to find there and also more meaningful.
people do mine on testnet, so we at least know that it somehow works.

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
Hawkix
Hero Member
*****
Offline Offline

Activity: 531
Merit: 505



View Profile WWW
May 18, 2014, 08:01:51 AM
 #3

I checked the code and it seems to calculate target correctly (lowering it based on time) when using getwork or getblocktemplate.

I suspect the real problem is that once the 20 minutes since last block passes, the opportunity window to submit DIFF=1.0 share is very short, someone else wins INSTANTLY and the testnet flips back to high difficulty.

Donations: 1Hawkix7GHym6SM98ii5vSHHShA3FUgpV6
http://btcportal.net/ - All about Bitcoin - coming soon!
piotr_n
Legendary
*
Offline Offline

Activity: 2047
Merit: 1115


aka tonikt


View Profile WWW
May 18, 2014, 09:05:26 AM
Last edit: May 18, 2014, 09:40:57 AM by piotr_n
 #4

from what I saw people are mining testnet blocks with timestamps in a future, probably to hit the 20+min => diff1 threshold.

no matter what the time is, they mine a new block with timestamp 20 min bigger from the previous block and they get diff1 guaranteed.
all they need to do is to mine a block with a current time once for awhile and then they get a space for another sprint.

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
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!