-
Notifications
You must be signed in to change notification settings - Fork 106
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
Difficulty algorithm #113
Comments
should definitely be changed. Is 1 ok as min? |
Monitoring closely... We have implemented the forknote LWMA code as is and running tests. If there are recommended changes then we would be interested in implementing them before our coin goes live. |
@2acoin If you difficulty is not going start stay above 10,000,000 then delete
It's in Currency.cpp I believe. Also, look for future_time_limit in your config params file and change it to 500 instead of 60*60*2. That a VERY important change @pmitchev I am surprised karbo and I did not make sure you had made that change. Intense lost 5000 coins in about an hour from that. Here it is:
Lag must be zero in both zawy v1 and LWMA
This is still set to 720 instead of 61! No one should use the code as it is until the above changes are made. I have an equation that is needed to replace that 60 above. But I don't know if you can just throw it in there N should be a function of the target solvetime:
I would like for you to copy and paste our code into your currency.cpp file I did this post rushed, so please send me links to commits before merging. |
The code is indeed still unsafe for coins different than Karbo. The configuration file for Karbo is here (DIFFICULTY_LAG and DIFFICULTY_WINDOW are correct): I used this formula (found in Karbo's codebase), because I needed generalised formula for finding N (N is configurable - ZAWY_LWMA_DIFFICULTY_N in karbowanec.conf). The commit with the Zawy LWMA difficulty changes: |
Dashcoin, Bytecoin and Blood Donation Coin is update to Block Version V4, then the pools should have the updated cryptonote updated to be compatible. |
@zawy12 I have made some modifications to the ForkNote LWMA code as you had suggested in an earlier comment above. Can you take a look at the changes I made in this branch of our 2ACoin code? Our 2acoin.conf looks like the following;
I'm starting some testing with this code this evening. |
Set the following. For T=90 seconds, N=90 is about I don't the equation I previously used, and using it only in the LWMA algo may mean you do not have the right timestamp and difficulty vectors. It's +1 because
and in the algo use: The new reference version is what Masari and I worked on today: There's still some casting I would like to simplify. |
Correction, @GABETRON pointed out this morning there is an exploit in the masari version if the newest commits by masari are not followed. The following change much be made. |
@zawy12 Can you take a look at this branch for 2ACoin? I have made the suggested updates... I also have LWMA setup to be the default difficulty setting for our coin by including ZAWY_DIFFICULTY_LAST_BLOCK=5 in our config file. Our testing is progressing and the results look promising... You can see our tests via our pool - pool.2acoin.org |
If you can wait a day or two for devs to reveiw the code and test it, I have something a lot better: https://github.com/zawy12/difficulty-algorithms/wiki/Dynamic-LWMA |
@zawy12 2ACoin can wait... We have a few weeks before we launch. Looking forward to testing with the Dynamic-LWMA... |
I still have some doubts and I intend to make the fork soon to reduce the N window to 70, I have this original code: https://github.com/BloodDonationCoinDev/bbrc-config/blob/master/BloodDonationCoin-Original.conf |
These changes need to be made to the current code. In config file, change
to 360 and 11. In Currency.cpp delete the following (does not allow difficulty to go below 100,000). Kabo added this specifically for their high difficulty.
Change this line Change all this
To:
I don't know why m_difficultyTarget is used instead of DIFFICULTY_TARGET. This: |
solveTime = std::min<int64_t>((T * 6), std::max<int64_t>(solveTime, (-360T))); What do you mean by this line? |
Typo...Change the 360T to 360. |
Also there is a huge benefit I'm calling LWMA-2: Add this
right after this: And put this: And declare |
Here's the new LWMA-2. |
What's N inside forknote's LWMA? What's the size of the timestamps and cumulative diofficulties vectors that are passed to the LWMA before this code is potentially activated?
My concern is DIFFICULTY_WINDOW in the config file is 720. If that is the size of the vectors and N=60 like it should, then the resize above removes all the recent block data and sets difficulty as it needed to be 24 hours in in the past, making it worse than cryptonote default algorithm. Also, I'm still getting emails from coins shocked that their fork or genesis is broke and I have to explain the following is the problem:
|
Hi @zawy12, could you reference me to the latest stable version of forknote plz. Seems the one on official forknote repo with the LWMA is giving error - I can't find how to get rid of "proof of work too weak" |
I do not know if forknote has an LWMA that is working correctly. The problem is that I can't determine what size the timestamps and cumulative difficulties vectors are when they are sent to the LWMA. |
Karbo and I got Forknote to update the difficulty algorithm to LWMA, but we did not make it clear that we were not ready for an LWMA to be chosen (out of the several that are out there). The LWMA forknote has only 1 problem that I know of which is this that will be a big problem if a coin has, or starts out with low difficulty.
if (next_difficulty < 100000) { next_difficulty = 100000; }
This is in the Currency.cpp file.
There are also potential variable declaration problems that may not show up on testnet but could show up in the mainnet. One is that double everywhere instead of double_t is more sure to be the same on all systems. But the code as forknote has it is working fine on karbowanec.
I would like to coins using the code here which you should be able to copy and paste into the forknote curency.cpp file.
I am not asking forknote to re-commit and merge. There are sure to be more changes coming, such as changing it to integer math, correcting any other problems found, and making it a "Dynamic LWMA"
The text was updated successfully, but these errors were encountered: