Author

Topic: Looking for random number generator based on blockchain (Read 194 times)

legendary
Activity: 3010
Merit: 3724
Join the world-leading crypto sportsbook NOW!
Adding on to the very suitable suggestions above of using hash of future block, I even think simpler outcomes like tx count or input count are easier and plan to use it for a future lottery I'll be doing (hash is simple for me but it does seem to confuse others).

A lot easier to collude than hash, but as pointed out above as well, absolutely doesn't make financial sense for such a small prize, if anyone would think a miner might collude to win it might as well pursue flat earth theories.
legendary
Activity: 2268
Merit: 18771
All it does it change the random, which leads to a different winner.
The assumption is that the miner would be changing the winner to themselves or someone who is willing to split the prize with them. But as above, the chance of them finding a block which also picks the "right" winner from 100 or more tickets is very small indeed.

In case of collusion with miners to cheat the lottery, I would assume the host is in on it. So the miners will know the content of the hidden hash, and can use that to alter the outcome.
So you get the host to commit to a block number without revealing it, such as via a hash as I suggested above. You also get every participant to commit to an offset number, also without revealing it, say between -500 and +100. Assuming the number of participants is n, then the host waits until 100*n blocks beyond the block number they chose (just in case every participant chose +100 as their offset number), and then reveals the block number. All the participants also reveal their offset number, everything is summed, and that is the block number you use to pick the winner. Provided at least one participant is honest, then the block number cannot be predicted. And if every participant is in on the scam, then what's the point in the first place?

But again, this is all needlessly complex and would only even be worth thinking about if the competition in question had a prize worth millions or even tens of millions of dollars.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
And you can easily mitigate this by posting a hash of a message saying which block will choose the winner, and the revealing the contents of that hash after the block in question has been mined.
In case of collusion with miners to cheat the lottery, I would assume the host is in on it. So the miners will know the content of the hidden hash, and can use that to alter the outcome.
It's all quite far fetched though, especially since changing the block hash doesn't even guarantee a certain desired result. All it does it change the random, which leads to a different winner.
legendary
Activity: 2268
Merit: 18771
Even the block chain result could be swayed one way or another it would seem.
You would need a miner which has enough hashrate to produce multiple valid blocks in the time it takes the rest of the network to find a single valid block, and the prize of the competition would have to be sufficient for the miner to sacrifice a guaranteed block reward (currently in the region of $108,000) for a chance at winning your prize. Assuming 100 tickets, then even if the miner got incredibly lucky and found 3 blocks in the time it took the rest of the network to find one, you are still only talking about a less than 3% chance of finding one which lets them win. So as nc50lc points out, you would need a prize in the region of millions of dollars to make it even worth attempting.

And you can easily mitigate this by posting a hash of a message saying which block will choose the winner, and the revealing the contents of that hash after the block in question has been mined.
legendary
Activity: 3696
Merit: 2219
💲🏎️💨🚓
I want there to be no doubts and everyone was sure that the draw was 100% fair.

That's the vexed question most participants of any competition have that a draw is unbiased.  The pilot episode of the TV series M*A*S*H has the winning ticket taped to the bottom of the glass jar.  Lotteries with ping pong balls have been rigged where a dot of paint was applied to weigh down some balls so others would be favoured.  Cards can be marked and roulette wheels have magnets to pull the ball to a certain slot - the list of rigged games of chance are seemingly endless from a search online.

If you start with the notion that your participants will accept the method used to draw results, then there shouldn't be any questioning of the results once they are obtained.

It may be me, but I never liked random.org -based contests/raffles; there was always a chance the organizer may not play fair.

That's quite true and your point is completely valid.  You've hit the nail on the head that sites such as random.org can be perceived as being biased and it's only the OP's word if they were to use a screen shot of the results hence the use of something beyond the control of us mortals (the block chain hashes).

So imho the previous answers are explaining good some easy options OP can use.

My suggestion was if the OP is interested in further reading on the subject of randomness in general.




Also, do not use it if the amount at stake is a lot higher than the block reward (like 10x+) since a pool/solo miner can risk it to try produce another block hash with the winning number.

Even the block chain result could be swayed one way or another it would seem.
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
If you're interested in further reading then head over to random.org which has information on true randomness based on background noise versus longstrings of numbers.

There are tools for generating sets of numbers, scrambling lists - even choosing truly random colour palates. (Plus there is an app for your phone for random generation on the run).

It may be me, but I never liked random.org -based contests/raffles; there was always a chance the organizer may not play fair.
And I think that OP's point was not to generate "black box" randomness he cannot prove (and get accused he didn't do a fair draw) and instead use blockchain for obtaining in a transparent manner a "random enough" number whenever it's needed.

So imho the previous answers are explaining good some easy options OP can use. (I find the answer given by o_e_l_e_o the most complete and with good example too for easy understanding.)
legendary
Activity: 3696
Merit: 2219
💲🏎️💨🚓
If you're interested in further reading then head over to random.org which has information on true randomness based on background noise versus longstrings of numbers.

There are tools for generating sets of numbers, scrambling lists - even choosing truly random colour palates. (Plus there is an app for your phone for random generation on the run).
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
It is possible that someone has dealt with something like this and will answer here, if not, I will use your idea. Thanks
There's a downside to that method though: you can't provide an exact time of the draw since blocks aren't always on schedule.
If the application is not strict to schedule, then it's good.

Also, do not use it if the amount at stake is a lot higher than the block reward (like 10x+) since a pool/solo miner can risk it to try produce another block hash with the winning number.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
Is there any service/website that provides something like this?
I've provided this service for Little Mouse.

Quote
(It's not about building something like this from scratch, because I'll probably need this only once.)
There's not much to it: choose a future block, and take the hash as input to create a semi-random result. This works for any number of participants.
legendary
Activity: 2352
Merit: 6089
bitcoindata.science
I asked because I think I saw someone using something like this a while ago in some Bitcointalk contest. However, when I googled it, I couldn't find anything like that.
Yes, using data from a block header is the most common way to settle a competition in a provably fair way, since it would be almost impossible for the person running the competition to manipulate the outcome.

Essentially, you get everyone to pick a number. Once all the votes are in, you pick an arbitrary block not too far in the future, look at its hash, and figure out the winner based on whatever criteria you used.

This is the most common method and it is used quite a look in bitcointalk games and round section.

One example here:
https://bitcointalksearch.org/topic/free-raffle-continental-south-america-only-2-coins-1-round-1-loaded-5405097
legendary
Activity: 2268
Merit: 18771
I asked because I think I saw someone using something like this a while ago in some Bitcointalk contest. However, when I googled it, I couldn't find anything like that.
Yes, using data from a block header is the most common way to settle a competition in a provably fair way, since it would be almost impossible for the person running the competition to manipulate the outcome.

Essentially, you get everyone to pick a number. Once all the votes are in, you pick an arbitrary block not too far in the future, look at its hash, and figure out the winner based on whatever criteria you used.

For example, the latest block is 765990, with the hash 000000000000000000019e0b0004a91010b557be966bfae8718a584d0d15a656. Bear in mind the hash is in hex, so the characters are from 0-9 and a-f.

So you could release 16 tickets from 0-f, and whoever matches the final character wins.
Or you could release 100 tickets from 00-99, and whoever matches the final two numbers wins (ignoring any letters).
Or you could release 256 tickets from 00-ff, and whoever matches the final two characters wins.
And so on.
sr. member
Activity: 1112
Merit: 256
Why not use the numbers or letters generated on a particular block? Like get the end of that and based on it or something.

Like block number X, let's say 766000. Get the hash of that, like 00000-42787 or something, then that's it.

The winning number would be 7. Or if you are choosing 00 - 99, it would be 87, something to that regard. Maybe this could help without generating anything like a program of some sort.

Interesting idea. Thank you for your suggestion.
I asked because I think I saw someone using something like this a while ago in some Bitcointalk contest. However, when I googled it, I couldn't find anything like that.
It is possible that someone has dealt with something like this and will answer here, if not, I will use your idea. Thanks
copper member
Activity: 2940
Merit: 1280
https://linktr.ee/crwthopia
Why not use the numbers or letters generated on a particular block? Like get the end of that and based on it or something.

Like block number X, let's say 766000. Get the hash of that, like 00000-42787 or something, then that's it.

The winning number would be 7. Or if you are choosing 00 - 99, it would be 87, something to that regard. Maybe this could help without generating anything like a program of some sort.
sr. member
Activity: 1112
Merit: 256
Hello,

I am organizing a contest in which there will be a certain number of users. Everyone has a number.
In order to award a prize to one user, I'd like to make a blockchain based draw.
I want there to be no doubts and everyone was sure that the draw was 100% fair.
Is there any service/website that provides something like this?
(It's not about building something like this from scratch, because I'll probably need this only once.)
Jump to: