Expand description
DarkFi PoW module
Structsยง
- PoWModule
- This struct represents the information required by the PoW algorithm
Constantsยง
- BLOCKCHAIN_
TIMESTAMP_ ๐CHECK_ WINDOW - How many most recent blocks to use to verify new blocksโ timestamp
- BLOCK_
FUTURE_ ๐TIME_ LIMIT - Time limit in the future of what blocks can be
- BUF_
SIZE ๐ - Ring buffer length. Must be == DIFFICULTY_WINDOW + DIFFICULTY_LAG
- CUT_
BEGIN ๐ - Already known cutoff start index for this config
- CUT_END ๐
- Already known cutoff end index for this config
- DIFFICULTY_
WINDOW ๐ - Amount of max items(blocks) to use for next difficulty calculation. Must be >= 2 and == BUF_SIZE - DIFFICULTY_LAG.
- RANDOMX_
KEY_ CHANGE_ DELAY - RandomX VM key change delay
- RANDOMX_
KEY_ CHANGING_ HEIGHT - RandomX VM key changing height
- RETAINED ๐
- Max items to use for next difficulty calculation. Must be DIFFICULTY_WINDOW - 2 * DIFFICULTY_CUT
- _DIFFICULTY_
CUT ๐ - Used to calculate how many items to retain for next difficulty calculation. We are keeping the middle items, meaning cutting both from frond and back of the ring buffer, ending up with max DIFFICULTY_WINDOW - 2DIFFICULTY_CUT items. (2DIFFICULTY_CUT <= DIFFICULTY_WINDOW-2) must be true.
- _DIFFICULTY_
LAG ๐ - Amount of latest blocks to exlude from the calculation. Our ring buffer has length: DIFFICULTY_WINDOW + DIFFICULTY_LAG, but we only use DIFFICULTY_WINDOW items in calculations. Must be == BUF_SIZE - DIFFICULTY_WINDOW.
Functionsยง
- generate_
mining_ vms - Auxiliary function to generate mining VMs for provided RandomX key.
- get_
mining_ flags - Auxiliary function to define
RandomXFlagsused in mining. - init_
dataset ๐ - Auxiliary function to initialize a
RandomXDatasetusing all available threads. - mine_
block - Mine provided header, based on provided PoW module next mine target, using provided RandomX VMs setup.