-
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
Add random number to neo #2477
Add random number to neo #2477
Conversation
update all related test cases add `GetRandom` contract runtime interface.
remove exception in VRF verify function
@shargon How about this one. I changed my branch to vrf. |
* 'vrf' of https://github.com/Liaojinghui/neo: Fix UT # Conflicts: # tests/neo.UnitTests/SmartContract/UT_ApplicationEngine.Runtime.cs
Test passed, waiting for review. |
@@ -133,6 +133,7 @@ public static Block CreateGenesisBlock(ProtocolSettings settings) => new() | |||
PrevHash = UInt256.Zero, | |||
MerkleRoot = UInt256.Zero, | |||
Timestamp = (new DateTime(2016, 7, 15, 15, 8, 21, DateTimeKind.Utc)).ToTimestampMS(), | |||
Nonce = 2083236893, // nonce from the Bitcoin genesis block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any meaning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any meaning?
nop, we dont really need any meaningful nonce here, it is just a placeholder, so i picked the nonce from the bitcoin genesis block to show our respect to Satoshi Nakamoto.
/// <returns>The next random number.</returns> | ||
protected internal BigInteger GetRandom() | ||
{ | ||
nonceData = Cryptography.Helper.Murmur128(nonceData, ProtocolSettings.Network); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think that merkle tree should be used too, in this way at least the primary will require a brute force to add a transaction, no like now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think that merkle tree should be used too, in this way at least the primary will require a brute force to add a transaction, no like now
this is a temperary solution, ngd is working on a bls solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think that merkle tree should be used too, in this way at least the primary will require a brute force to add a transaction, no like now
We're planning to add a fulling BLS solution. However, since we'd like to launch mainnet next month, not much time left. So at least we must ensure nonce
in header and then we could apply BLS later, should need several months to make it complete.
{ | ||
fixed (byte* p = nonceData) | ||
{ | ||
*(ulong*)p ^= persistingBlock.Nonce; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it's a block it has 8 bytes, and 8 zeros, but if it's temporal, I am not against to it
Merge? |
This pull request implements issue #2456