Questions tagged [randomness]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5
votes
2answers
2k views

Honest lottery winner generation - pseudo random number obtaining

Suppose I would like to organize a honest lottery and prevent cheating when we need to find a winner. I known problem of random number in the known network arises. I would like to try the following ...
4
votes
2answers
36 views

Block archived event inside blockchain

I want to write a gambling smart contract, that will be based on time (on block number in the ethereum blockchain). What is the best way to do some work when current network block will archive some ...
4
votes
1answer
111 views

Can an Ethereum key generated on a laptop be brute-forced by someone else because of low entropy?

I read this and this tweets. Though, I understand that this issue occur because some people use the same private key mentioned in a blog/forum. But, on the first tweet, people were talking about the ...
3
votes
2answers
138 views

How is consensus in the state achieved if contracts have random output?

I'm quite new to Ethereum so forgive my lack of detail and awareness in this question. I've seen some gambling applications built on Ethereum and I'm wondering how the network agrees on the outcome ...
3
votes
1answer
870 views

Any Pseudo Random Number Generator that can generate different numbers in the same block?

All the Pseudo Random Number Generators that depend on block hash or block time seems to generate the same "random" number for the same block. Is there any way to generate different numbers in the ...
3
votes
1answer
465 views

Are future block hashes viable as an RNG? [duplicate]

Let's say I want to make a gambling contract. Anyone can call the createWager function to create a new bet to flip a coin. When they win, in order to collect the payment for the wager, they have to ...
3
votes
2answers
485 views

Can a miner “cheat” my lottery smart contract?

I developed a smart contract that you: 1) Send 1 ether to an address, the contract saves your address 2) After 5 people have sent one ether, the contract chooses one address at random and sends the ...
3
votes
1answer
135 views

What is the algorithm to select random validators in PoS?

As I know, Ethereum Casper PoS implementation randomly selects 250 validators from the validator poll for an epoch. What is the random algorithm for this selection?
3
votes
0answers
11 views

How does eth2 Random Election Work?

In eth2 validators will be randomly selected. What is the formula for how this random selection works?
3
votes
0answers
1k views

Is this approach to an ethereum lottery sound and/or novel?

I'm looking at making gambling apps is ethereum. Currently made a contract that can flip a coin. After looking at this question: How can I securely generate a random number in my smart contract? and ...
3
votes
0answers
79 views

How can the “Random Beacon” proposal guard against bribes?

The Random Beacon proposal suggests a scheme where K-of-N signatures are used to sign a random number. It suggests that the only way for a random number to be corrupted if all K signers are corrupt; ...
3
votes
0answers
66 views

Will Serenity provide a practical built-in solution for contracts to get random numbers?

As discussed in How can I securely generate a random number in my smart contract?, it's currently quite hard to get a random number reasonably fast to use in a contract. In situations where you can ...
2
votes
2answers
91 views

How to limit N bytes to value range using Oraclize Ledger-Proof Random Number — unfair raffle

Lets say you have 50 tickets to a raffle. You choose to return 4 random bytes from the ledger proof RNG(https://github.com/oraclize/ethereum-examples/blob/master/solidity/random-datasource/...
2
votes
1answer
80 views

Rolling a die at some point in the future

This question has been asked previously by someone else but the answers weren't quite sufficient. I want to write a simple contract that will yield an immutable 'random' number after a period of time....
2
votes
1answer
33 views

Known cases of miners withholding blocks when used as randomness?

There are some applications that use the blockhash as a source of randomness, often with a payout similar to a lottery. I've heard of attacks where it would be more profitable for a miner to withhold ...
2
votes
1answer
33 views

Random number between 0 and 1 - quick little question

I know that the topic of random number has been discussed tremendous amount of times already but I have one small question. I need to get a pseudo random number (not ungamealbe), as simply as ...
2
votes
1answer
88 views

Fair, barely malleable CSPRNG that can still be deterministic?

Just for fun, I wanted to start off making a test contract that generates ERC-20 tokens based off of prime length when in binary representation. I decided to use Rabin-Miller for the primality test, ...
2
votes
0answers
22 views

Increasing the difficulty/cost of manipulating an on-chain PRNG?

well, from what I understand since everything on-chain is deterministic so theoretically there's no way of having a real cryptograhically secure random number generator that cannot be manipulated by ...
2
votes
1answer
65 views

Using oraclize and solidity-util - having trouble splitting string separated by space

I am learning to use Oraclize to connect it to random.org to generate random numbers. Here's my test contract code: pragma solidity ^0.4.25; import "github.com/oraclize/ethereum-api/oraclizeAPI.sol"...
2
votes
0answers
162 views

How bad are future blockhashes as source of entropy exactly?

This is not a duplicate (see below) Before you answer “bad, the miner can influence them”, please let me specify the question. It’s clear that things like timestamp should not flow into a random ...
1
vote
3answers
151 views

a question about oraclize api

anyone know how oraclize api is working. I read the source code files on github.com/oraclize/ethereum_api . it need a "__callback" function in my contract to receive the result, is it means there has ...
1
vote
3answers
651 views

Lottery Random Winner Generator

I am creating a smart contract which simulates a lottery game: users purchase tickets from a fixed pool of tickets, and at the end, a random ticket number is drawn for the winner. I am now concerned ...
1
vote
1answer
30 views

Weighted Random Number Array generation in solidity

I have an array like this in the array, uint256[] public numberArr= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; Each number in an array have their own weight, uint256[] public weightNumberArr = [1, 3, 9, 7, 15,...
1
vote
1answer
44 views

Maximum security data comparison

I want to implement a small guess-the-word game on Ethereum, where the user needs to guess a word from a given set of words. The procedure is following: 1. The user attempts the guess. 1.1. The user ...
1
vote
1answer
124 views

How is account managed in Ethereum blockchain?

What is the process for creating account? (I know I can geth account new, but what is the internal process actually being done?) Where does the entropy for randomness come from when creating an ...
1
vote
1answer
608 views

A possible method for safe random number in lotteries

In the case of the lottery a seed provided to the function that uses block hash can be used to remove the interference from all the parties (miners and house). The seed is selected by the 'house' ...
1
vote
1answer
116 views

What is timelock crypto and how can it be used for random number generation?

In this video Vitalik Buterin talks about timelock crypto and that it's his favorite option for provably fair random number generation https://youtu.be/p5qwbOkCZSc?t=4958. Can anyone explain what ...
1
vote
1answer
1k views

BlockHash used for random number generation [duplicate]

I am designing a lottery smart contract. A winning ticket number is drawn from a pool of tickets. In order to do this, I use the following code: bytes32 blockhash = block.blockhash(block.number - 1);...
1
vote
2answers
210 views

Wallets that sign transactions using true random numbers

From https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm: Another way ECDSA signature may leak private keys is when 'k' is generated by a faulty random number generator. It ...
1
vote
1answer
102 views

Is the blockhash enough for a treasure generating function?

Suppose your contract has a function which generates a random treasure, as illustrated below: function generateTreasure() returns (Treasure) { if (msg.value < 1 ether) return; // cost of ...
1
vote
3answers
41 views

Solidity - Generate multiple, unpredictable random numbers that do not depend on input

I know that the "how to generate random number" in solidity is a very common question. However, after reading the great majority of answers I did not find one to fit my case. A short description of ...
1
vote
1answer
86 views

Preventing manipulation of random number generation for casino contract

I'm reading through the accepted answer to this question on securely creating random numbers for multiplayer blockchain-based casino games. I don't understand the reason for step 4: "Users send their ...
1
vote
1answer
197 views

I have 2 questions. 1: Is it possible to generate an array of random numbers, with every number to distinct, say 10 numbers in range of 0 and 1000?

I know, that using block hash or timestamp is not secure for gambling applications, and I know that I can use Oraclize to get a real random number. But is it possible to ask for an array of distinct ...
1
vote
1answer
1k views

Has random number generation in blockchain been solved?

I've compared the 2 versions of the Ethereum wiki page about the hard problems of cryptoeconomics: https://github.com/ethereum/wiki/wiki/HPOC_2015 https://github.com/ethereum/wiki/wiki/Problems and ...
1
vote
1answer
51 views

Would it be possible to kill Eth network with a lottery contract?

I've read about the problems of randomness in smart contracts (basically that a miner can decide not to publish the block if he doesn't win or benefit otherwise). What if someone posted a lottery ...
1
vote
0answers
71 views

exploiting keccak for random number generation?

Whenever a ticket will be purchased, a random number will be generated function _mightWin() internal { address _player = msg.sender; // players address uint256 ...
1
vote
1answer
143 views

String of random characters [duplicate]

I understood that solidity can only generate pseudo-random numbers. Although, is there any way of generating a, let's say 10 character, random string?
1
vote
0answers
35 views

How can I securely generate a random number in my smart contract at POA?

I heard that a block of random function results can be dropped by a malicious miner. Can POA prevent this? How can I securely generate a random number in my smart contract?
1
vote
0answers
72 views

are all bits of a keccak256 'uniformly distributed'? [closed]

If I have a truly random data source, and generate keccak256 hashes of the numbers of this source: N1 = keccak256(rnd1) N2 = keccak256(rnd2) N3 = keccak256(rnd3) ... are all 256 bits of the ...
1
vote
0answers
39 views

PoA (like rinkeby) safer to generate random number (RNG) this function than POW/POS?

How can I securely generate a random number in my smart contract? I heard that a block of random function results can be dropped by a malicious miner. Can POA prevent this?
1
vote
0answers
32 views

How do mrand.Float64() output the same result with same order in reorganisation?

Recently, I did go deep into the code of reorganisation in blockchain, but I'm confused by the mrand.Float64() in WriteBlockWithState. Here is the code: original code position // If the total ...
1
vote
0answers
39 views

Can one safely use a bitcoin block hash as a source of randomness in an ethereum contract?

This question here Why aren't block hashes a reliable source of randomness? explains why it is not a good idea to use an ethereum block hash as a source of randomness (SoR) for a contract C; the ...
1
vote
2answers
52 views

accessing unpredictable numbers

I see that this has been a widely discussed topic in the past but I still don't understand why the future block hashes shouldn't be used for lottery-type games. As long as the incentive for a miner to ...
1
vote
0answers
126 views

Can the blockchain run a billion dollar lottery?

As many games and other applications, a lottery needs a reliable random number generator. Especially when the prize is high. There are some sophisticated algorithms to achieve this goal, such as ...
1
vote
0answers
60 views

Oracles and randomness, Creating or solving problems? [duplicate]

The idea behind oracles as a way to outsource information to be off the blockchain (Verifiable computing), Can solve a lot of problems, mostly related to randomness, As well as interacting with other ...
0
votes
2answers
264 views

Calculate probabilities

I create a random number starting from block.coinbase, block.number and block.timestamp, then I determine some probabilities. Is it correct or there is a better way? bytes32 bHash = keccak256(block....
0
votes
1answer
13 views

changing source of random number based on reward?

Would this be an acceptable way to produce a random number dependent on the reward? Say if the reward is high enough to entice a miner to manipulate the block then the contract will utilize oraclize. ...
0
votes
1answer
2k views

i want get random number between 100-999, as follows

function random() internal returns (uint) { uint random = uint(keccak256(now, msg.sender, nonce)) % 1000; nonce++; return random; } In this way, you can generate random numbers, but there ...
0
votes
2answers
312 views

Why aren't block hashes a reliable source of randomness?

I just saw this answer that informed me that block hashes were not a reliable source of randomness. In what situation are block hashes not a reliable way to obtain randomness?
0
votes
2answers
38 views

generation random number

uint private seed; // starts from 0 (including) to _length number (excluding) function random(uint _length) private returns(uint) { seed = seed.add(block.timestamp.add(uint(msg.sender))); ...