Created
April 7, 2024 10:03
-
-
Save jeasonstudio/1c0de024296791eb647c693a80804e2f to your computer and use it in GitHub Desktop.
Calculate #EggFarm total hash rate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 预估 #EggFarm 的总算力 | |
* @param {number} difficulty 当前难度 | |
* @param {number} intervals 间隔时间,预期是 60s,但目前比较短,需要按实际情况估算,单位秒 | |
*/ | |
const calcHashRate = (difficulty, intervals = 60) => { | |
const baseDifficulty = 0x10c6f7a0b5ed8d0000000000000000000000000000000000000000000000; | |
const target = baseDifficulty / difficulty; | |
const hashRate = | |
1 / | |
((target / | |
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) * | |
intervals); | |
return hashRate; | |
}; | |
console.log(calcHashRate(0x1d00ffff, 60)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment