-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get Truly Random number #2889
Comments
It can't work this way, different nodes would get different numbers and different execution results for the same input resulting in different state. |
maybe remove this functionally all together and add a native contract on the blockchain. Will that work? |
No, that will be precalculatable, attackers does not even need to predict. Current random solution is temporary, we are working on a BLS solution or other distributed random beacon solution.#2749 #2477 #2456 neo-project/neo-modules#637 |
@Liaojinghui the sounds of it, they are still going to use nonce but with BLS. But you can still make transaction manually and set the nonce to lets say "ZERO". Wouldn't that defeat the purpose of GetRandom. Users are expecting something made by a random number generator with a decent random algorithm? Edit: let's say we have a game on the blockchain that uses "GetRandom" and it's as a gambling game. One could set nonce manually and beat the odds or break it. It's a little far out their yes. |
we dont use transaction Nonce for random number generation. |
@Liaojinghui In new or old implementation? at least it called nonceData, look like it uses the hash with nonce to make a ulong
|
Its not related to the transaction nonce. random number is sort of related to the tranaction hash, not nonce. |
Summary or problem description
Using/Hashing Nonce as a seed for a new random number is not ideal. It can be predicted. And you don't get huge numbers, defeats the purpose of using BigInteger. yes Nonce uses Random. but that uses system time as a seed, and since timestamp is on the block that number can be predicted as well. Also using Murmur128 is bad and can be reversed.
Also anyone can set the transaction Nonce to whatever they want
neo/src/Neo/Wallets/Wallet.cs
Line 561 in d63eb1d
Wikipedia MurmurHash
Do you have any solution you want to propose?
Update The GetRandom to use a truly random number for BigInteger
neo/src/Neo/SmartContract/ApplicationEngine.Runtime.cs
Line 304 in d63eb1d
to
Where in the software does this update applies to?
The text was updated successfully, but these errors were encountered: