Best Practices
Follow these guidelines when building confidential Solana programs with Inco Lightning.1. Use e_select for Conditional Logic
Never branch on decrypted values in your program. Usee_select to keep logic encrypted:
2. Check Handle Initialization
Always verify handles are initialized before performing operations:3. Grant Minimal Decryption Permissions
Only allow specific addresses to decrypt values they need:4. Store Handles, Not Ciphertext
Handles are 16 bytes. Store them on-chain; ciphertext lives off-chain:5. Handle Edge Cases with e_select
Usee_select to handle edge cases without revealing them:
Summary
| Practice | Rationale |
|---|---|
Use e_select for conditionals | Prevents information leakage through control flow |
| Check handle initialization | Prevents operations on invalid data |
| Minimal access grants | Principle of least privilege |
| Store handles only | Minimize on-chain storage costs |