Hash/sec Throttling for Democracy

InterArmaEnimSil July 13, 2010 18:23 UTC Source ·

I’ve seen a number of posts complaining that coin generation on old machines is impractical (actually, the posts say impossible, but that’s not correct). A number of others have espoused the general idea that flopsluck=coins, which seems to me to be about right. One even advocated for OpenCL/CUDA support, which seems to me like it would give those with OpenCL capable cards an incredible advantage in the “flops” category of flopsluck.

Now, some have said “If you have no luck, you don’t get coins…” but come on here…we’re dealing with computers - RNGs have nothing, really, to do with luck. They operate upon statistical averages. (If BTC is using a true RNG based upon machine atmospheric noise, I could be wrong here, but I don’t know that such a generator would be practical in that it would be too slow).

Therefore, why not cap the number of hashes per second? If the operations were capped at say, 250khash/sec based upon system clock and not the available number of cycles, then anyone with the “minimum requirements” could participate in generation at no disadvantage to the guy with the TESLA cluster running CUDA (okay…so people aren’t going to use TESLA clusters for this…but you see my point, I hope). Of course, difficulty would need to be adjusted accordingly to keep block generation on pace, and checks for blocks generated clients violating the cap (and thus outpacing other clients by cheating) would be required, but these are matters solved with relative ease in the code.

InterArmaEnimSil July 14, 2010 19:07 UTC Source ·

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 19:17 UTC Source ·
Quote from: InterArmaEnimSil on July 14, 2010, 10:07:03 AM UTC

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.

Laszlo Hanyecz (laszlo) July 14, 2010 19:33 UTC Source ·

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 19:50 UTC Source ·

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… 😞), 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! 😊 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 19:58 UTC Source ·

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.

Satoshi Nakamoto July 14, 2010 20:25 UTC Source ·
Quote from: knightmb on July 14, 2010, 10:17:43 AM UTC

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.

Insti July 14, 2010 20:39 UTC Source ·
Quote from: Strofcon on July 14, 2010, 7:50:02 PM UTC

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.

You are right about the nonce and the hashing, but..

Everybody is working on a different block.

To pay the block creator 50BTC you need to know the Bitcoin Address it needs to go to. For the block creator to be able to spend the 50BTC they create, they need to have the private key associated with the bitcoin address the 50 was paid to.

Since everybody has a different private key (randomly generated), everyone has a different Bitcoin Address (associated public key (hashed))

Part of what makes up the block is the hash of the transaction that pays the 50BTC to the block creators Bitcoin Address.

This means that everybody has a different block.

Whoever solves their block first ‘wins’ and that block is acclaimed by all as the ‘next’ block.

InterArmaEnimSil July 14, 2010 20:45 UTC Source ·

nonce + your_address + garbage data = randomness that varies from client to client.

Got it. Thank you, everyone. My confidence in the system is restored.

knightmb July 14, 2010 21:10 UTC Source ·
Quote from: Insti on July 14, 2010, 8:39:35 PM UTC

You are right about the nonce and the hashing, but..

Everybody is working on a different block.

To pay the block creator 50BTC you need to know the Bitcoin Address it needs to go to. For the block creator to be able to spend the 50BTC they create, they need to have the private key associated with the bitcoin address the 50 was paid to.

Since everybody has a different private key (randomly generated), everyone has a different Bitcoin Address (associated public key (hashed))

Part of what makes up the block is the hash of the transaction that pays the 50BTC to the block creators Bitcoin Address.

This means that everybody has a different block.

Whoever solves their block first ‘wins’ and that block is acclaimed by all as the ‘next’ block.

Oh, so it’s both the luck of the draw and a sequential order? Meaning, my computer is trying to solve it’s block. It might do it in 1 hour or 100 hours. Once it does, it moves on to another random block?

So an old PC joins the Bit Coin network, works on a block for 4 days and solves it, then it broadcast that out to the network where it’s verified before being added to the chain? Does that mean during that 4 days, there is no way someone else is going to solve the same block elsewhere and claim ownership of it?