Decryption
This section explains how to handle decryption in fhEVM. Decryption allows plaintext data to be accessed when required for contract logic or user presentation, ensuring confidentiality is maintained throughout the process.
Understanding how encryption, decryption and reencryption works is a prerequisit before implementation, see Encryption, Decryption, Re-encryption, and Computation.
Decryption is essential in two primary cases:
Smart contract logic: A contract requires plaintext values for computations or decision-making.
User interaction: Plaintext data needs to be revealed to all users, such as revealing the decision of the vote.
To learn how decryption works see Encryption, Decryption, Re-encryption, and Computation
Overview
Decryption in fhEVM is an asynchronous process that involves the Gateway and Key Management System (KMS). Contracts requiring decryption must extend the GatewayCaller contract, which imports the necessary libraries and provides access to the Gateway.
Here’s an example of how to request decryption in a contract:
Example: asynchronous decryption in a contract
Key additions to the code
Configuration imports: The configuration contracts are imported to set up the FHEVM environment and Gateway.
GatewayCaller
import: TheGatewayCaller
contract is imported to enable decryption requests.
Next steps
Explore advanced decryption techniques and learn more about re-encryption:
Last updated
Was this helpful?