EIP-1895 Elliptic curve cycle support (Support for an Elliptic Curve Cycle)
No call decision · Scaling & data · EIP status Stagnant · created 2018-03-31
A proposal to add ecadd, ecmul, and ecpairing operations for the MNT4 curve as EVM precompiles, enabling aggregation of recursive SNARK proofs through the mutually embedding pair of curves MNT4 and MNT6.
Why it is needed
The only elliptic curve operation the EVM currently supports is alt-bn128. Verifying even a single zk-SNARK proof is costly, and if a SNARK must be verified separately for each of thousands of transactions, the gas cost becomes unaffordably high. The original text explains that verifying around 1000 SNARKs would cost about 1.5 billion gas. One way to solve this is recursive SNARKs, that is, verifying one SNARK proof inside another SNARK proof so that multiple proofs are aggregated into one. However, this requires being able to compute operations on one curve inside the SNARK circuit of another curve, and alt-bn128 has no such mutually embedding pair (cycle). The only known curve family forming a cycle is MNT4 and MNT6, so the starting point of this proposal is that for the EVM to support recursive SNARKs, operations for these curves must be newly added.
What changes
Today
- The EVM only provides the ecadd, ecmul, and ecpairing precompiles for the alt-bn128 curve.
- Verifying many SNARK proofs accumulates cost proportional to the number of proofs, requiring about 1.5 billion gas at a scale of 1000, which is impractical.
- alt-bn128 has no mutually embedding curve cycle, so one SNARK cannot recursively verify another within itself.
After EIP-1895
- New ecadd, ecmul, and ecpairing precompiles for the MNT4 curve are added.
- Using the MNT4 and MNT6 cycle, operations on one curve can be computed inside a SNARK circuit on the other curve.
- This opens a path to recursively aggregating multiple proofs into one, keeping verification cost nearly independent of the number of proofs.
Who is affected
- zk application developers: This opens a path to significantly lowering verification cost by aggregating many proofs into one via recursive SNARKs.
- Client implementation teams: The ecadd, ecmul, and ecpairing precompiles for MNT4 need to be newly implemented, along with their gas costs.
- Ordinary users: If this proposal is actually adopted, the cost burden for services that need to verify large volumes of proofs could be reduced.
In depth
Proposal background and goals
According to the original text, the EVM currently supports the ecadd, ecmul, and ecpairing precompiles only for the alt-bn128 curve. SNARK proof verification costs a constant amount regardless of circuit size, but the total cost grows with the number of proofs. The original text explains that verifying around 1000 SNARKs on the EVM would require about 1.5 billion gas, which is impractical. Recursive SNARKs, that is, verifying one SNARK inside another to aggregate multiple proofs into one, can greatly reduce verification cost, but this requires being able to compute operations on one curve inside a SNARK circuit on another curve. The original text names MNT4 and MNT6 as the pairing-friendly curve family that forms such a cycle, and this EIP proposes adding operations for MNT4 of that pair to the EVM.
MNT4 curve definition
The original text specifies that MNT4's two cyclic groups G_1 and G_2 have prime orders q and p, each represented with 298 bits. G_1 is defined over the prime field F_p by the equation Y² = X³ + aX + b (a=2, b=423894536526684178289416011533888240029318103673896002803341544124054745019340795360841685), and the coordinates of the generator P are given as is in the original text. The twist group G_2 is defined over F_p² by an equation of the same form (a=34, with b given as the imaginary-part coefficient), and the coordinates of its generator P2 are likewise given as real and imaginary parts. However, the definition of the irreducible polynomial constructing F_p² is marked in the original text as "to be completed later" and is left blank.
Additional operations and gas costs
The source text proposes adding three operations as precompiles: MNT_4_ADD, MNT_4_MUL, and MNT_4_PAIRING, but each gas cost is only marked as "to be estimated," with no concrete figure set. The X in the name refers to MNT4, and the abstract states that only ecadd, ecmul, and ecpairing are added for MNT4.
Compressed coordinate encoding
A point P(X, Y) on the curve is represented in the EVM in compressed form as C(X, Y) = X | s. Here s is a 1-byte flag denoting the Y value: 0x00 means the point at infinity, 0x02 means the even-y solution, and 0x03 means the odd-y solution. Converting from affine coordinates to compressed form is simply computed as s = 0x02 | (s & 0x01). This representation lets a point be expressed with two uint256 values, reducing the data size compared to using three coordinates. The source text flags as an edge case that there may be multiple representations of the point at infinity.
Concerns about the security level
The source text's Rationale states that the cycle adopted by this proposal provides an 80-bit security level, lower than the 120 bits provided by MNT6. It explains that this may be insufficient for use cases requiring very high security, such as handling assets worth billions, but could be adequate for other use cases. As an alternative, it mentions the cycle used by Coda, but notes that this is defined over a 753-bit field, which may also be excessively large. It also notes that regardless of which cycle is used, the curve's group and field elements are represented as integers larger than 256 bits, so even at an 80-bit security level the EVM may need additional support for larger field-size operations.
Open items and current status
This EIP leaves the irreducible polynomial of the field F_p^2 defining G_2, the exact gas costs of the three operations, and the benchmark results for which curve to actually implement all as "to be completed/estimated." The Rationale states that it is not necessary to implement every curve in the cycle, only the fastest one, but the source text does not reach a conclusion on which curve is fastest. This EIP's current status is Stagnant, meaning it is no longer actively progressing.