Bitcoin Forum
December 11, 2016, 02:39:43 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Calculating hashes/s from difficulty 1 shares  (Read 5205 times)
Cdecker
Hero Member
*****
Offline Offline

Activity: 487



View Profile WWW
May 08, 2011, 08:43:28 PM
 #1

My knowledge about probability is a little rusty, and I haven't been able to find a simple solution to my problem. Given n difficulty 1 shares submitted in 24 hours I'd like to estimate the hashing speed. It all comes down to the average amount of hashing attempts to find a difficulty 1 block, but that's exactly thing that I can't figure out.

Any help? A step by step example would be incredibly helpful ^^

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

Posts: 1481423983

View Profile Personal Message (Offline)

Ignore
1481423983
Reply with quote  #2

1481423983
Report to moderator
1481423983
Hero Member
*
Offline Offline

Posts: 1481423983

View Profile Personal Message (Offline)

Ignore
1481423983
Reply with quote  #2

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

Posts: 1481423983

View Profile Personal Message (Offline)

Ignore
1481423983
Reply with quote  #2

1481423983
Report to moderator
1481423983
Hero Member
*
Offline Offline

Posts: 1481423983

View Profile Personal Message (Offline)

Ignore
1481423983
Reply with quote  #2

1481423983
Report to moderator
OVerLoRDI
Member
**
Offline Offline

Activity: 60


View Profile
May 08, 2011, 08:53:53 PM
 #2

I would assume you calculate how long it takes 1Khash/s to solve a share of difficulty 1:

which is 7 weeks, 17 hours, 2 minutes, and 47 seconds on average

convert that into seconds:
4294967 seconds

so lets say you have a card hashing at 350000 khash/s, that well submit a share on average, every 12 seconds.

4294967/12= 358163.91 Khash/s

I'm off by 8 Mhash/s because of the rounding in the math for the average rate of solving a share of difficulty 1.  More precise calculations can be had be had by using this formula and rounding less:

1/((2^224-1)/(share difficulty)*(hashrate in khash/s)*1000/2^256)

So you'd get a number around 12.27.  You can also solve it backwards.  4294967/x = hashrate, then solve for x.

Ex.
so you simply would look at the number of shares over a period of time.  Let's say we had a worker submit 360 shares over an hour.

360 shares per hour is 6 shares per minute, or 0.1 shares per second.  Bring that up to a whole share, 1 share per 10 seconds.

4294967/10 = 429496.7 Khash/s

Tada!
1PRieLgL24cr39sWsNYUKbLJ3kWuBHPJBA if you feel so inclined Smiley

Cdecker
Hero Member
*****
Offline Offline

Activity: 487



View Profile WWW
May 08, 2011, 09:32:07 PM
 #3

I somehow feel there is a simpler solution than to estimate backwards from the calculator. As far as I know the target for difficulty 1 is 0x00000000ffff0000000000000000000000000000000000000000000000000000 (https://en.bitcoin.it/wiki/Target#What_is_the_maximum_target?) and we have to aim below that target. So out of 16^65-1 (the above with only FFs) we have to find a number that is lower than 16^56 + 16^53 + 16^52 + 16^51.

So a simple division might get us how many hashes we need for a share, but somehow I get the feeling I'm off by one somewhere. Any confirmations?

Edit: just noticed that I can actually keep the hex numbers and calculate with them. WolframAlpa says the chances of guessing such a number are ~1.45 * 10^-11 (http://bit.ly/jfJ3Kq ).
Did I get something wrong?

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

Activity: 60


View Profile
May 08, 2011, 09:53:36 PM
 #4

I'm unsure about how to calculate it based on the target system.  That is a nuance of bitcoin I am not 100% fluent in yet.

Assuming your math is right, you are stating the probability that your single hash will solve the share of difficulty 1.

Then you'd have to convert the probability into average time for success.  To excel!

I simulated out only 1000 hash pulls so im not surprised I didn't get any success.  Tired 100,000 hash pulls and got overflows Sad

The method that you would use to convert the probability into average time is simulating many many (1,000,000+) hashes, figure out your hash rate (how fast you can generate 1,000,000 hashes) and count your successes.  Sadly significant figures and overflow issues make this sort of calculation in excel difficult.

I think using my math in the 2nd post may be easier.

EpicBacon
Member
**
Offline Offline

Activity: 94


View Profile
May 08, 2011, 10:08:03 PM
 #5

Hey, doesn't this work?

(subbmitted difficulty 1 shares) (2^32) / (Time Period in seconds)

That should give you hashes/second, divide by 1000000 for Mhashes.
Tyran
Jr. Member
*
Offline Offline

Activity: 40


View Profile
May 08, 2011, 10:40:13 PM
 #6

If the target is 0x00000000ffff0000000000000000000000000000000000000000000000000000,
then there are 16^56-16^52 hashes smaller than the target (all starting with 0x00000000, minus the ones starting with 0x00000000ffff).
Out of 16^64 possible this means the chance to find a valid share is (16^56-16^52)/16^64.
So the expected number of hashes per share is 1/((16^56-16^52)/16^64).
Or even easier: 1 / ((0x00000000ffff0000000000000000000000000000000000000000000000000000) / 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
Cdecker
Hero Member
*****
Offline Offline

Activity: 487



View Profile WWW
May 09, 2011, 12:19:07 PM
 #7

Hey, doesn't this work?

(subbmitted difficulty 1 shares) (2^32) / (Time Period in seconds)

That should give you hashes/second, divide by 1000000 for Mhashes.
You and Tyran are off course right. The target for difficulty 1 is (16^56-16^52 = 2^224-2^208), but it can be approximated to 2^224. Since we draw random number from a pool of 2^256 we are left with a chance of 2^224/2^256=2^32, so our average number of draws for 1 block with difficulty 1 is 1/(2^32), giving us an expected 2^32 draws for a winning number.

You both get a +1 from me :-)

Next up, how does this relate to other difficulties?

Want to see what developers are chatting about? http://bitcoinstats.com/irc/bitcoin-dev/logs/
Bitcoin-OTC Rating
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!