Key features
Last updated
Was this helpful?
Last updated
Was this helpful?
This document provides an overview of key features of the fhEVM smart contract library.
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 .
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 .
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
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.
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 .