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
  • Configuration and initialization
  • Encrypted data types
  • Casting types
  • Confidential computation
  • Access control mechanism

Was this helpful?

Export as PDF
  1. Smart contract

Key features

PreviousSee all tutorialsNextConfiguration

Last updated 3 months ago

Was this helpful?

This document provides an overview of key features of the fhEVM smart contract library.

Configuration and initialization

Smart contracts using fhEVM require proper configuration and initialization:

  • Environment setup: Import and inherit from environment-specific configuration contracts

  • Gateway configuration: Configure secure gateway access for cryptographic operations

  • Initialization checks: Validate encrypted variables are properly initialized before use

For more information see .

Encrypted data types

fhEVM introduces encrypted data types compatible with Solidity:

  • Booleans: ebool

  • Unsigned Integers: euint4, euint8, euint16, euint32, euint64, euint128, euint256

  • Addresses: eaddress

  • Bytes: ebytes64, ebytes128, ebytes256

  • Input: einput for handling encrypted input data

Encrypted data is represented as ciphertext handles, ensuring secure computation and interaction.

For more information see .

Casting types

fhEVM provides functions to cast between encrypted types:

  • Casting between encrypted types: TFHE.asEbool converts encrypted integers to encrypted booleans

  • Casting to encrypted types: TFHE.asEuintX converts plaintext values to encrypted types

  • Casting to encrypted addresses: TFHE.asEaddress converts plaintext addresses to encrypted addresses

  • Casting to encrypted bytes: TFHE.asEbytesX converts plaintext bytes to encrypted bytes

Confidential computation

fhEVM enables symbolic execution of encrypted operations, supporting:

  • Arithmetic: TFHE.add, TFHE.sub, TFHE.mul, TFHE.min, TFHE.max, TFHE.neg, TFHE.div, TFHE.rem

    • Note: div and rem operations are supported only with plaintext divisors

  • Bitwise: TFHE.and, TFHE.or, TFHE.xor, TFHE.not, TFHE.shl, TFHE.shr, TFHE.rotl, TFHE.rotr

  • Comparison: TFHE.eq, TFHE.ne, TFHE.lt, TFHE.le, TFHE.gt, TFHE.ge

  • Advanced: TFHE.select for branching on encrypted conditions, TFHE.randEuintX for on-chain randomness.

Access control mechanism

fhEVM enforces access control with a blockchain-based Access Control List (ACL):

  • Persistent access: TFHE.allow, TFHE.allowThis grants permanent permissions for ciphertexts.

  • Transient access: TFHE.allowTransient provides temporary access for specific transactions.

  • Validation: TFHE.isSenderAllowed ensures that only authorized entities can interact with ciphertexts.

For more information see .

For more information on operations, see .

For more information on conditional branching, see .

For more information on random number generation, see .

For more information see .

Configuration
use of encrypted types
use of encrypted types
Operations on encrypted types
Conditional logic in FHE
Generate Random Encrypted Numbers
ACL