Blockchain Forks and How They are Fixed as Relevant to the Gridcoin Network

in #gridcoin7 years ago (edited)

Yesterday @nuad01 posted a good summary under the Gridcoin tag describing the different kinds of forks we can come across in the cryptocurrency landscape. I would like to take this opportunity to further explore the cause and effects of the silent fork type he mentioned. This is the only fork type that the Gridcoin network experiences regularly, but the underlying logic and causes apply to all blockchains.

Lets assume that we start this discussion with all wallet clients on the same chain, and everything is running smoothly. The wallet which successfully stakes the next block is allowed to add this block onto the Gridcoin blockchain, increasing the block height by one. However, sometimes two (or even three) clients may all stake a block at roughly the same time, and both of these staked blocks have the same block height. This results in a fork in the chain, as shown in the illustration below:


Standard Fork

Each wallet (the technical term is a node) on the network will individually choose which block, and thus chain, to accept and support. Generally speaking, this will always be the first chain they encounter. Soon, a miner on one of the two forks will produce another block on that chain, which makes that side of the fork stronger. This will cause wallets on the weaker chain to migrate to the stronger chain. The extra block on the weaker chain will be abandoned - this block is known as an orphaned block. All of this happens automatically, behind the scenes, without any need for user intervention.

Sometimes, both forks are relatively strong and will continue to stake for some time. This rare phenomenon is called extended forking, and is demonstrated in the illustration below. Again, this is generally fixed by the network nodes without any need for user intervention.


Rare Extended Fork

Fork FAQ

I just staked a POR reward, but it disappeared again!

This happens when your wallet is on the forked chain that is abandoned. The block you staked is orphaned, and therefore the rewards that you were given are lost as they were not recorded on the surviving chain. Not to worry though - the surviving chain also never recorded that you were paid out! Therefore, you will be paid out again for this research at a later date (when you next stake).

My wallet says it is out of sync. What do I do?

Sometimes, your wallet does not make its own way back onto the correct chain. In this rare circumstance, your first fix would be to shut down and then restart the client. In 99% of cases, this will sync your wallet back up to the correct chain. If this fails to remedy the situation, instruct your wallet to download the blockchain again.

I think that https://www.gridcoinstats.eu is on a fork. What do I do?

Don't worry - just like your wallet https://www.gridcoinstats.eu will sync back up to the correct chain in a short while. If the website fails to sync up for an extended period of time (which I am yet to see happen) you can ping the creator/administrator Startail on the developer's Slack.

Why does the Gridcoin blockchain have forks?

Actually, this is a 'problem' faced by every blockchain, as communication between nodes is never instantaneous so near simultaneous block staking is not unusual. There is nothing to worry about.


Image credit:
Banner, @joshoeah
Chain Images, @me-shell

HighQuality.gif

Sort:  

You are on fire dutch :)

A lot of information to get out today. This was something else on the to-do list.

Thanks for the support! =)

Thanks for this. Good information to have. Learning more every day.

Worse case, re-downloading the blockchain worked for me but to save time and data, I have backed up my gridcoinresearch.conf, wallet and txleveldb folder as at the last working session before the fork or corruption, I just restore.
Thank you.

how many kilowatt hours did it take and cpu clock cycles to compute that? or did you copy paste it from some other coins website and article on forking?maybe wiki? lets talk about how hit-n-run on new projects effects their compute capabilities after you whine and bitch and cry about white listing another project that wasn't even in existence when the poll was created as there was/is an initial contact paper trail and dates and it was clearly stated poll round #2 for ODLK and clarified by the person whom contacted ODLK and initiated asking if they wanted to be on our white list and got them to install and openssl cert and since you don't know how to use Google translate or have the smarts to install an extension to any browser were unable to understand it and how hit-n-runs like you did effect projects negatively and that Mr. Whine A Whale got his own way apparently your nose is brown as hell from being up CM's backside? You are a disgrace to the Gridcoin community and our team in a whole and show that our leadershit has no integrity and Gridcoin is not an honorable block-chain and digital currency and if a whale whines they get to over rule the vote system and the community in a whole is ignored , especially when you had no intent on crunching ODLK1 I just passed your punk ass seeing as you crunched for the initial white list extreme mag boost only. I can't wait till we Gridxit and we can get rid of the bad seeds like you , I would rather have Kim Jun Un on my team than a disgrace like you. You are a disgrace to science and a disgrace to Boinc and a disgrace to team Gridcoin and its so wonderful how you make yourself look like the Gridcoin head cheese on www.gridcoin.science and the Dev's are below you and are your lackeys. For what you say , that you had the need for more processing or " compute " for what ever BS you were doing in college you sure don't seem to have the morals and ethics to repay the same in return to others such as ODLK. I hope you get a virus , you and every single computer you touch. Say hi to your GOTIS club and no not Girl on the Internet Syndrome you can assume what the G stands for , its slander...