Skip to content

Commit

Permalink
add randomX seed information
Browse files Browse the repository at this point in the history
  • Loading branch information
Boog900 committed Jan 6, 2024
1 parent 41e769f commit 6629bf6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/consensus_rules/blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ The proof of work function used depends on the hard-fork[^pow-func]:

See [checking POW in the difficulty chapter](./blocks/difficulty.md#checking-a-blocks-proof-of-work).

### RandomX Seed

The RandomX seed, which is used to set up the dataset, is a previous block hash in the blockchain.

The seed height is 0 if the current height is below or equal to \\( 2048 + 64 \\) otherwise is got by:

\\(seedHeight = (height - 64 - 1) & ¬(2048 - 1)\\)

with `&` being a bit-and and `¬` being a bit-not.

You then get the block hash at `seedHeight` which is then the RandomX seed.[^rx-seed]

### Version And Vote

The blocks major version must equal the current hard-fork and the vote must be equal to or greater than the current hard-fork[^version-vote].
Expand Down Expand Up @@ -87,6 +99,8 @@ the median timestamp over the last 60 blocks[^timestamp-lower-limit], if there a

[^202612-pow-hash]: <https://github.com/monero-project/monero/blob/67d190ce7c33602b6a3b804f633ee1ddb7fbb4a1/src/cryptonote_core/cryptonote_tx_utils.cpp#L683>

[^rx-seed]: <https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/src/crypto/rx-slow-hash.c#L179-L186>

[^version-vote]: <https://github.com/monero-project/monero/blob/eac1b86bb2818ac552457380c9dd421fb8935e5b/src/cryptonote_basic/hardfork.cpp#L109>

[^timestamp-upper-limit]: <https://github.com/monero-project/monero/blob/eac1b86bb2818ac552457380c9dd421fb8935e5b/src/cryptonote_core/blockchain.cpp#L4064>
Expand Down

0 comments on commit 6629bf6

Please sign in to comment.