Logo
Back to Hub

Encrypt Multiple Values

Accept and store multiple encrypted values of different types in one call

Encryption
Documentation

Encrypt Multiple Values

Accept and store multiple encrypted values of different types in a single transaction - gas optimization pattern.

What You'll Learn

  • Single proof validates ALL encrypted inputs (gas-efficient!)
  • Batching multiple encrypted types in one transaction
  • Handle ordering importance
  • Type-safe multiple value handling

Key Pattern

Loading...

Client-Side Usage

Loading...

Why This Matters

Gas Optimization - One proof for multiple values vs. multiple proofs ✅ Atomic Operations - All values stored together or none ✅ Type Flexibility - Mix ebool, euint32, euint64, eaddress

Common Pitfalls

Wrong handle order - Client order MUST match function parameters ❌ Missing types - Forgetting to import all encrypted types ❌ Permission grants - Must call FHE.allow() for EACH value

Quick Start

Loading...
Loading...