Fork Indicator and easy or automated fixing

Techonology


Mark one
[x] Divi Desktop
[ ] Divi Core
[ ] Divi Mobile
[ ] New idea

Idea


A fork indicator that tells the user if their wallet is forked, or how likely it is that it might be forked
A button to fix a forked wallet

Implementation (optional)


There are two parts to the implementation, the indicator, and the fixer.

The indicator:
The indicator could be a red-yellow-green dial or a RYG light. or it could just be an icon that turns on. and because it’s REALLY important for large wallets, it could send a text or email to the user if it detects a fork. There are a number of ways actually detect the fork, they are not decentralized methods:

  1. check current block height and block hash against a known good. I use this method and test against api.diviproject.org. But it’s important to not change the indication on the first detection. If it’s a dial, each block that fails to match would move the needle more towards the red, such that if 10 blocks (or some set number) in a row are different, the needle is pointing to red, but one match puts it back to full green. Forking for small amounts of time is normal, don’t want an alarm to go all the time. For me, this method has detected forks at the API more often than in my wallet.

  2. check for large drops in difficulty, or check difficulty against a “known good”, like the above API.

  3. use chainz to find the top 25 addresses, check blockheight and block hash against all of those, use the most common values to compare against the user’s wallet.

there may be other methods, but I have been using method #1 for a year and it works well to detect a fork, but not necessarily that my wallet forked.

The fixer:
What voice refers to as “process3” should be in the wallet. I don’t know if we should call it “Nuke the wallet” or what, but it shouldn’t be a process someone in support should go through. It should be a button someone presses to fix their wallet. It SHOULD come with a warning that it erases the data for the wallet and that it will take hours to reecover from. It should also require a password or confirmation that the user wants to run the process.

However, the fork fixer should also provide addnodes from known good. Either Divi keeps a list of known good nodes at api.diviproject.org OR the wallet uses the third choice above to evaluate which nodes are good, and to use them to start the refreshed wallet up.

automation:
There is the possiblity, that would have to come with trust in any of the above algos… that fork detection and correction could just happen in the wallet.

For example, using a fork detection method, and "forked"value could be created and compared to a “forked threshold”. If the threshold is crossed, then the peers are dropped, new peers are found (using perhaps the 3rd detectino method above) and linked to. Then to keep the network distributed, perhaps the peers could be replaced slowly with time with other peers gathered the normal way.