1/5
--- ### Writing Your First Rule with Certora **Creating the Rule** - Begin by using the `rule` keyword. - Establish the invariant: `hellFunc must never revert`, irrespective of the input parameters. - Just like in foundry testing, specify parameters akin to those used in fuzzing. **Understanding the Verification Process** - Unlike typical testing that inputs random numbers, formal verification transforms these numbers into symbolic expressions. - The transformation involves converting the code into a mathematical format (e.g., `x + y = z`). **Using the Assert Command** - To check for reverts, use the `assert` command. - Example: Typing `assert true;` should always pass as it's a basic truth check. - This simple assertion serves as the foundational rule for initial testing. ### Setting Up Certora CLI **Installation Steps** 1. **Accessing the Required Tools**: - Ensure Python and pip (preferably pip3) are installed since Certora is a Python package. - Although `pipx` is recommended for a more isolated installation, `pip3` can also be used based on personal preference. 2. **Installing Certora Prover Package**: - Use the command `pip install certora-cli` (link available in the associated GitHub repo). - Alternative for a more isolated setup: `pipx install certora-cli`. 3. **Configuring the Environment**: - Export your Certora key as an environment variable using: `export certora_key=<your_key>`. - Ensure the environment supports this setup (e.g., WSL, macOS, Linux). - Maintain the key by re-exporting it every time the shell is restarted. 4. **Utilizing Certora CLI**: - Confirm the CLI is correctly installed by running commands like `certora run help` or `certora run version` to get detailed outputs and version information. ### Managing Solidity Versions with Solc-Selects **Installation and Configuration** - Install `Solc-Selects` via `pipx` to manage different versions of the Solidity compiler. - Use commands like `Solc-Selects use 0.8.7` to switch between installed versions as needed. - If a version is not installed, install it using `Solc-Selects install <version>`. **Operational Tips** - Running `Solc-Selects help` provides guidance and confirms the current setup. - Always ensure the appropriate Solidity version is active for your projects by checking with `solc version`.
A comprehensive guide to installing Certora and solc-select - This lesson covers how to install the Certora prover package and solc-select in a Linux-like environment to set up your Solidity development environment. The guide covers setting up your personal access key as an environment variable, and explains the different ways to install and switch between Solidity compiler versions with solc-select.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Assembly
Writing smart contracts using Huff and Yul
Ethereum Virtual Machine OPCodes
Formal verification testing
Smart contract invariant testing
Halmos, Certora, Kontrol
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Guest lecturers:
Josselin Feist
Head of Blockchain at Trail of Bits
Last updated on January 17, 2025
Solidity Developer
Assembly and Formal VerificationDuration: 30min
Duration: 4h 38min
Duration: 3h 57min
Duration: 1h 56min
Course Overview
About the course
Assembly
Writing smart contracts using Huff and Yul
Ethereum Virtual Machine OPCodes
Formal verification testing
Smart contract invariant testing
Halmos, Certora, Kontrol
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Guest lecturers:
Josselin Feist
Head of Blockchain at Trail of Bits
Last updated on January 17, 2025
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar