The Code Is Key: Solutions for Overcoming DeFi Security Breaches

The DeFi sector can embrace a positive future by following comprehensive security audits and by ensuring best practice in due diligence and quality assurance
The DeFi sector can embrace a positive future by following comprehensive security audits and by ensuring best practice in due diligence and quality assurance

Decentralized finance, commonly referred to as DeFi, has grabbed the attention of mainstream financial and technology audiences alike. While the sector has been applauded for bringing about innovative digital finance solutions from lending to payments, progress has been overshadowed by high profile security breaches. Adhering to these security guidelines will ensure that DeFi solutions will be better equipped to offer users a more instant, safe and secure network than traditional banking services.

New DeFi market opportunities overshadowed by security threats

When governments enforced lockdowns to prevent the spread of the coronavirus, the mainstream financial and banking system buckled under the enormous weight of souring loans and the need to process fiscal stimulus payments. Businesses and individuals waited several weeks for government handouts that should have taken only a couple of hours. The COVID-19 pandemic exposed a shortfall in the financial system that had long been evident to DeFi proponents: namely, the inability to provide direct and instant capital access.

Amid the economic and financial fallout from the COVID-19 pandemic and banks’ inability to lend to small and medium-sized enterprises, startups and entrepreneurs have been suffering the massive economic toll. Important businesses are being cut off from essential credit lines as governments unwind temporary stimulus packages earlier than expected. In this new economic environment, DeFi has been offering clear and tangible solutions to capital access and payments processing through the ability to remove cumbersome manual processes associated with traditional payments with instant and low-cost transactions.

Despite promising applications for the technology, critics of DeFi solutions assume that security concerns will continue to overshadow the growth and mainstream adoption of peer-to-peer financial networks. However, through efficient smart contract integration, combined with high-quality coding, DeFi platforms can fully protect users’ funds and prevent hacks, such as those that hit the dForce network earlier this year, from occurring again in the future. 

DeFi lessons from the dForce hack

The DeFi community celebrated a host of breakthroughs in 2019, including sizable investment rounds, such as Andreessen Horowitz’s $15-million investment in MakerDAO, and big names, such as ConsenSys entering the DeFi ecosystem with a new product suite, dubbed Codefi. In February of this year, DeFi hit another significant milestone when loans locked into decentralized lending contracts surpassed the $1-billion mark for the first time on record.

However, the DeFi community was given something of a rude awakening when news emerged in April that Chinese platform Lendf.me, part of the dForce network, a decentralized finance protocol, was hacked to the tune of $25 million. In another plot twist, a couple of days after siphoning $25 million of funds away, the hacker returned almost all of the funds back to its original location. The incident has since left DeFi industry analysts picking up the pieces in understanding how an attack on this scale occurred, with many alluding to a complex algorithm designed by the hacker. 

Analyzing the dForce hack in several parts paints a more straightforward picture, however. The reality is that dForce fell victim due to a lack of thorough due diligence. This lack of due diligence meant dForce relied on using unoriginal code copied from Compound, a leading player in the DeFi lending market; it had little to no security checks or audits; and there were no emergency stop processes in place for smart contracts. 

Having been rocked by the dForce hack, can the DeFi community better prepare itself for security threats in the future? By prioritizing security audits and best practice in coding and due diligence, the DeFi industry can once again be reckoned with as a serious force in providing real and tangible digital finance solutions to a global audience without boundary restrictions.

DeFi security solutions

A full external security audit, original coding and a testnet launch to ensure the functionality of security measures are only some of the essential steps that should be prioritized to protect users and provide enhanced security on DeFi networks. Writing test and migration scripts is a quick and efficient means to ensure the security and quality of smart contracts. This can be supplemented by deploying other advanced auditing tools, such as code coverage, gas cost analysis, testing with mainnet fork ganache, code linting and continuous integration. 

After deploying the relevant advanced security auditing tools, it is worth using any time and resources available to conduct an external security audit. Not only does this sit well with prospective investors but it provides a blueprint in identifying any potential issues that may have been overlooked during the coding stage. Choose a security auditing firm that is well versed in DeFi technology — this will help speed up the auditing process, saving your company time and money. 

Once the audit is complete, the next stage of your process should be the testnet launch. This can provide you with invaluable time and the opportunity to identify any bugs on your network. Invite close community members and your team to test the smart contracts. Spend the time and resources at the testnet stage wisely, as it will be more difficult to rectify problems once the beta mainnet is launched. The testnet launch is also a useful opportunity to engage with community members and to make preparations for the beta mainnet launch announcement before launching to the public. These steps taken during the testnet launch will allow you to generate positive user traction and community attention.

The final stage of the internal security audit should include a bug bounty program: an invitation to community members that rewards them for identifying any security breaches or vulnerabilities. This can be done in two stages: the pre-beta launch and post-launch on an ongoing basis. The pre-launch bug bounty has the benefit of inviting hackers to test the smart contracts, allowing them to report any vulnerabilities. After the beta launch, the bug bounty program should be opened up to the hacking community on an ongoing basis. This will ensure that any potential security glitches are identified and resolved accordingly, mitigating any risk from hackers.

Security solutions provide a promising future for DeFi

Borrowers and lenders across the globe have been demanding more financial solutions and alternatives in managing their wealth. Mainstream financial services have thus far failed in delivering tangible digital finance solutions. Banks, too, have been beset by security breaches, including online fraud schemes and hacks that have stolen credit card and login information from users. 

As the coronavirus exposes the cracks in centralized systems and banks come under more strain to process payments quickly and efficiently, the security of centralized systems may yet again be in doubt. This new market environment has unveiled the enormous potential for DeFi solutions to gain further traction in placing financial control back in users’ hands while offering a better and more secure alternative to traditional banking. 

Already, we have begun to see significant developments being undertaken across the DeFi landscape with the growth of new financial products from savings, payments and lending. For the DeFi community to reap the rewards from progress being made in the space, conducting security best practice — as outlined above — should be a top priority. By ensuring users’ safety and preventing external hacks, DeFi will be on the path to mainstream adoption. Ultimately, thorough security audits and quality assurance will provide the essential trust and transparency needed for the sector to grow and flourish in this new digital age. 

The views, thoughts and opinions expressed here are the author’s alone and do not necessarily reflect or represent the views and opinions of Cointelegraph.

Jason Wu is the CEO of DeFiner, a true peer-to-peer fintech network for digital savings, loans and payments. As an experienced digital currency entrepreneur, Jason understands DeFi’s potential and applies blockchain tech to real-world problems.