Skip to content
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

Merged
merged 65 commits into from
Jun 30, 2021
Merged

Add random number to neo #2477

merged 65 commits into from
Jun 30, 2021

Conversation

Jim8y
Copy link
Contributor

@Jim8y Jim8y commented May 19, 2021

This pull request implements issue #2456

@Jim8y
Copy link
Contributor Author

Jim8y commented May 19, 2021

@shargon How about this one. I changed my branch to vrf.

vncoelho
vncoelho previously approved these changes May 23, 2021
@Jim8y Jim8y changed the title Add VRF random number to neo Add random number to neo Jun 24, 2021
@nicolegys
Copy link
Contributor

Test passed, waiting for review.

Qiao-Jin
Qiao-Jin previously approved these changes Jun 28, 2021
@@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any meaning?

Copy link
Contributor Author

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);
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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;
Copy link
Member

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

@superboyiii
Copy link
Member

Merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants