VRX block difficulty retarget
Scroll down for more information
Introduction
VRX or Terminal Velocity RateX is a blockchain difficulty retarget system that, using a several block depth scan, quickly adapts any implemented blockchain/altcoin's mining or staking difficulty levels to ensure a narrow window around the desired block time. Allowing of course for some inconsistencies in block spacing due to significant increases or decreases in hashrate/staking depending on whether the blockchain is Proof-Of-Work based, Proof-OfStake or Hybrid. The VRX system ensures that blocks are generated at a consistently even pace. Furthermore, for Hybrid blockchains the blocks are properly shuffled in a 50/50 ratio allowing both consensus types an even chance. Now as of early 2020 this system has been updated with a sophisticated anti-stall functionality, preventing the possibility of the chain from ever becoming "stuck". These features have yet to be seen in any sort of capacity anywhere else but the VRX implementation that this document describes.
Technical Aspects
Simply put VRX indexes a previous set amount of blocks (typical reference implementations are set to the previous six blocks) and then compares each of them against one another in relation to their block times in order to determine a set spacing between each sets of indexed block pairs. The system then takes the determined block spacing and compares it against desired block spacing in what is called a "Check Round". Check Rounds are similar to what can be found in other retarget systems that are available, however, VRX adjusts on a unique curve which adapts quickly to large changes in the hashrate of the blockchain, making sure to not adjust too much at the same time so as not to "stall" the blockchain. There is one Check Round per pair of blocks indexed so in most cases as stated previously using a six block count index depth VRX will have five Check Rounds. After VRX runs through its checks the system then determines whether it should change the difficulty either up or down depending on whether the desired block time was overshot or rushed. The severity of which direction the system adjusts is limited to a maximum of doubling the previous block difficulty or halving it. Finally an average is calculated between the different pair calculated difficulty changes so that the most logical change in difficulty occurs that best suites the blockchain and submitted for the mining/minting network.
Improvements
Over the course of the past several years VRX has undergone some significant evolution. In 2019 it was updated with its first set of advanced functions such as Hybrid (PoW/PoS) Swing which skews the difficulty towards whichever concensus algorithm is being found less. This is rated on a curve depending on severity of elapsed spacing since the other type of consensus algorithm has been able to submit a valid block to the network. By having this feature constricted with its curve values allows for a practically perfect 50/50 shuffle of block types between PoW and PoS with hybrid systems. Additionally by excluding this feature and constricting the window parameters more tightly a pure PoW or PoS implementation is also acheived quite effectively which has been demonstrated on several different blockchains currently in depoyment that the CryptoCoderz team has either developed or assisted with. Later on in early 2020 it was updated again, this time receiving the afermentioned Anti-Stall feature discussed in the introductary part of this document. Again in 2022 the system received a revision upgrade to the Anti-Stall feature which allows the system to gradually target the difficulty lower than a halving step down which is the normal limit. By allowing the system to do this it can achieve a near smooth step down to whatever difficulty is needed to no longer have a block time that is elongated past the set maximum spacing. This prevents the need for a difficulty reset if the chain becomes "stuck" and in most cases prevents hours or days of delay due to this sort of issue as it uses a dynamically increasing curve to target down the longer maximum time was exceeded for a block generation attempt. This also greately helps to mitigate "block pumping" and other attempts to bend the rules of the system in order to generate blocks quicker for a short time.
Limitations
Currently the limitations for VRX is that is not yet capable of learning patterns and data sets from previous block history of block generations. Though this isn't a particularly hindering fact it still is something that the CryptoCoderz team has identified that is a weak point being that most reference implementations only have five (5) "check rounds" which is a limited data set. It would be more beneficial to have the system index deeper and learn from the patterns of previous history and use this to make an informed decision on skewing the previously "blind" retarget.
Future
In the future VRX will interact with another feature that CryptoCoderz created known as Demi-Nodes which provides the retarget algorithm the ability to interact with the blockchain network and learn from it about how the chain has been generating blocks. This offers a low-overhead solution to having a learning and intelligent network and client that can properly address and predict issues before they arise while snuffing out anything already being attempted such as "block pumping" where miners hit the network with large hashrate to generate blocks at a quicker pace for a short time then back off so that the difficulty is "tricked" into targeting back down again. This is not as problematic for the already sophisticated VRX retarget system but is planned to be completely done away with as of these new upcoming features.
Conclusion
Overall this document's intention is provide a general understanding of what VRX is and what it does. The use of the VRX system is still in the grand scheme of things minimally tested and used. Currently you can can find implementations of this system in Espers [ESP], INSaNE [INSANE], Nucleon [NEON], Rubix [RBX], Endox [EDX], DigitalNote [XDN], PupaCoin [PPCN], Konjungate [KONJ], InfoCoin [INFO], Flavor-XL [FXL], ZalemCoin [ZLM], BreadCoin [BREAD] and FrogCoin [FROG] blockchain projects as of the writing of the docmentation. This VRX system will continue to evolve to become more robust and overall a effective solution to the blockchain difficulty retarget problem.