-
Notifications
You must be signed in to change notification settings - Fork 26
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
what is latest solution for Lwma? #73
Comments
in latest source code of BTC exist https://github.com/bitcoin/bitcoin/blob/master/src/chain.h#L24 https://github.com/bitcoin/bitcoin/blob/master/src/chain.h#L40 https://github.com/bitcoin/bitcoin/blob/master/src/timedata.h#L16 what wll be correct for T=60 N=90 ? i was think about settings static constexpr int64_t MAX_FUTURE_BLOCK_TIME = 5 * 60; static const int64_t DEFAULT_MAX_TIME_ADJUSTMENT = 3 * 50; static constexpr int64_t MAX_BLOCK_TIME_GAP = 4 * 60; and at latest BTC source exist this https://github.com/bitcoin/bitcoin/blob/master/src/pow.cpp#L76 https://github.com/bitcoin/bitcoin/blob/master/src/headerssync.cpp#L189 https://github.com/bitcoin/bitcoin/blob/master/src/headerssync.cpp#L237 |
I've decided on much longer averaging windows because I could never determine there was a benefit to faster averaging periods when there is on-off mining. Longer windows make difficulty smoother for everyone. Just now I edited the code below to recommend much larger N values. The code is a modification of Bitcoin Gold to correct an error I made way back then in directing their dev and to make it easier to understand what's happening than the way he implemented the constants. For T=60 in a small coin I use would use N=360 which is a 6 hour averaging window with a StdDev of error of 1/SQRT(N) = 5.2%. See comments I added to the code to explain the consequences better: OK, using my rule that FTL (MAX_FUTURE_BLOCK_TIME) needs to be 1/20 of T*N to limit difficulty manipulation to 5% and "Peer Time" (DEFAULT_MAX_TIME_ADJUSTMENT) needs to be 1/2 of that, I get: static constexpr int64_t MAX_FUTURE_BLOCK_TIME = BLOCK_TIME * N / 20; I think it's important to make everything possible a function of the params files like I've done above so that future changes to the constants in the params files don't cause a surprise to unsuspecting future devs. This last constant is based on my interpretation of what I think it does. I think it just determines when you get a message to warn you're not synced. It's rare to have solvetimes taking longer than 9 block times, so for BTC T=600, they chose 90 minutes. The pull request link above the setting says they increased it from 6 to 9 block_times (60 to 90 minutes) so that the message occurs less often. If it's been 7 or 8 block_times since last block, then they won't automatically get the warning that says they're not synced. GM said 9 means the message would occur and yet be a false warning (they're actually synced) 6.4 times a year, so with T=60 instead of 600, you would expect 64 times a year if everything's the same. So I decided 9 was too low for T=60 and set it to 12. It's only 3 extra block times, but it will be a very rare event if hashrate doesn't vary much. 12 is extremely rare but small coins will vary in hashrate more than BTC. Concerning that validation code section below BTC's difficulty algorithm, I tweeted this. |
i recieved your mail , about that code validation header code that realy strange why they simple not validate with algo.
about js vatinat , i simple try convert code at GPT chat , but not tested yet and not look if it correct 99% it some where will be incorrect :)
or
|
i have qustion about n=360 , for 60s Isn't 6 hours too much? |
It makes the difficulty nice and smooth and I never noticed a problem from making it long. For a very long time I was biased towards fast response times and everyone followed my advice. But I was basing it on coins having terrible problems including getting stuck if they kept monero's algorithm which has a 1-day average. What I didn't realize was that monero does 2 or 3 things in addition to being a simple moving average that were causing most of the problem. It has a lag and something else that I think throws out the extremes, and it might do a sorting. The big problems were caused by delaying the adjustments and rejecting the most recent solvetimes. N=360 is probably going to make it the best LWMA currently out there due to my incorrect old recommendations. Also, it was only when the 3rd really smart person said "you probably need the windows a lot longer" that I finally realized my mistake. |
the question is whether it makes sense to update the algorithm in an existing coin ( not new ) to a new version or just fix the time variables, and N . since in the comments there is mainly protection of new coins from crutches ( like use old native algo for first N blocks etc... ) old what used now.
with N = 90 |
What is latest solution for Lwma?
And was setting is correct for T 60 and N 90?
Latest bitcoin sources.
The text was updated successfully, but these errors were encountered: