Scalar
A scalar in Leo is a data type representing an element of the scalar field of Aleo's elliptic curve (BLS12-377). It is related to the field type but belongs to a different algebraic structure: the scalar field is the group order of the elliptic curve, while the base field (exposed as field in Leo) is the field the curve is defined over. The two have different prime moduli and are not interchangeable.
Scalars are used in elliptic curve operations like scalar multiplication of group elements. Multiplying a group element by a scalar produces another group element, which is a basic operation in public-key cryptography and signature schemes. For most application development, field is more common because it maps directly to the constraint system's native arithmetic. The scalar type is typically needed only for direct elliptic curve work: custom signature verification, key derivation, or advanced cryptographic protocols.
Scalar literals use the scalar suffix, e.g., 42scalar. Like field elements, scalars wrap around their modulus, so arithmetic always produces a valid value.