Skip to content

feat: increase difficulty to 40m hash #224

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions hardhat/contracts/LilypadPow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ contract LilypadPow is Initializable, OwnableUpgradeable {
uint256 timestamp;
}

// todo difficulty may need to adjust in test
// this difficulty was calculate with this tool https://github.com/hunjixin/pow-tool/tree/main/difficulty
// Theoretically A machine with a hash rate of 8M has a probability of no more than 0.01% of not finding a nonce that meets the difficulty within 20 blocks.
// However, this issue has not been well validated in practice. it can solve nonce within one minute most of the time.
uint256 public targetDifficulty; // =
//555460709263765739036470010701196062214039696708679004195670928130048;
uint256 public targetDifficulty;
mapping(address => POWSubmission[]) public powSubmissions;
address[] public miners;

Expand All @@ -44,7 +39,9 @@ contract LilypadPow is Initializable, OwnableUpgradeable {
// https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable
function initialize() public initializer {
__Ownable_init();
targetDifficulty = 555460709263765739036470010701196062214039696708679004195670928130048;
// this difficulty was calculate with this tool https://github.com/hunjixin/pow-tool/tree/main/difficulty
// Theoretically A machine with a hash rate of 40M has a probability of no more than 0.00001 of not finding a nonce that meets the difficulty within 36 blocks.
targetDifficulty = 92576780592126171815437600338300430792573009392238517278497593884672;
}

function getMinerCount() public view returns (uint256) {
Expand Down Expand Up @@ -154,7 +151,8 @@ contract LilypadPow is Initializable, OwnableUpgradeable {

function triggerNewPowRound() external onlyOwner {
window_start = block.number;
window_end = block.number + 30; //todo arbitary value , need to discuss
// give 6 block time to confirm challenge, 30 block time used to calculate proof
window_end = block.number + 36;
emit NewPowRound();
}

Expand Down
Loading
Loading