Control Flow
Thee_select function enables conditional logic on encrypted values without revealing the condition.
e_select
if_true when condition is encrypted true, if_false otherwise.
Example: Confidential Transfer with Balance Check
How e_select Works
Conditional Transfer Flow
Why Use e_select?
This pattern ensures:- No information leakage: Balance check happens on encrypted values
- Atomic transfers: Either full amount transfers or nothing
- No negative balances: Impossible to overdraw
The last parameter in operation calls identifies whether the left-hand side operand is ciphertext (
0) or plaintext (1). Always pass 0 when working with encrypted handles.