Coder Social home page Coder Social logo

smart-contract-security's Introduction

Smart Contract Security

Below are notes pertaining to best practices for developing smart contract on Ethereum and other EVM blockchains.

Development Best Practices

  1. CEI - Checks, Effects, Interactions
  2. Pull over Push
  3. msg.sender over tx.origin
  4. call{value: <amount>}("") with CEI or ReentrancyGuard over transfer() or send()
  5. Chainlink VRF over block.timestamp

Auditing Process

  1. Developer writes smart contract code
  2. Developer write tests for smart contracts
  3. Static analysis tools are used to detect vulnerabilities in an automated fashion
  4. Contracts are deployed and tested on a test network
  5. A professional audit is conducted
  6. Audit report is provided detailing vulnerabilities and how to patch
  7. Vulnerabilities are patched prior to deploying to mainnet

Auditing Contracts

The auditing-contracts repo details 5 common pitfalls when coding in solidity.

  1. Missing input or precondition check
  2. Phishing vulnerability with tx.origin
  3. Incorrect calculation of output token amount
  4. Timestamp manipulation
  5. Block gas limit vulnerabilities

Tools

Attacks

  1. Oracle Manipulation (Uniswap V2)
  2. Front Running

Additional Resources

smart-contract-security's People

Contributors

0xmic avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.