Web3 Leader Spotlight: Harry Denley
This week we interviewed Harry Denley, Security Expert at ConsenSys, the market-leading blockchain technology company which has built products such as MetaMask, Infura, and Truffle. In this edition, Harry delves into the best practices for smart contract security, and some promising web3 projects.
What are some of the most promising web3 projects that you believe will have a significant impact on the industry?
It is important to note that Web3 is ever-evolving and many projects have different goals that will impact the industry in different ways.
Let me highlight two projects that MetaMask is working on that I think will have significant impact to both developers and users - especially in terms of security.
MetaMask Snaps has the opportunity to be one of the biggest impacts in this industry as it will allow third party developers to extend the capabilities of MetaMask in a secure environment. Developers can create plugins to build upon MetaMask and offer, as an example from many possibilities, different security controls (such as transaction insights) or different chain support into the largest Web3 wallet in the space.
Also, whilst not Web3 specific, LavaMoat will have a significant impact in the industry by increasing the security around potential supply chain attacks to many projects in the space by providing runtime protections within the JavaScript ecosystem.
How can we balance the need for security with the desire for flexibility and functionality in smart contract design?
As smart contracts are immutable once deployed, security should be top of mind when designing a smart contract. When implementing more flexibility and more functionality into a smart contract you open up possible attack vectors, so the contract design should be vigorously tested (unit tests, end-to-end tests, integration tests, and fuzzing) and reach out to a third party auditor to help assure the security guarantees of your contract design.
It has been exciting to see the tools available for smart contract developers improving over the years to offer better security-related testing and better development environments for contracts to go through before being deployed to a live chain.
One thing that I have seen, especially with a new primitive design or functionality, is limiting the amount of value that can be locked within a smart contract and gradually raising the limit over time. While this approach may give the contract a centralised-like characteristic at the beginning, I believe it is crucial to prioritise user protection, and developers should maintain utmost transparency regarding the centralised aspect of increasing limits on the smart contract.
Teams behind smart contracts that attract users/volume should also offer a clear and rewarding bug bounty program to incentivise white hat hackers to responsibly disclose security vulnerabilities to the team.
What are some of the best practices for developing secure smart contracts?
This is an important topic, and while I cannot provide an exhaustive list of recommendations, I can offer some key considerations based on industry best practices.
- Focus on Secure Design: It’s crucial to prioritise secure design principles from the outset. Pay attention to potential vulnerabilities and security risks during the development process.
- Utilise Trusted Libraries: Leveraging well-known and thoroughly audited libraries, such as OpenZeppelin’s libraries, can provide a solid foundation for your smart contract development. By building upon established and trusted code, you can benefit from the expertise of the broader community.
- Foster a Security Mindset: Encourage developers to adopt a security-oriented mindset when writing smart contracts. Promote best practices, such as input validation, access control, and error handling, to minimise the occurrence of security-critical bugs.
- Implement Comprehensive Testing: Test your smart contracts using a variety of techniques, including unit tests, end-to-end tests, integration tests, and fuzzing. These tests help uncover potential vulnerabilities and ensure the contract behaves as intended. Manual quality assurance (QA) processes should also be employed to provide additional confidence in the code’s security.
- Engage Professional Code Review: Consider engaging a reputable security audit company to conduct a thorough manual code review of your smart contract. Experienced auditors can identify potential flaws and provide valuable insights to enhance the security of your contract.
- Stay Informed: Continuously educate yourself about common security risks and pitfalls in smart contract development. Resources such as https://consensys.github.io/smart-contract-best-practices/ and https://entethalliance.github.io/eta-registry/security-levels-spec.html can offer valuable guidance and help you understand potential vulnerabilities.
While these recommendations provide a starting point, it is essential to consult with experts and stay updated with the latest industry developments. Secure smart contract development requires ongoing diligence and a commitment to improving security practices.