Skip to main content
This page follows a single FHE operation from the contract call that requests it to the commitment that anchors its result onchain. The request itself is synchronous: the contract gets a handle for the result immediately, while the coprocessor computes the actual ciphertext in the background.

Key components

Flow diagram

Step-by-step flow

1

Encrypt the input with the Client SDK

The application encrypts its input client-side and proves it valid, producing an encrypted-input handle plus a batch proof the contract can accept. The Encryption Request Flow covers this step.
This step happens on the client side, before any blockchain interaction.
2

Request an FHE operation

Import the FHE library in Solidity:
Call the appropriate FHE function from the imported library:
FHE.sol forwards the request to the TaskManager contract.
3

TaskManager processing

The TaskManager is the gateway for all FHE operation requests. It:
  1. Validates the request structure, so all inputs are properly formatted.
  2. Verifies access permissions: the caller must have ACL access to every encrypted input.
  3. Generates a unique handle that will reference the future ciphertext result.
  4. Returns the handle to the calling contract, synchronously. Subsequent operations can chain on it right away.
  5. Emits a TaskCreated event with the operation details for the offchain services.
4

FHE Engine pickup

The FHE Engine subscribes to TaskManager events on every host chain and picks up the TaskCreated event. It checks that the operation is well formed and that the inputs it references exist. An operation that arrives before its inputs finish computing is deferred and released once they land.
5

Execution

The engine then:
  1. Executes the requested operation on the encrypted data.
  2. Stores the result ciphertext in the ciphertext database, keyed by the handle.
  3. Releases any dependent operations that were deferred while waiting for this result.
6

Commitment posting

The engine produces a commitment for the result, the hash of the stored ciphertext bytes, and posts it in a batch to the CommitmentRegistry on the registry chain. The commitment anchors the result. Teecryptor will only decrypt ciphertext bytes that hash to a registered commitment.At this point the operation cycle is complete, and the confidentiality of every encrypted value is preserved.