Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: CounterEntropy on May 31, 2016, 10:20:02 AM



Title: How random the last digit of a block hash really is?
Post by: CounterEntropy on May 31, 2016, 10:20:02 AM
I recently noticed a gambling website (www.bitcoinbetting.website https://www.chain-bet.com) is offering 4 times return on correctly guessing the last digit of a block hash. I would like to know, how random is the last digit of a block hash really is? Is there any bias towards numbers or letters?

Update: Lately, they have increased return to 15 times for each winning bet.


Title: Re: How random is the last digit of a block hash really is?
Post by: dex1 on May 31, 2016, 11:39:30 AM
I recently noticed a gambling website (www.bitcoinbetting.website) is offering 4 times return on correctly guessing the last digit of a block hash. I would like to know, how random is the last digit of a block hash really is? Is there any bias towards numbers or letters?



It's a digit in hex format between 0 - F so in decimal between 0-15.
Your chance to guess the right digit is 1 in 16.




Title: Re: How random is the last digit of a block hash really is?
Post by: 2c0de on May 31, 2016, 12:06:35 PM
It is random as long miners/pools don't care about the site.

If the bets become bigger than subsidy (25BTC), it gets interesting.

Miners/pools can participate on site, rig future block digit to be zero, and sweep all unsuspecting user's funds who bet on 1.

OH and by the way, I know about system how truly fair betting can be constructed, but it's a secret :)


Title: Re: How random is the last digit of a block hash really is?
Post by: CounterEntropy on May 31, 2016, 10:32:33 PM
It's a digit in hex format between 0 - F so in decimal between 0-15.
I know. I asked about the randomness of its appearance as the last digit of a block hash. Whether increasing difficulty has any effect on it etc.

Your chance to guess the right digit is 1 in 16.
That's not always true for this specific game as the a player can chose multiple options at a time.

It is random as long miners/pools don't care about the site.

If the bets become bigger than subsidy (25BTC), it gets interesting.

Miners/pools can participate on site, rig future block digit to be zero, and sweep all unsuspecting user's funds who bet on 1.
I doubt if there is slightest truth in the bold part. Mining pools probably can not force the last digit of a block hash to be zero or any digit of their choice. It should depend on the nonce. Otherwise SHA would have been broken.


Title: Re: How random is the last digit of a block hash really is?
Post by: Delek on May 31, 2016, 11:39:52 PM
Mining pools probably can not force the last digit of a block hash to be zero or any digit of their choice. It should depend on the nonce.
BREAKING NEWS: Forcing the hash is changing a nonce.


Title: Re: How random is the last digit of a block hash really is?
Post by: Cryddit on June 01, 2016, 12:16:45 AM
In order for a miner to "pick" the last digit of the hash, they'd have to pass up a block subsidy plus a block's worth of transaction fees should the last digit of a qualifying hash (one that's low enough for the current difficulty) fail to match.

Passing up a chance to get a block subsidy is a pretty big deal.  Block subsidies are 25BTC at present, as someone said.  Soon though it will drop to 12.5BTC and miners may start withholding blocks if it looks like they could make more with the betting.



Title: Re: How random is the last digit of a block hash really is?
Post by: DannyHamilton on June 01, 2016, 02:39:55 AM
I asked about the randomness of its appearance as the last digit of a block hash.

As long as the miner (or pool) doesn't have a significant incentive to ignore a successful block hash to continue trying additional nonce values for a different hash, it is random.

Whether increasing difficulty has any effect on it etc.

Difficulty has no effect on it.

Your chance to guess the right digit is 1 in 16.
That's not always true for this specific game as the a player can chose multiple options at a time.

You didn't explain what the options were.

You asked "how random is the last digit of a block hash really is".  The chance of guessing a single random last digit is 1 in 16 if miners (or pools) don't have a significant incentive to ignore a winning hash to continue trying additional nonce values for a different hash.

Mining pools probably can not force the last digit of a block hash to be zero or any digit of their choice. It should depend on the nonce. Otherwise SHA would have been broken.

Sure, but if the block reward is only 12.5 BTC (like it will be in about 7 weeks), and the prize for guessing the correct last hash digit is 200 BTC, then it might be worth it to the miner (or pool) to just ignore a successful hash and continue to try additional nonce values to see if the next successful block hash has a winning digit. They might miss out on the 12.5 BTC since they didn't broadcast their block, but 1 out of every 16 times they do it, they have a 6.25% chance of their next successful hash earning them 200 BTC.


Title: Re: How random is the last digit of a block hash really is?
Post by: Syke on June 01, 2016, 02:53:40 PM
They might miss out on the 12.5 BTC since they didn't broadcast their block

They could always withhold the block until someone else finds a block, at which point they can broadcast their block and hope to win the race. They would still lose sometimes, but sometimes they'd win.


Title: Re: How random is the last digit of a block hash really is?
Post by: fronti on June 02, 2016, 02:30:02 PM
 cat /tmp/hashlist | sed -e 's/\(^.*\)\(.$\)/\2/' | sort | uniq -c  | sort
  25530 9
  25640 5
  25707 8
  25792 4
  25807 b
  25849 a
  25877 6
  25882 0
  25897 f
  25904 e
  25923 d
  26025 7
  26084 3
  26169 c
  26176 1
  26217 2

looks random enough with 414479 blocks..
we need to check again in 100000 Blocks :)


Title: Re: How random is the last digit of a block hash really is?
Post by: Taras on June 04, 2016, 07:04:20 PM
cat /tmp/hashlist | sed -e 's/\(^.*\)\(.$\)/\2/' | sort | uniq -c  | sort
http://i.krist.club/soffice.bin_2016-06-04_14-03-16.png
Here it is in chart form - definitely random!


Title: Re: How random is the last digit of a block hash really is?
Post by: bob123 on June 07, 2016, 11:40:53 AM
cat /tmp/hashlist | sed -e 's/\(^.*\)\(.$\)/\2/' | sort | uniq -c  | sort
http://i.krist.club/soffice.bin_2016-06-04_14-03-16.png
Here it is in chart form - definitely random!

Would have been kinda irritating if it wasnt random.
Since its SHA HASHING


Title: Re: How random is the last digit of a block hash really is?
Post by: CounterEntropy on June 08, 2016, 09:46:53 PM
Mining pools probably can not force the last digit of a block hash to be zero or any digit of their choice. It should depend on the nonce.
BREAKING NEWS: Forcing the hash is changing a nonce.
Not sure if u r joking or spamming.

Mining pools probably can not force the last digit of a block hash to be zero or any digit of their choice. It should depend on the nonce. Otherwise SHA would have been broken.

Sure, but if the block reward is only 12.5 BTC (like it will be in about 7 weeks), and the prize for guessing the correct last hash digit is 200 BTC, then it might be worth it to the miner (or pool) to just ignore a successful hash and continue to try additional nonce values to see if the next successful block hash has a winning digit. They might miss out on the 12.5 BTC since they didn't broadcast their block, but 1 out of every 16 times they do it, they have a 6.25% chance of their next successful hash earning them 200 BTC.
Well, I think, there is no chance of this. Because, the highest amount of bet they are accepting against house is 0.1 BTC. So, the best amount that the miner can win for now is 0.8 BTC. No one will withhold 12.5 BTC for 0.8 BTC.


Title: Re: How random is the last digit of a block hash really is?
Post by: DannyHamilton on June 08, 2016, 10:00:19 PM
Well, I think, there is no chance of this. Because, the highest amount of bet they are accepting against house is 0.1 BTC. So, the best amount that the miner can win for now is 0.8 BTC. No one will withhold 12.5 BTC for 0.8 BTC.

Interesting.  I wonder how they verify that a person isn't placing multiple bets (with multiple accounts)?

If the miner could set up 100 accounts and place 100 bets, then they could bet a total of 10 BTC to possibly win 80 BTC.


Title: Re: How random is the last digit of a block hash really is?
Post by: -ck on June 08, 2016, 10:24:11 PM
They might miss out on the 12.5 BTC since they didn't broadcast their block

They could always withhold the block until someone else finds a block, at which point they can broadcast their block and hope to win the race. They would still lose sometimes, but sometimes they'd win.
They'd always lose if they broadcast it after another pool has found a block unless they were big enough to get two blocks back to back.


Title: Re: How random is the last digit of a block hash really is?
Post by: DannyHamilton on June 08, 2016, 10:30:21 PM
They'd always lose if they broadcast it after another pool has found a block unless they were big enough to get two blocks back to back.

Not necessarily.

It would depend on how well connected they were to other miners and pools, and how well connected the pool that found the block was.

If they received the block directly from the pool that found it, and then immediately broadcast their own block to all the other pools before the competing block had propagated, then they'd have a pretty good chance of winning.


Title: Re: How random is the last digit of a block hash really is?
Post by: -ck on June 08, 2016, 11:41:03 PM
They'd always lose if they broadcast it after another pool has found a block unless they were big enough to get two blocks back to back.

Not necessarily.

It would depend on how well connected they were to other miners and pools, and how well connected the pool that found the block was.

If they received the block directly from the pool that found it, and then immediately broadcast their own block to all the other pools before the competing block had propagated, then they'd have a pretty good chance of winning.
Anything's possible, sure, but since they have to receive it from the other pool and then broadcast their own, then every other pool may also have received the block. Sure they might be the only pool with a good connection to the one pool that solved the block but there is no magic to make one pool substantially better connected to all pools than all other pools might have. Too many ifs and buts, but yes in this pedantic world, my ALWAYS is indeed wrong. Let's say 99% to not leave any absolutes out there... Either way it's far too risky to likely lose a whole block reward.


Title: Re: How random is the last digit of a block hash really is?
Post by: Mandoy on June 09, 2016, 01:54:35 AM
Normally a standard opinion would say 1 out of 16 but i would rebut in my experience its 1 out 99. But nevermind the hash, and consider this; if you make a certain roll and certain amount to match your roll number to that of the last hash digit then dont do it, theres a less chance youll get it and more btc wasted. But if you have just to guess it without making somebets then go on it doesnt matter if you make a guess as long as you dont lose a significant amount of btc.


Title: Re: How random is the last digit of a block hash really is?
Post by: AlexGR on June 13, 2016, 09:33:45 PM
cat /tmp/hashlist | sed -e 's/\(^.*\)\(.$\)/\2/' | sort | uniq -c  | sort
http://i.krist.club/soffice.bin_2016-06-04_14-03-16.png
Here it is in chart form - definitely random!

Seems to have a small sine-like wave pattern... Look how it "waves".

Obviously that would be smaller with a bigger sample.


Title: Re: How random is the last digit of a block hash really is?
Post by: CounterEntropy on July 07, 2016, 11:51:11 AM
Normally a standard opinion would say 1 out of 16 but i would rebut in my experience its 1 out 99. But nevermind the hash, and consider this; if you make a certain roll and certain amount to match your roll number to that of the last hash digit then dont do it, theres a less chance youll get it and more btc wasted. But if you have just to guess it without making somebets then go on it doesnt matter if you make a guess as long as you dont lose a significant amount of btc.
They give u the option to bet on multiple options under a certain roll. So, the u have the choice to decide upon your winning probability.


Title: Re: How random is the last digit of a block hash really is?
Post by: rambeazle on July 11, 2016, 06:47:14 PM
Hashes are uniformly distributed over the entire number space, so to answer you question, they are as random as they get. Furthermore, such hashes are routinely used in provably fair algorithms in other sites, sort of like an industry best practice.


Title: Re: How random is the last digit of a block hash really is?
Post by: Cryddit on July 12, 2016, 03:56:28 AM
To be fair: 

You shouldn't rely on the randomness of the hash if people are betting on it.  Especially not after the hashing.

If you have a miner who stands to make more on the bet than they would on the block subsidy, the economics can favor them getting a hash low enough to make a block, but then withholding it, looking for a hash low enough to make the block *AND* having a final digit that will win them the bet as well.  They risk losing the block subsidy if another miner finds a block first, but they can also instantly release the block they found the first instant they get a whiff of the other miner's block, and then they have a nearly-equal chance of getting the block subsidy anyhow.  Meanwhile, they go on looking to win the bet. 



Title: Re: How random is the last digit of a block hash really is?
Post by: cr1776 on July 12, 2016, 11:30:23 AM
To be fair: 

You shouldn't rely on the randomness of the hash if people are betting on it.  Especially not after the hashing.

If you have a miner who stands to make more on the bet than they would on the block subsidy, the economics can favor them getting a hash low enough to make a block, but then withholding it, looking for a hash low enough to make the block *AND* having a final digit that will win them the bet as well.  They risk losing the block subsidy if another miner finds a block first, but they can also instantly release the block they found the first instant they get a whiff of the other miner's block, and then they have a nearly-equal chance of getting the block subsidy anyhow.  Meanwhile, they go on looking to win the bet. 



This.

When there is no incentive to mess with the hash, it may be safe to rely on the last digit. But as was said here (and DH above previously) when there is incentive to do so, it is possible to do so.

Using the last digit of the hash of a single block as the sole random value for a sufficiently large prize is asking for problems.

Even looking at all the values showing it looks random is not sufficient if the lottery drawing (for example) happens every 1000 blocks because you only need to do it once to win a massive sum (eg in the US's Powerball drawing the subsidy is minimal in comparison).  In most of the blocks there is no incentive to select a particular hash so even if someone did it successfully 10% of the time (every 10000 blocks in this example)  it would be undetectable in the noise. 





Title: Re: How random is the last digit of a block hash really is?
Post by: Albert Hamilton on August 20, 2016, 11:08:49 AM
To be fair: 

You shouldn't rely on the randomness of the hash if people are betting on it.  Especially not after the hashing.

If you have a miner who stands to make more on the bet than they would on the block subsidy, the economics can favor them getting a hash low enough to make a block, but then withholding it, looking for a hash low enough to make the block *AND* having a final digit that will win them the bet as well.  They risk losing the block subsidy if another miner finds a block first, but they can also instantly release the block they found the first instant they get a whiff of the other miner's block, and then they have a nearly-equal chance of getting the block subsidy anyhow.  Meanwhile, they go on looking to win the bet. 


So, according to you, if this game goes big, miners may not publish valid blocks and thereby disrupt bitcoin block generation altogether?


Title: Re: How random is the last digit of a block hash really is?
Post by: ranochigo on August 20, 2016, 01:12:20 PM
To be fair:  

You shouldn't rely on the randomness of the hash if people are betting on it.  Especially not after the hashing.

If you have a miner who stands to make more on the bet than they would on the block subsidy, the economics can favor them getting a hash low enough to make a block, but then withholding it, looking for a hash low enough to make the block *AND* having a final digit that will win them the bet as well.  They risk losing the block subsidy if another miner finds a block first, but they can also instantly release the block they found the first instant they get a whiff of the other miner's block, and then they have a nearly-equal chance of getting the block subsidy anyhow.  Meanwhile, they go on looking to win the bet.  


So, according to you, if this game goes big, miners may not publish valid blocks and thereby disrupt bitcoin block generation altogether?
That is if they have sufficient resources to even generate a block. They would probably need a significant hash rate to be able to generate blocks at a reasonable frequency. The miner can always mine the block and start mining on it before publishing it. The miner have a chance to publish two blocks at once and no one else could've solved on it. This theoretically can give them a higher chance of getting the subsequent blocks.

The method mentioned above is quite effective for the attacker and would have a significant chance of succeeding if you have a good amount of hashpower. However, if you do not have a good portion of the network's hash power, your probability of succeeding will be close to insignificant. If someone mined the block when you are withholding it, unless you have a high amount of hash power, more often than not, the block you mined would be orphaned. That obviously depends on which block the miners decided to work on. There is a chance for them to lose both the block reward and the bet altogether.

Miners would have to continue to publish the blocks since the game uses it to determine the results. Bitcoin's block would at the very most be delayed.



Title: Re: How random is the last digit of a block hash really is?
Post by: Dabs on August 27, 2016, 07:29:15 PM
How about the last 2 digits of the block hash? 256 choices / chances.
How about the last 4 digits of the block hash? 65k.

Why not just use the whole block hash, and hash it again. Pair that with another value that is unknown until it is published (but with a SHA256/512 hash) and it's as "provably fair" as it gets. The only one who could cheat is the owner of the site AND if he is a big miner.

Someone else made another site (that has since been gone or sold or something) that computed more hashes for a good half hour (or about 3 blocks worth) on decently powerful hardware so that this eliminated the "miner withholding the block problem", but I think that's overkill and too much work.

My site uses 64 consecutive block hashes, but that's just for following the theme. I could have just use 1 block hash for the same result.


Title: Re: How random is the last digit of a block hash really is?
Post by: Shockaftermoon on September 06, 2016, 12:11:20 AM
never seen this b4 http://www.bitcoinbetting.website/


Title: Re: How random is the last digit of a block hash really is?
Post by: MyBTT on September 09, 2016, 05:31:46 AM
It is random as long miners/pools don't care about the site.

If the bets become bigger than subsidy (25BTC), it gets interesting.

Miners/pools can participate on site, rig future block digit to be zero, and sweep all unsuspecting user's funds who bet on 1.

OH and by the way, I know about system how truly fair betting can be constructed, but it's a secret :)

Lol there is no such thing has truly fair betting. You could use random.org, but their numbers are based on results of a physical anomaly, which is not totally fair.

The best thing atm is probably fair, which has been documented many times.


Title: Re: How random is the last digit of a block hash really is?
Post by: Dabs on September 09, 2016, 01:36:20 PM
Lol there is no such thing has truly fair betting. You could use random.org, but their numbers are based on results of a physical anomaly, which is not totally fair.

The best thing atm is probably fair, which has been documented many times.

I don't know what you're trying to say. If both the site and the player have no way to determine the result before it is shown, then it is fair. Using random.org is fair, but no one wants to use that because people in this bitcoin world want provably fair.

Probably fair is not something anyone wants. The probabilities are there, but you want it proven beyond doubt.


Title: Re: How random is the last digit of a block hash really is?
Post by: CounterEntropy on September 17, 2016, 10:29:13 PM
never seen this b4 http://www.bitcoinbetting.website/
Everything has a first time. No?


Title: Re: How random is the last digit of a block hash really is?
Post by: AOL on September 30, 2016, 11:31:57 AM
The best thing atm is probably fair, which has been documented many times.
It is not probably fair. It is provably fair.


Title: Re: How random is the last digit of a block hash really is?
Post by: Decoded on September 30, 2016, 12:09:27 PM
Lol there is no such thing has truly fair betting. You could use random.org, but their numbers are based on results of a physical anomaly, which is not totally fair.

The best thing atm is probably fair, which has been documented many times.

I don't know what you're trying to say. If both the site and the player have no way to determine the result before it is shown, then it is fair. Using random.org is fair, but no one wants to use that because people in this bitcoin world want provably fair.

Probably fair is not something anyone wants. The probabilities are there, but you want it proven beyond doubt.

I think what he's trying to say is not that nothing is probably fair, but nothing is 100% fair and random. A formula will always be restricted by parameters.


Title: Re: How random is the last digit of a block hash really is?
Post by: Dabs on September 30, 2016, 02:05:11 PM
I think what he's trying to say is not that nothing is probably fair, but nothing is 100% fair and random. A formula will always be restricted by parameters.
I know what he tried to say, I'm just being a jerk about it, grammar police, whatever. :)

But when you say "restricted by parameters", ... 128, 256, or 512 bit output... Not something to worry about from a practical point of view. You can argue about it academically all day, won't really matter as it's essentially unpredictable and random for all intents and purposes except analyzing it. They are deterministic.

To predict a block hash, or any digit of the hash, you would need ... to actually mine.


Title: Re: How random is the last digit of a block hash really is?
Post by: Jimmy Wales on October 04, 2016, 06:53:21 PM
When there is no incentive to mess with the hash, it may be safe to rely on the last digit. But as was said here (and DH above previously) when there is incentive to do so, it is possible to do so.
Recently, www.bitcoinbetting.website made the following announcement...

Maximum bet amount allowed has been raised from 0.1 BTC to 1 BTC. Anything over this amount will be considered as donation.

So, the winning amount, i.e. 16 BTC, is more than a block reward, i.e. 12.5 BTC. Do u think, miners may hold a block now if they place 1 BTC bet with a wrong choice? Appears impossible to me...


Title: Re: How random is the last digit of a block hash really is?
Post by: Dabs on October 05, 2016, 03:28:25 AM
I think the "threshold" for risking losing 99.99% of earning 12.5 BTC is a gamble of how many percent of their hashpower is to the total network of about double or triple. Or 25 BTC. Or more.

No miner in his right mind will give up the current block reward for anything less than double or triple that. I think no miner would give up 12.5 BTC unless the gamble has a higher than 50% chance of earning 25 BTC, or a higher than 75% of earning 50 BTC (if the bet or prize gets that big).

Now if the last digit of a block hash is used in conjunction with a secret, then the website owner would have to collude with a large or strong miner or a pool.

Currently, there is no known single pool or sufficiently large solo miner that has the hashpower to even consider this kind of attack, plus it is a gamble, so why would they do it?

So, the winning amount, i.e. 16 BTC, is more than a block reward, i.e. 12.5 BTC. Do u think, miners may hold a block now if they place 1 BTC bet with a wrong choice? Appears impossible to me...

Nope. Too risky for a winning amount that small. I'd rather take the 12.5 BTC because I have that now. (not even guaranteed).


Title: Re: How random is the last digit of a block hash really is?
Post by: Rupert Murdoch on November 05, 2016, 02:59:27 PM
Hashes are uniformly distributed over the entire number space, so to answer you question, they are as random as they get. Furthermore, such hashes are routinely used in provably fair algorithms in other sites, sort of like an industry best practice.
Is there any mathematical proof of that or it is just an assumption based on previous data?


Title: Re: How random is the last digit of a block hash really is?
Post by: Ya-ing on November 05, 2016, 05:43:57 PM
As I understand randomness... it is not that anything in the computer world is really random. It is just too complicated to calculate and predict.


Title: Re: How random is the last digit of a block hash really is?
Post by: Dabs on November 05, 2016, 07:10:59 PM
Hashes are uniformly distributed over the entire number space, so to answer you question, they are as random as they get. Furthermore, such hashes are routinely used in provably fair algorithms in other sites, sort of like an industry best practice.
Is there any mathematical proof of that or it is just an assumption based on previous data?

As far as I am aware, there is no "proof", not in the mathematical sense. Try this, make a list of numbers from 1 to 1 billion. Get the SHA256 (or any other) hash of these numbers. You'll see, the hashes are uniformly or evenly distributed. It's not perfect.

You can check the last digit and see if you get close to the expected results.


Title: Re: How random is the last digit of a block hash really is?
Post by: FruitBucket on November 05, 2016, 09:04:01 PM
As per proof-of-work: Miners will need to find a hash which contains the right amount of zeros to match the difficulty. If a miner found the right hash in time but it does not match the hex number that he placed the bet one, than he can choose to not submit the block and instead continues to search for a different nonce/hash. This will likely take him on average twice as long and even then there is still a 15/16 chance that if he found a new hash that it is still not the hex number that he placed the bet on. However, meanwhile the miner risks that someone else finds the correct hash - so he is risking his block reward doing this.

The odds are entirely different if the house allows to place bets exactly until the block is announced. In this case the miner could just place a bet before announcing the block to the network. However, it is unlikely that the house would allow these last-minute bets.


Title: Re: How random is the last digit of a block hash really is?
Post by: Dabs on November 06, 2016, 04:05:43 AM
I don't know how other gambling sites operate, but a way to mitigate or lower the risk for the house (or investors) and for all other players to not have a clue about the winning number is to use a delay, and use a secret. As in, don't allow to bet on the block hash itself. But if the game or site we're talking about does that, ... they're asking for trouble.


Title: Re: How random is the last digit of a block hash really is?
Post by: betwithbitcoin8668 on November 06, 2016, 05:41:00 AM
I recently noticed a gambling website (www.bitcoinbetting.website) is offering 4 times return on correctly guessing the last digit of a block hash. I would like to know, how random is the last digit of a block hash really is? Is there any bias towards numbers or letters?

Update: Lately, they have increased return to 16 times for each winning bet.

16 times is too much , that means they didn't make money from it .

And I think people will rarelly play a game with 1/16 chance to win.


Title: Re: How random is the last digit of a block hash really is?
Post by: RocketSingh on November 24, 2016, 04:51:54 PM
16 times is too much , that means they didn't make money from it .
Too much! LoLz... nothing is too much in gambling, as long as it is balanced with odds, which is pretty much the case here.

And I think people will rarelly play a game with 1/16 chance to win.
Gamblers are not so dumb that they'll place a bet on a single option. By betting on multiple options in a single block, they'll increase their chance of win.


Title: Re: How random is the last digit of a block hash really is?
Post by: Viceroy on November 26, 2016, 09:32:05 PM
100% random, and most betting sites use this as their system for fair, verifiable game play.


Title: Re: How random is the last digit of a block hash really is?
Post by: arulbero on December 07, 2016, 12:40:34 PM
I have checked the last digit distribution of every block hash (16 possible values and 442034 blocks):

Code:
BLOCKS : from 0 to 442033 (TOT = 442034)
last
digit         fr.         prob.           unif. -->  1/16=0.0625
0           27520   0.0622576543886                    
1           27881   0.0630743336485
2           27952   0.0632349547772       MAX -->  =+0.00073495777 = +1,16%
3           27892   0.0630992186121
4           27543   0.0623096865852
5           27339   0.0618481836239
6           27674   0.062606043879
7           27691   0.0626445024591
8           27428   0.0620495256021
9           27203   0.061540514983        MIN --> -0.000959485 = -1.54%
10 (a)      27594   0.0624250623255
11 (b)      27554   0.0623345715488
12 (c)      27863   0.063033612799
13 (d)      27616   0.0624748322527
14 (e)      27619   0.062481619061
15 (f)      27665   0.0625856834542

I think it's ok.



Title: Re: How random is the last digit of a block hash really is?
Post by: Syke on December 09, 2016, 06:14:28 PM
I have checked the last digit distribution of every block hash (16 possible values and 442034 blocks):

Code:
BLOCKS : from 0 to 442033 (TOT = 442034)
last
digit         fr.         prob.           unif. -->  1/16=0.0625
0           27520   0.0622576543886                    
1           27881   0.0630743336485
2           27952   0.0632349547772       MAX -->  =+0.00073495777 = +1,16%
3           27892   0.0630992186121
4           27543   0.0623096865852
5           27339   0.0618481836239
6           27674   0.062606043879
7           27691   0.0626445024591
8           27428   0.0620495256021
9           27203   0.061540514983        MIN --> -0.000959485 = -1.54%
10 (a)      27594   0.0624250623255
11 (b)      27554   0.0623345715488
12 (c)      27863   0.063033612799
13 (d)      27616   0.0624748322527
14 (e)      27619   0.062481619061
15 (f)      27665   0.0625856834542

I think it's ok.

It's not enough to check the frequency. For instance, the sequence "1 2 3 1 2 3 1 2 3" has equal frequencies, but is unlikely to be random.


Title: Re: How random is the last digit of a block hash really is?
Post by: cpfreeplz on December 09, 2016, 06:27:08 PM
It's not enough to check the frequency. For instance, the sequence "1 2 3 1 2 3 1 2 3" has equal frequencies, but is unlikely to be random.

If you tried with a few thousand blocks this wouldn't show a more scientific answer rather than "I rolled a die 6x and I got 3 twice, therefore the odds of rolling a 3 on a die is 1 in 3" . It's just not how odds work.


Title: Re: How random is the last digit of a block hash really is?
Post by: dreamhouse on December 10, 2016, 12:20:40 AM
Last digit of block hash should be close to true random. I remember seeing some altcoins generate random blocks using some fixed bits in hash (usually a letter in the middle), and some dev did stats and showed the randomness is almost perfect.


Title: Re: How random is the last digit of a block hash really is?
Post by: valley365 on December 12, 2016, 09:31:22 AM
Last digit of block hash should be close to true random. I remember seeing some altcoins generate random blocks using some fixed bits in hash (usually a letter in the middle), and some dev did stats and showed the randomness is almost perfect.

yes I remember some coins like Jackpotcoin did tests on it, you can check its thread for more detailed info.


Title: Re: How random is the last digit of a block hash really is?
Post by: CounterEntropy on December 14, 2016, 09:48:57 PM
100% random, and most betting sites use this as their system for fair, verifiable game play.
May I know, apart from Chain-Bet.com, who else is using this?


Title: Re: How random is the last digit of a block hash really is?
Post by: cloverme on December 14, 2016, 10:36:50 PM
I'm using it for some elements in my game. For example, the last number in the hash might correlate to the number of asteroids in a sector of space  ;D


Title: Re: How random is the last digit of a block hash really is?
Post by: Bitcoin Gambling on February 13, 2017, 11:24:23 AM
I'm using it for some elements in my game. For example, the last number in the hash might correlate to the number of asteroids in a sector of space  ;D

Nice to see more use cases of the last digit of bitcoin block hash. :)


Title: Re: How random is the last digit of a block hash really is?
Post by: arulbero on April 07, 2017, 12:56:22 PM
New question:

If I generate 2^ 160 distinct points (in secp256k1), then I perform sha256 + ripemd160, I could get 2^160 different values (and then all the possible addresses)?

A point (x,y) is a 512 bit string  -> "04xy" -> sha256 + ripemd160

My guess is: if I generate 2^160 points is like if I generated 2^160 pseudo-random 512 bit strings, so there should be many repetitions.

According to "law of third" -> http://www.roulette30.com/2010/04/law-of-third.html

 I should get only 2/3 * 2^160 distinct values, not the entire space. Am I right or not?

And if I generated 2^161, or 2^162 ? What % of distinct addresses (on the total of 2^160 addresses) I will get?



Title: Re: How random is the last digit of a block hash really is?
Post by: HI-TEC99 on April 08, 2017, 06:07:45 PM
It's not enough to check the frequency. For instance, the sequence "1 2 3 1 2 3 1 2 3" has equal frequencies, but is unlikely to be random.

If you tried with a few thousand blocks this wouldn't show a more scientific answer rather than "I rolled a die 6x and I got 3 twice, therefore the odds of rolling a 3 on a die is 1 in 3" . It's just not how odds work.

+1

There's official government backed standards for testing randomness, and testing software called the NIST Statistical Test Suite software. However, even the official government standards say "statistical testing cannot serve as a substitute for cryptanalysis". Statistical testing by itself isn't enough, and good statistical testing can require 10^18 or more random numbers to test.

The details of the testing software are in this quote from another thread.


NIST produced some software for conducting statistical testing on data produced by random number generators. However it requires compiling, and needs huge data sets to work with.

http://csrc.nist.gov/groups/ST/toolkit/rng/documents/SP800-22rev1a.pdf

Quote
This paper discusses some aspects of selecting and testing random and pseudorandom number generators.The outputs of such generators may be used in many cryptographic applications, such as the generation of key material. Generators suitable for use in cryptographic applications may need to meet stronger requirements than for other applications. In particular, their outputs must be unpredictable in the absence of knowledge of the inputs. Some criteria for characterizing  and selecting appropriate generators are discussed in this document. The subject of statistical testing and its relation to cryptanalysis is also discussed, and some recommended statistical tests are provided. These tests may be useful as a first step in determining whether or not a generator is suitable for a particular cryptographic application. However,no set of statistical tests can absolutely certify a generator as appropriate for usage in a particular application, i.e., statistical testing cannot serve as a substitute for cryptanalysis

This is the download link for the the NIST Statistical Test Suite software.

http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html


Testing if a sequence of numbers is random is incredibly difficult, as random.org points out.

https://www.random.org/analysis/

Quote
If you flip enough coins, you will get sequences of coin flips that seen in isolation from the rest of the sequence don't look random at all. Scott Adams has drawn this as a Dilbert strip, which is funny exactly because it is true:

https://www.random.org/analysis/dilbert.jpg

What Dilbert is told is correct: It is impossible to prove definitively whether a given sequence of numbers (and the generator that produced it) is random. It could happen that the creature in the comic strip has been generating perfectly random numbers for many years and that Dilbert simply happens to walk in at the moment when there's six nines in a row. It's not very likely, but if the creature sits there for long enough (and Dilbert visits enough times), then it will eventually happen.


There is more software for testing randomness called dieharder. It doesn't run all the NIST tests yet, but earlier software it's based on (called diehard) required a default input to work on of ten million random numbers in a file. Dieharder requires much more data than that to run sensitive tests.



http://www.phy.duke.edu/~rgb/General/dieharder.php

Quote
Dieharder differs significantly from diehard in many ways. For example, diehard uses file based sources of random numbers exclusively and by default works with only roughly ten million random numbers in such a file. However, modern random number generators in a typical simulation application can easily need to generate 10^18 or more random numbers, generated from hundreds, thousands, millions of different seeds in independent (parallelized) simulation threads, as the application runs over a period of months to years. Those applications can easily be sensitive to rng weaknesses that might not be revealed by sequences as short as 10^7 uints in length even with excellent and sensitive tests. One of dieharder's primary design goals was to permit tests to be run on very long sequences.

*snip*

In addition to implementing all of the diehard tests it is expected that dieharder will eventually contain all of the NIST STS and a variety of tests contributed by users




Title: Re: How random is the last digit of a block hash really is?
Post by: Andre_Goldman on April 09, 2017, 11:02:18 AM
Hashes are uniformly distributed over the entire number space, so to answer you question, they are as random as they get. Furthermore, such hashes are routinely used in provably fair algorithms in other sites, sort of like an industry best practice.

I read somewhere in textbooks that computers are bad on random because they're designed to be deterministic machines.

edit: typo


Title: Re: How random is the last digit of a block hash really is?
Post by: cloverme on April 09, 2017, 06:17:25 PM
Here's a good example of an interesting project toward random number generation: https://www.fourmilab.ch/hotbits/

Just remember your radiation suit  8)


Title: Re: How random is the last digit of a block hash really is?
Post by: CounterEntropy on October 24, 2017, 06:55:56 PM
Here's a good example of an interesting project toward random number generation: https://www.fourmilab.ch/hotbits/

Just remember your radiation suit  8)
Who'd like to expose themselves to radiation for some random number, while there are abundant sources on earth for the same? :D


Title: Re: How random is the last digit of a block hash really is?
Post by: Dabs on October 27, 2017, 12:47:18 PM
Hmm.. Their house edge is now 6.25% ? 1/16 chance to win 15 times.

Anyone can make money running a site that uses provably fair random numbers, or provably deterministic "random" numbers, based on seeds or block hashes.

The problem is having enough players, so it boils down to marketing, word of mouth, promotions ... I still like to run a site, just can't keep promoting it, so I had to close mine.