# Scalar Field Order

{% hint style="info" %}
[**Book an audit with Zokyo**](https://www.zokyo.io/)
{% endhint %}

#### Scalar Fields:

Firstly, in mathematics, a field is a set equipped with two operations, addition and multiplication, that satisfy specific properties (like commutativity, associativity, distributivity, etc.). One of the most familiar fields is the set of real numbers with the usual addition and multiplication operations.

A scalar field, in the context of elliptic curve cryptography (which SNARKs often leverage), is simply a set of integers equipped with modular arithmetic operations. Here, "modular" means that numbers wrap around after reaching a certain value, which is known as the "modulus" or the "field order."

#### SNARK Scalar Field Order:

In the realm of zk-SNARKs (zero-knowledge Succinct Non-interactive ARguments of Knowledge), the scalar field order is specifically associated with the elliptic curve used by the zk-SNARK protocol. zk-SNARKs utilize elliptic curves due to their mathematical properties, which enable certain cryptographic primitives.

The "scalar field order" in this context refers to the size (or "order") of the scalar field associated with that elliptic curve. It's essentially a very large prime number. Any arithmetic operation involving the scalar field values will be done modulo this prime number. In other words, the results of calculations in the scalar field will always be integers between 0 and one less than the scalar field order.

#### Why it Matters:

When zk-SNARKs are used for cryptographic proofs, computations are often restricted to values within this scalar field. This limitation is because of efficiency reasons — calculations within this bounded set are faster and maintain certain desired cryptographic properties.

However, in some applications, there might be a need to handle numbers or integers that exceed the scalar field order, i.e., are larger than what the field can accommodate. That's where circuits like the [BigInt](../bugs-in-the-wild/bigint-missing-bit-length-check) (Big Integer) come into play. They are designed to handle arithmetic on such "out-of-field" large integers by breaking them down into manageable chunks or using other techniques to represent and process them.

#### In Summary:

* The SNARK scalar field order is the modulus (typically a large prime number) used for arithmetic operations in the context of a zk-SNARK's elliptic curve.
* It bounds the values of calculations within the zk-SNARK.
* When computations need to accommodate larger values than this bound, specialized methods or circuits (like BigInt) are used.

Understanding the intricacies of scalar fields and their role in zk-SNARKs is fundamental when developing or analyzing cryptographic systems based on SNARKs, as errors or oversights in this domain can lead to vulnerabilities or inefficiencies.
