by: Simone Bovi, CTO [Twitter,Linkedin] date: 25/05/2022

Before launching a Smart Contract on the Ethereum blockchain, it is important to be sure that the code is secure.

Once released, going back is impossible since Smart Contracts are immutable by design. For this reason security cannot be a secondary aspect, it must be handled before the release if you do not want to kill your old contract and redeploy a new one thus spending your precious ETH.

As seen previously, with the rise of new technologies, also new vulnerabilities and risks emerge which can be catastrophic. This means that it’s necessary to be prepared.

In this article, we will analyze what can be done to achieve an excellent level of security.

Develop secure code

Writing a secure source code for your Smart Contract is the first important step. As for all types of applications, this aspect cannot be ignored since it represents the backbone of the entire project.

Knowing how to write secure code should be a necessary requirement to start a project based on blockchain.

Thanks to the Web, it is easy to find numerous resources that can be consulted to learn the basics about smart contract security and how to write a secure code. For example, Consensys provides useful best practices and there exists some secure libraries to use like the ones provided by OpenZeppelin.

In particular, the following are some points to keep in mind:

  • Learn more about security and vulnerabilities related to smart contract: awareness and training can help you avoid “anti-patterns” that can lead to vulnerabilities;
  • Give a second, third, fourth or even more look at the code: let more than one person review it. It’s difficult to notice errors at first glance for anybody.
  • Do not sacrifice security for budget: developing in certain ways can change the final costs of deployment (this is particularly true for smart contracts due to their transaction fees), but this can have repercussions on the security. What you save today for not improving security, you may pay for it tomorrow ten times more.

The final security test: Smart Contract Security Assessment

After the security barriers are erected, it’s time for the “offensive” phase. This is the final exam to see if your project can survive in the real world: a Security Assessment, also known as Smart Contract Audit. One of the advantages of this type of audit is that it can operate like a real-world scenario but in a safe environment.

What does it mean? To put it simply: you have an expert team prepared to act like hackers would do and think. This team of security experts will examine your project and find every way that can cause damage, like criminals would do. But, instead of taking an unfair economic advantage, they will report to you every security issue and how to fix it.

It’s a different and necessary way to look at the security: it surely helps to have a point of view from who always works with an “offensive mindset” in the cyber security world.

Remember that, one of the main differences from other types of applications is that the source code of the smart contracts is always public, or easily retrievable through reverse engineering of the related bytecode, and therefore an attacker could see everything inside it.

Conclusion

So, in the end, what can you do to provide a reliable and strong project to the public?

  • Ensure the development of secure code by following security best practices, as this is the first step for a successful DApp;
  • Stay updated with the latest hacks in the crypto world by checking for example sites like Rekt
  • Carry on a security assessment in order to ensure that your project is robust enough for the real world.

Many Web3 businesses around the world are attacked every day. Don’t be like them. BeDefended.

Thanks for reading.