Solidity Best Practices - 10 Tips
summary
Ten concrete Solidity rules: lock compiler to 0.8.13 so verification and known-bug checks work; do math as multiply before you divide (use 1e18-style multipliers to avoid rounding to zero); avoid local vars named the same as state; keep contracts minimal and split view/logic; favor security over clever gas tricks; ban unbounded loops or paginate them; never trust user-supplied contract addresses (malicious transferFrom); follow checks→effects→interactions and add a reentrancy guard; prefer pull payments over push.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 0:37Compiler version locking
- 2:01Safe arithmetic operations
- 5:08Variable naming conventions
- 7:47Simplifying contract design
- 11:35Prioritizing security
- 12:55Managing unbounded loops
- 17:19Securing user inputs
- 19:02Checks-effects-interaction
- 20:50Reentrancy guards
- 23:24Pull over push payments
- 26:26Q&A and conclusion
related talks
20mSolidity's most common security pitfalls and its best safeguards
20mLearning How to Build Secure Smart Contracts
20mLearning How to Build Secure Smart Contracts
19mThe Good, The Bad, and The Vulnerable: Navigating Common Pitfalls in Solana Program
10mClear as Mud
43mOutsmarting Smart Contracts
19mHow Do You Even Write Secure Code Anyways
12mSmart Contract Security
