-
Notifications
You must be signed in to change notification settings - Fork 13
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
btc relay running into Incorrect difficulty target error #84
Comments
Part I - AnalysisThe first part of the analysis is to verify whether the difficulty function Then, I proceeded to look at the specific block that failed, that require writing some tools to fetch all the account history data and see where it started failing. Finding the block requires some parsing of the header and rehash it. This article and difficulty stats page was helpful. The following is the harmony transaction => bitcoin transaction mapping.
Output
Each difficulty epoch lasts for 2016 blocks. The difficulty function is calculated by taking parameters The last working bitcoin block : When I retrieved the data from bitcoin blockchain and called
If it works with bitcoin data, then there is no issue with difficulty function, therefore the state of the contract is the cause... next I wrote a script to pull the states of the parameters
THE STATE PARAMETERS ARE DIFFERENT THAN BITCOIN BLOCKCHAIN! Next steps: Trace down which _submitBlockHeader caused the startEpochTime. It could be caused by a fork, not sure at this moment. We may have to add some error checking to prevent this happen in the future. |
Part II AnalysisThere are total of 45256 The epochStartTime already present on the contract is The conclusion is: The contract was initialized with the wrong parameters. Make sure it is initialized with the correct startEpoch block. Take current block divide by 2016, take the floor to get the Epoch #. Take the Epoch # multiply by 2016 to find your begin epoch. Feed in with the correct target, and time from |
btc relay contract (https://explorer.harmony.one/address/0xf058a288d504fed8535afddef106bfbd48d8e72e) seem to be running into
Incorrect difficulty target error
repeatedly.The text was updated successfully, but these errors were encountered: