Skip to main content

Encrypted Types & Handles

A handle is a 128-bit reference to an encrypted value stored off-chain by the covalidator network.

Handle Types

Deterministic Derivation

Handles are deterministically derived from operations, so the same operation with the same inputs always produces the same handle. This allows programs to store and reference encrypted values without storing the actual ciphertext on-chain.

Storing Handles

Store handles in your Anchor account structs. Handles are only 16 bytes each:

Account Size Example

Always check if handles are initialized before performing operations:

Handle Lifecycle

  1. Creation: Handle is created when encrypting a value via new_euint128 or new_ebool
  2. Operations: New handles are created as results of encrypted operations
  3. Storage: Handles are stored on-chain in account data
  4. Decryption: Authorized parties can request decryption of handles they have access to