Linked Questions

0
votes
1answer
683 views

How to create random number in solidity except sha3? [duplicate]

I am using sha3 to create 3 unique id in a same function. But results are same for all of them because it is using timestamp like this "uint256 random = uint256(sha3(block.timestamp)) +1;". So, I ...
2
votes
1answer
385 views

Random number inside contract [duplicate]

It is possible to generate truly (not pseudo) random number with specific range inside smart contacts (for example I need random number between 1 and 60 000 ) Thx!
2
votes
1answer
352 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 ...
2
votes
2answers
98 views

Best practices for generating a random uint256 [duplicate]

I've read through this thread and this thread and they offer a lot of interesting techniques, but what's the minimal code snippet for the currently accepted method of generating a random number in ...
3
votes
0answers
77 views

Which is the safest way to generate a random number? [duplicate]

I need a function that generates a random number from 0 to n for the lottery. I found 2 ways to do that: 1. https://gist.github.com/alexvandesande/259b4ffb581493ec0a1c But miners can influence the ...
1
vote
0answers
52 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
0answers
15 views

What's the best realized dapps for fair betting without oracles? [duplicate]

Pretty much self-explanatory. I accept all kind of suggestions.
14
votes
5answers
30k views

Where can I find some Solidity / Smart Contract source code examples? [closed]

Is there an easy to access list of Solidity / Smart Contracts / Dapps source code examples? Related information: Is there a list of DAPPS that are already useable? Where can I learn how to develop ...
20
votes
3answers
5k views

Can a contract safely rely on block.timestamp?

How safe is it to use block.timestamp as contract expiration time? If a miner provides an incorrect timestamp in a block header, how much can it be off before it is rejected by other nodes? Is there a ...
21
votes
1answer
3k views

When can BLOCKHASH be safely used for a random number? When would it be unsafe?

I've seen more complicated ways for a contract to generate a random number. But the Ethereum Yellow Paper itself suggests a "trivial solution" using the BLOCKHASH opcode (see below, bold is mine). ...
13
votes
3answers
926 views

What are effective and secure ways of shuffling a deck of cards in a contract?

We want to write a card game in Ethereum. What are effective and secure ways of shuffling a deck of cards in a contract, and dealing them to players? It needs to be done in a way so that no one can ...
5
votes
2answers
1k views

How to stop miner who does not execute operations?

When a miner evaluate operations on VM there might be a case when there is not enough gas to fulfill operation. In such cases "The miner will stop processing the transaction, revert any changes ...
6
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 ...
1
vote
2answers
2k views

Is it possible to create a unique hash inside geth?

When we make a transaction call, we get the transaction hash right away. As mentioned here we could not get transaction's hash inside the contract's function. Would it be good idea to set a variable ...
6
votes
1answer
972 views

do the contracts of ethereum have the access to the nonce of the blocks?

by this question I mean when we try to develop a gambling game contract we need some random input, can we just use the nonce data from some certain blocks? (I just start learning blockchain, I'm from ...

15 30 50 per page