Skip to content

Instantly share code, notes, and snippets.

@jeasonstudio
Created April 7, 2024 10:03
Show Gist options
  • Save jeasonstudio/1c0de024296791eb647c693a80804e2f to your computer and use it in GitHub Desktop.
Save jeasonstudio/1c0de024296791eb647c693a80804e2f to your computer and use it in GitHub Desktop.
Calculate #EggFarm total hash rate
/**
* 预估 #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