Basic Examples
Each example in this category is designed to be self-contained and runnable. Start with Beginner examples if you are new to fhEVM.
Beginner
EncryptMultipleValues - Store multiple encrypted values with a single proof
EncryptSingleValue - Store one encrypted value and grant permissions
FHEAdd - Add two encrypted values with FHE.add
FHECounter - Encrypted counter using FHE.add and FHE.sub
FHEEq - Compare two encrypted values using FHE.eq
FHEIfThenElse - Conditional selection on encrypted values using FHE.select
FHESub - Subtract two encrypted values with FHE.sub
UserDecryptMultipleValues - User decryption flow for multiple encrypted results
UserDecryptSingleValue - User decryption flow for a single encrypted result
Intermediate
AntiPatternMissingAllowThis - Missing FHE.allowThis breaks reuse of stored handles
AntiPatternMissingUserAllow - Missing FHE.allow(user) blocks user decryption
AntiPatternViewOnEncrypted - View functions return encrypted handles, not plaintext
HandleGeneration - Handles are opaque references; FHE ops create derived handles (symbolic execution)
HandleLifecycle - Store encrypted handles and reuse them across calls
InputProofsExplained - Input proofs bind encrypted inputs to a contract and sender
PublicDecryptMultipleValues - Public decryption flow for multiple encrypted values
PublicDecryptSingleValue - Public decryption flow for a single encrypted value
Last updated