Like any new technology, blockchain is not yet as secure as it can be. Older blockchains, such as Bitcoin and Ethereum, which have high mining hash rates, are more secure against attacks and chain manipulation. But younger cryptocurrencies, which rely on lower hash power, might not be so resilient in defending themselves. With new challenges emerging every day, developers are striving to create safer mining algorithms and prevent exploits.
Safex improving its code
Safex, which has a similar code to Monero, has pushed its new hard fork in order to improve the safety of its blockchain. With the new network update, Safex’s developers have addressed two weaknesses inherited from Monero’s code: timestamp and difficulty adjustment algorithm.
The problem with the timestamp based on Monero’s mining algorithm is that an attacker with enough hash power can easily manipulate it. Monero is large and thus more protected from this kind of attack. However, for smaller cryptocurrencies such as Safex, which use the same algorithm, this could be problematic.
With its new hard fork, Safex has implemented an improved function that checks blocks for unusual timestamps and other reliabilities and rejects the faulty ones.
Difficulty adjustment algorithm
Safex blockchain also used the same difficulty adjustment algorithm as Monero. The issue with Monero’s mining algorithm that it works for blockchains with high hash rates, but has weaknesses when it comes to smaller networks. This algorithm calculates difficulty based on averages. For every 720 blocks, it ignores 60 blocks from both ends (the fastest and the slowest). After that, the algorithm calculates the average difficulty score using the remaining 600 blocks.
This created a “difficulty adjustment lag,” which could be exploited, as the adjustment came after too many blocks. Hence, a malicious actor, with large hash power compared to the network, could mine enough blocks to substantially raise the difficulty of mining for others.
After the increase in difficulty, the attacker could stop mining and wait for other miners to give up. Then, they could turn off their rigs or switch to mining something else. They could then repeat the process after the mining difficulty drops. With each attack, the number of honest miners would decrease, making the network even less secure. Apart from gaining rewards, the attacker might even be able to make a double-spend attack on an exchange. Making this process more expensive for attackers could discourage this malicious behavior.
The new and improved mining algorithm
With its new LWMA difficulty algorithm developed by Zawy12, with lower-hash rate blockchains in mind, Safex improved the responsiveness of its network’s difficulty algorithm. Now, its mining difficulty is adjusted after every block, or every two minutes. Previously, that adjustment would occur after every 60 blocks. In short, the new mining algorithm adjusts faster. The more hash power is added to the network, the sooner the difficulty will rise, thus discouraging manipulation. It also works in reverse: when the hash rate drops, the difficulty decreases sooner.