* docs: rename tfhe to fhe * docs: renaming all function names in the docs and library names * docs: update all mentions of TFHE * docs: tfhe-rs stays the same * docs: tfhe-rs stays the same * docs: rename repo * docs: fix renaming after merge conflicts * docs: resolve issues
2.9 KiB
Key features
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 Configuration.
Encrypted data types
fhevm introduces encrypted data types compatible with Solidity:
- Booleans:
ebool - Unsigned Integers:
euint8,euint16,euint32,euint64,euint128,euint256 - Addresses:
eaddress - Bytes:
ebytes64,ebytes128,ebytes256 - Input:
einputfor handling encrypted input data
Encrypted data is represented as ciphertext handles, ensuring secure computation and interaction.
For more information see use of encrypted types.
Casting types
fhevm provides functions to cast between encrypted types:
- Casting between encrypted types:
FHE.asEboolconverts encrypted integers to encrypted booleans - Casting to encrypted types:
FHE.asEuintXconverts plaintext values to encrypted types - Casting to encrypted addresses:
FHE.asEaddressconverts plaintext addresses to encrypted addresses - Casting to encrypted bytes:
FHE.asEbytesXconverts plaintext bytes to encrypted bytes
For more information see use of encrypted types.
Confidential computation
fhevm enables symbolic execution of encrypted operations, supporting:
- Arithmetic:
FHE.add,FHE.sub,FHE.mul,FHE.min,FHE.max,FHE.neg,FHE.div,FHE.rem- Note:
divandremoperations are supported only with plaintext divisors
- Note:
- Bitwise:
FHE.and,FHE.or,FHE.xor,FHE.not,FHE.shl,FHE.shr,FHE.rotl,FHE.rotr - Comparison:
FHE.eq,FHE.ne,FHE.lt,FHE.le,FHE.gt,FHE.ge - Advanced:
FHE.selectfor branching on encrypted conditions,FHE.randEuintXfor on-chain randomness.
For more information on operations, see Operations on encrypted types.
For more information on conditional branching, see Conditional logic in FHE.
For more information on random number generation, see Generate Random Encrypted Numbers.
Access control mechanism
fhevm enforces access control with a blockchain-based Access Control List (ACL):
- Persistent access:
FHE.allow,FHE.allowThisgrants permanent permissions for ciphertexts. - Transient access:
FHE.allowTransientprovides temporary access for specific transactions. - Validation:
FHE.isSenderAllowedensures that only authorized entities can interact with ciphertexts.
For more information see ACL.