Zokyo Automated Tools
  • πŸ€–Unlocking Smart Contract Security: A Comprehensive Guide to Automated Vulnerability Analysis
  • 🐍Mastering Slither: A Comprehensive Guide to Smart Contract Vulnerability Detection
    • πŸš€Prerequisites
      • πŸ’»Code Editor
      • 🐍Setting up Python and Configuring Virtual Environments
      • πŸ”­Setting Up Git
      • πŸ‘ŠGit Bash
    • ⚑What Is Static Analysis
    • 🐍What Is Slither
    • πŸ“©Setting Up Slither: Installation and Virtual Environment Configuration
    • πŸ”©Installing solc and Crytic Compile: Foundation Tools for Slither
    • πŸ”Analyzing Smart Contracts Locally with Slither
      • πŸ—ΊοΈHandling Import Errors in Slither: A Guide on Solc Remappings
      • πŸ›£οΈHandling Path Errors In Slither
    • 🌍Analyzing Smart Contracts Already Deployed On Main-nets
    • πŸ”ŒExploring Slither's Tools and Printers: A Comprehensive Tutorial
    • πŸ€–Using Bash Scripts for Batch Analysis with Slither
    • πŸ’»Slither Intermediate Representation
    • 🌐Slither Python API
    • ⚠️Custom Detectors in Slither
      • 🀝Leveraging Custom Detectors from the Community
        • πŸ€—Leveraging Custom Detectors from the Community: Spotlight on the pessimistic.io Team
      • 🌱Making your own detectors
  • βš›οΈOyente: Symbolic Execution Tool
    • 😎What Is Symbolic Execution?
Powered by GitBook
On this page
  1. Mastering Slither: A Comprehensive Guide to Smart Contract Vulnerability Detection
  2. Prerequisites

Setting up Python and Configuring Virtual Environments

PreviousCode EditorNextSetting Up Git

Last updated 1 year ago

Installing Python and pip

Before diving into the configuration and usage of Slither for analyzing smart contracts, it's essential to set up the Python programming environment as Slither runs on Python. Follow the steps below to install Python and pip (Python’s package installer):

  1. Visit the official Python website Navigate to and download the latest version of Python. Ensure that you download a version that is 3.6 or above because Slither requires Python 3.6+.

  2. Installation

    • Run the downloaded installer and ensure that you check the checkbox that says β€œAdd Python to PATH” during installation. This makes the Python and pip executables available globally.

  3. Verification

    • Open a command prompt or terminal and type the following command to verify the installation:

      python --version
    • This command should return a version number, confirming that Python is installed correctly.

  4. Installing pip

    • Pip is usually included automatically when you install Python. You can verify the installation of pip by running:

      pip --version

Setting up a Virtual Environment

A virtual environment is a self-contained directory that holds a specific version of Python and multiple packages ensuring that the dependencies are isolated from the system-wide installed packages. Using a virtual environment is highly recommended because it prevents dependency conflicts between the packages used by different projects.

Why Use a Virtual Environment?

  • Isolation: Keeps dependencies required by different projects separate by creating isolated python environments for them.

  • Version Management: Helps manage project dependencies and their respective versions effortlessly.

  • Clean Environment: Offers a clean slate with no external dependencies, enabling focus solely on the necessary packages.

Creating and Activating a Virtual Environment

  1. Installing virtualenv

    • Install virtualenv package globally so that it can be used to create virtual environments. Run:

      pip install virtualenv
  2. Creating a Virtual Environment

    • Navigate to the directory where you want to create the virtual environment and run:

      python -m venv slither_venv
    • This command creates a virtual environment named slither_venv in the current directory.

  3. Activating the Virtual Environment

    • Windows

      Copy code.\slither_venv\Scripts\activate
    • macOS and Linux

      source slither_venv/bin/activate
    • After activation, the terminal should show the name of the virtual environment, indicating that the virtual environment is currently active.

  4. Deactivating the Virtual Environment

    • When you are done working in the virtual environment, you can deactivate it by running:

      deactivate

Now that your Python environment and virtual environment are set up, you are ready to install Slither and its dependencies within this isolated workspace, ensuring clean and manageable project setups. Armed with these tools, you can proceed further into the realm of smart contract analysis and vulnerability detection using Slither.

🐍
πŸš€
🐍
Book an audit with Zokyo
Python’s official website