(quoted post by InterArmaEnimSil)

6 messages BitcoinTalk InterArmaEnimSil, knightmb, Laszlo Hanyecz, Strofcon, theymos, Satoshi Nakamoto July 14, 2010 — July 14, 2010

Okay - if everyone’s machines are working on a hash to a different problem, then I can see how luck would be a factor. However, what is the source of the variation between the problem my machine is working on, the problem yours is, etc? One reply earlier seemed to imply that it had to do with transactions in which the individual recently took part…but what about those of us not taking part in any recent transactions? (My most recent one is at least two days old now)

knightmb July 14, 2010 Source · Permalink

Quote from: InterArmaEnimSil on July 14, 2010, 07:07:03 PM

Okay - if everyone’s machines are working on a hash to a different problem, then I can see how luck would be a factor. However, what is the source of the variation between the problem my machine is working on, the problem yours is, etc? One reply earlier seemed to imply that it had to do with transactions in which the individual recently took part…but what about those of us not taking part in any recent transactions? (My most recent one is at least two days old now)

In terms of Coin Generation, you need only be connected to the network. That’s all that is needed for your computer to broadcast “I found it!!” message and for other computers to check if it’s valid. Since blocks are being generated on a constant basis, doing offline Coin generation won’t be practical. Because if 2 days ago your computer found a block, but so did mine and my PC was online the whole time, mine will be proclaimed the winner/owner of that Coin by the network as a whole. Your PC comes in 2 days later and broadcast that it has the same solution and the other computers will just snide a “too late, XYZ already solved it, better luck next time”.

In terms of variation between problems, when a block is found, everyone starts on the next block. So if your computer was only 1% towards solving block 68000 and got the message “XYZ solved the block 68000 just a few minutes ago”, your PC thinks “well, on to the next one”. It doesn’t waste CPU trying to solve a block that was already solved by someone else. That’s where the verification part comes in. Otherwise, someone would just hack together a client that broadcast “I solved block 68000, 680001, 68002, etc” to claim ownership of the entire range. When a client says it solved a block, all the other computers say “ok, well prove it then, send me your results”. When enough of them talk to each other about it, they will agree that “yes, your PC solved block 68000, you are the new owner, congratulations”.

The key part is that it takes hours/days for our PCs to solve a block, but only milliseconds for everyone else to check if it’s true. That prevents a “fake block found” attack from happening on the network.

Another example, you have a room with hundreds of people in it. Everyone is given a randomly mixed up Rubix cube to solve. The first one to solve his/her cube gets 50 coin.

Now if someone shouts “I solved it”, it won’t take but a mere glance from the surrounding people to tell if it’s true or not (solid colors on all sides) If someone shouts “I solved it” and it’s still a jumbled mess, well everyone just ignores that person and continues on. The first person who solves it for “real” wins the prize and then everyone throws away their current Rubix cube and a bunch more randomly mixed Rubix cubes drop from the ceiling to start the process all over again.

Aside from the housekeeping fields needed to make sense of the data, the rest of the data that is being hashes is just random. Everyone’s is different and you never get any closer to solving it. Every time it is twiddled and re-hashed you have the same chance of finding a solution. This is just like buying raffle tickets. Everyone’s numbers are different and they could all be winners, however the guy who gets more raffle tickets might win more often, if this process was repeated over and over. Computers that can try hashing faster have more raffle tickets but every hash calculation has the same chance of being a winner.

Strofcon July 14, 2010 Source · Permalink

Take this lightly until confirmed, but here’s my understanding…

There is no variation in the problem itself - every node is intended to work on the same block at the same time (accounting for latencies and such). The luck factor is really the random number generated at the beginning of each node’s attempt to solve a new block. When a new block needs to be solved, each node generates a random value (nonce), which is used to hash the block. If that hash isn’t the right one, the nonce is incremented, and the new incremented value is used to hash the block again.

Say my clunker manages 1,000 khash/s (which it really does… Sad), and you have a cluster that cranks out 100,000 khash/s, there’s still a reasonable chance that my clunker will randomly (and very luckily) land on the value that solves the block within a very small number of hashes… say my nonce is a winner after only 10 hashes. I’m working out 1,000,000 hashes per second, so it only took me 1/100,000 of a second to solve the block. You cluster would have to (again, luckily) generate the right nonce in less than 0.00001 seconds to beat my lucky guess… which means your cluster would have guess correctly in less than 100,000,000 (hash/s) / 100,000 (s) = 1,000 hashes. Given the huge number of hashes possible, the likelihood of you hitting it in under 1,000 is remarkably low…

Granted, my chances of hitting it in under 10 hashes was even more insanely low, but you get the idea I think. So yes, the cluster will, overall, solve more blocks than my clunker, but it won’t win out every single time.

Now that I’ve gone through all that… I’m sure someone will point out a flaw in my reasoning! Smiley I’m fine with that though, I want to make sure I understand it all correctly!

Edit - Laszlo said it much more conscisely, but I think we made the same point…? Hopefully!

theymos July 14, 2010 Source · Permalink

In addition the the random nonce, each block also contains a BitCoin address (newly-generated, used only for this purpose) that the 50 BC reward is credited to if you solve a block. Even if two nodes choose the same random nonce to start at (which is unlikely), they’re pretty much guaranteed to have different BitCoin addresses.

Quote from: knightmb on July 14, 2010, 07:17:43 PM

So if your computer was only 1% towards solving block 68000 This is a common point of confusion.  There’s no such thing as being 1% towards solving a block.  You don’t make progress towards solving it.  After working on it for 24 hours, your chances of solving it are equal to what your chances were at the start or at any moment.

It’s like trying to flip 37 coins at once and have them all come up heads.  Each time you try, your chances of success are the same.

The RNG is the OpenSSL secure random number generator.  On Windows it’s seeded with the complete set of all hardware performance counters since your computer started, on Linux it’s dev/random.