News for hackers. Stuff that matters.
Re:The NFT market bubble has popped? by SuchAnonMuchWow on Thursday June 03, 2021 @08:38AM (#27380338)
You can just make the participants of a bet provide each a random number, and xor their results. If even one of them picked a real random number, the result will be random.

This is the basis of most distributed random number selection algorithm, which existed since a lot before blockchains.

In a smart contract, it could look like something like that:

1- each person which want to participate in the bet pick a random number, then send: their bet (0 or 1), the hash of the random number, and of course money to bet.

2- after some specified time, the first phase finish and no new person can bet. now everyone has to send their actual random number to the smart contract

3- after some specified time again, every random number gathered which had the correct hash are xored. If the popcount of the result is even, 0 win. otherwise 1 win. Everyone who send their random number and guessed correctly get a share of the total amount.

edit: note that I'm not overly familiar with smart contracts, so if this cannot work I would love to be explained why.

Re:The NFT market bubble has popped? by hiq on Thursday June 03, 2021 @10:07AM (#27381571)
With your scheme, on Ethereum at least, miners have an advantage since they choose which transactions to include in a block they mine. So a miner would only process the random numbers sent in 2. if it results in a win for them.

Of course there is more than one miner etc., but having a positive expected outcome is enough to be worth it to play.