fhEVM
WebsiteLibrariesProduct & ServicesDevelopersSupport
0.6
0.6
  • Welcome to fhEVM
  • White paper
  • Getting Started
    • Overview
    • Quick Start
      • Remix
        • 1. Setting up Remix
        • 2. Connect your wallet to Remix
        • 3. Deploying ConfidentialERC20
        • 4. Interacting with the contract
      • Hardhat
        • Prerequisites
        • 1. Setting up Hardhat
        • 2. Writing contracts
        • 3. Testing in mocked mode
        • 4. Deploying the contract
        • 5. Interacting with the contract
  • Tutorials
    • See all tutorials
  • Smart contract
    • Key features
    • Configuration
    • FhEVM contracts
    • Supported types
    • Operations on encrypted types
    • Access Control List
      • ACL examples
    • Encrypted Inputs
    • Decryption
      • Decryption
      • Decryption in depth
      • Re-encryption
    • If sentences
    • Branching in FHE
    • AsEbool, asEuintXX, asEaddress and asEbytesXX operations
    • Generate random numbers
    • Error handling
    • Gas estimation
    • Debug decrypt
    • Using Foundry
  • Frontend
    • Setup
    • Build a web application
    • Using React.js
    • Using Next.js
    • Using Vue.js
    • Using Node or Typescript
    • Using the CLI
    • Common webpack errors
  • Explanations
    • Architectural overview
    • FHE on blockchain
    • fhEVM components
    • Encryption, decryption, re-encryption, and computation
  • References
    • Table of all addresses
    • Smart contracts - fhEVM API
    • Frontend - fhevmjs lib
    • Repositories
  • Developer
    • Contributing
    • Development roadmap
    • Release note
    • Feature request
    • Bug report
    • Status
Powered by GitBook

Libraries

  • TFHE-rs
  • Concrete
  • Concrete ML
  • fhEVM

Developers

  • Blog
  • Documentation
  • Github
  • FHE resources

Company

  • About
  • Introduction to FHE
  • Media
  • Careers
On this page
  • Prerequisites
  • Running your tests
  • Next steps

Was this helpful?

Export as PDF
  1. Getting Started
  2. Quick Start
  3. Hardhat

3. Testing in mocked mode

Previous2. Writing contractsNext4. Deploying the contract

Last updated 3 months ago

Was this helpful?

This tutorial walks you through performing tests in the mocked mode provided by the fhEVM Hardhat template.

Prerequisites

Before proceeding, ensure you have:

  • A configured Hardhat project using the fhEVM Hardhat template. (See the )

  • Basic knowledge of Solidity and Hardhat testing. (See the )

fhEVM provides a mocked mode in Hardhat that allows for:

  • Faster testing on a local Hardhat network.

  • The ability to analyze code coverage.

  • A simulated version of encrypted types (they are not truly encrypted).

  • Access to Hardhat features such as snapshots (evm_snapshot), time manipulation (evm_increaseTime), and debugging (console.log).

To learn more about the fhEVM mocked mode, refer to the README in the .

Running your tests

To run tests in mocked mode, open a terminal in your project's root directory and execute:

# Using npm
npm run test

# Using yarn
yarn test

# Using pnpm
pnpm test

This command runs all tests locally in mocked mode. You should see the test results in your console.

Next steps

For most development and demonstration scenarios, mocked mode is sufficient. However, for production-ready development and a real testing environment, you need to run your tests on a real network where the coprocessor is deployed for example Sepolia. Refer to the on how to deploy your contract on Sepolia test network.

previous section
Hardhat testing documentation
fhEVM Hardhat template repository
next section