Field Element
A field element is the base data type for all zero-knowledge computation on Aleo. It is a member of a finite field: a set of numbers where addition, subtraction, multiplication, and division (except by zero) all produce results within the set. Aleo uses the BLS12-377 curve's scalar field, so every value is an integer modulo a specific large prime.
In Leo, the field type exposes field elements directly. All other numeric types (integers, addresses, booleans) are encoded as field elements when compiled into an arithmetic circuit. Proof systems like Varuna operate natively over field arithmetic, where every constraint is an equation over field elements.
Field elements are the most efficient type for ZK computation. Operations on field values map to single circuit constraints, while operations on types like u64 or i128 need multiple constraints to handle overflow, comparisons, and bitwise operations. When performance matters, using field directly reduces circuit size and proof generation time. They support standard arithmetic, equality checks, and work as mapping keys or record fields.