✖

BN254: an elliptic curve for zero-knowledge proofs

BN254, called alt_bn128 in Ethereum, is an elliptic curve on which Ethereum and a number of other networks verify so-called zero-knowledge proofs. It is not a cipher. It is a mathematical object with one rare ability: two points on it can be “paired”, and the result tells you whether some relationship holds between the secret numbers hidden in the points, without anyone learning those numbers. In short, BN254 lets you convince the whole world that you have calculated something correctly without revealing what you calculated with. In December 2026 the Ethereum Foundation issued a warning about it. Ether and tokens in an ordinary wallet are not at risk; it mainly affects applications such as Tornado Cash. The foundation’s advice is summarised in the last section.

What BN254 is

An elliptic curve is the set of points that satisfy the equation y2 = x3 + ax + b. Points on it can be added: a line drawn through two points meets the curve at a third point, and that point (flipped over as in a mirror) is their sum. The article on elliptic curves shows this in detail. Adding the point G to itself k times gives the multiple kG. All of curve cryptography rests on this: calculating kG is easy even for a k with 77 digits, but nobody can quickly work backwards from the result to the secret k. This is called the discrete logarithm problem.

The equation of BN254 is about as simple as it gets:

y2=x3+3

Over the real numbers it is a smooth curve, and the point G(1, 2), for example, lies on it, because 22 = 4 and 13 + 3 = 4. This very point is used in BN254 as the starting point G from which all the multiples are calculated.

A computer does not calculate with real numbers, though; it would have to round them. Instead it works with remainders after division by one huge prime number p, and the curve falls apart into a cloud of separate points. The picture on the right shows the same equation with remainders after division by 31. There are 42 points, and if we add the special point at infinity, which plays the role of zero in addition, there are 43. The point G still lies on it: the equation 4 = 1 + 3 holds in any kind of arithmetic.

On the left the curve y² = x³ + 3 over the real numbers, bent into an arc on the left, with a red point G at (1, 2). On the right a 31 by 31 grid with 42 points of the same equation calculated with remainders after division by 31, scattered all over the place; the points are blue, only the point G at the bottom left is red On the left the curve y² = x³ + 3 over the real numbers, bent into an arc on the left, with a red point G at (1, 2). On the right a 31 by 31 grid with 42 points of the same equation calculated with remainders after division by 31, scattered all over the place; the points are blue, only the point G at the bottom left is red

The real prime of BN254 has 77 digits, or 254 in binary. That is where the name comes from: BN is the abbreviation of a family of curves and 254 is the number of bits. The family was described in 2005 by Paulo Barreto and Michael Naehrig, and what is special about it is that the prime p and the number of points on the curve r come from the same formula. You just choose one whole number u and substitute it:

p=36u4+36u3+24u2+6u+1

r=36u4+36u3+18u2+6u+1

The polynomials differ in a single term, so the number of points comes out just below p, smaller by exactly 6u2. Not every u gives primes, so you keep trying until both come out prime. Ethereum uses

u=4,965,661,367,192,848,881,

a number with 19 digits. Substituting it gives

p=21,888,242,871,839,275,222,246,405,745,257,275,088,696,311,157,297,823,662,689,037,894,645,226,208,583.

The number of points r is also a prime with 77 digits. A prime number of points is an advantage for cryptography: when you keep adding the same point to a point, you pass through all the points of the curve one by one and never get stuck in a small loop that an attacker could easily search. This is true of the small curve in the picture too, since 43 is a prime.

Pairing on an elliptic curve

On an ordinary curve, such as secp256k1 in Bitcoin or Curve25519, points can be added, and so multiplied by a whole number, but nothing more. BN254 can also do pairing.

Imagine a machine into which you drop two points and out comes a number. You cannot see inside, and you cannot read anything from the number. The only useful thing is that two results can be compared. Mathematicians call this machine the function e, and its result can be multiplied and raised to powers like an ordinary number. Everything rests on a single property:

e(aP,bQ)=e(P,Q)a⋅b

The multiples of the points P and Q are “pulled out”, and the two numbers a and b become their product in the exponent.

What is this good for? Adam knows three secret numbers a, b and c and claims that c = a · b. He does not want to reveal the numbers, so he shows only the points aP, bQ and cP. Nobody can read the secret number from a point; that is the discrete logarithm problem mentioned above. Even so, Bára checks his claim: she drops aP and bQ into the machine, then cP and Q, and compares:

e(aP,bQ)=e(P,Q)a⋅b

e(cP,Q)=e(P,Q)c

Bára cannot calculate the right-hand sides, because she does not know the numbers a, b, c. She only compares the two outputs of the machine, and they are equal exactly when c = a · b. In this way Bára convinces herself that Adam is not lying, without knowing a single one of his numbers. If Adam chose a = 3, b = 5 and c = 15, both cases would give e(P, Q)15. If he claimed c = 16, the second machine would spit out e(P, Q)16 and the cheating would be exposed.

Two identical machines e, one above the other. Into the top one go the blue point aP and the green point bQ, and out comes the red e(P, Q) to the power ab. Into the bottom one go the blue point cP and the green point Q, and out comes the red e(P, Q) to the power c. Between the two results there is a red equals sign Two identical machines e, one above the other. Into the top one go the blue point aP and the green point bQ, and out comes the red e(P, Q) to the power ab. Into the bottom one go the blue point cP and the green point Q, and out comes the red e(P, Q) to the power c. Between the two results there is a red equals sign

Without pairing, Bára would be stuck. She can add points, so from aP and cP she can calculate, for example, aP + cP = (a + c)P, but nobody can multiply two points together. This is the same obstacle that defeats Eva in key exchange on a curve. So pairing is one single multiplication that you are allowed to use, and nothing more.

Why does this not work on ordinary curves? Pairings exist on them too, but the resulting numbers are so astronomically large that nobody can calculate them. Curves like BN254 are deliberately chosen so that the result of the pairing lies in a number system a computer can still cope with. For BN254 these are numbers calculated modulo p, only not one at a time but twelve at once, rather as a complex number is made up of two real ones. Mathematicians call this the field Fp12, and the number 12 the embedding degree.

What it is for: zero-knowledge proofs

The example with c = a · b is a toy. But cryptographers can rewrite almost any calculation as similar equations between points: checking a password, verifying a signature, a whole block of transactions. The result is called a SNARK, a short proof that someone has carried out a calculation correctly. If, in addition, it does not reveal the inputs, it is called a zero-knowledge proof.

One of the most widely used is the Groth16 proof, described by Jens Groth in 2016. It is remarkably small: it consists of three points on the curve, however long the calculation behind it was. Verifying it means calculating three pairings and comparing the results, exactly as Bára did.

In 2017 Ethereum added so-called precompiled contracts for BN254: addition and multiplication of points (EIP-196) and a pairing check (EIP-197). These are calculations built directly into the network, so a smart contract does not have to carry them out slowly and expensively step by step. This made verifying a proof cheaper, and a whole range of applications grew up on BN254:

  • Tornado Cash and other applications for private payments, such as RAILGUN and Privacy Pools. Tornado Cash works roughly like this: you deposit, say, 1 ETH into a shared contract and record the hash of a secret password with the deposit. A week later you withdraw the ether to a completely different address and attach a zero-knowledge proof that says, “I know the password to one of the deposits in the contract, but I won’t tell you which one.” The contract verifies the proof and pays out the money. Nobody can match the deposit to the withdrawal, because there are thousands of deposits and the proof does not reveal which one is yours.
  • Rollups process thousands of transactions outside Ethereum and send to the network only the result and a short proof that it was calculated correctly. Ethereum then does not have to recalculate the transactions; it only needs to check the proof.
  • Bridges between blockchains use it to prove what has happened on another network.

In each of these cases the same holds: anyone who could find the secret numbers from the points on BN254 could produce fake proofs that pass verification. With Tornado Cash, such a proof would let them withdraw ether they had never deposited.

Why pairing curves are weaker

Pairing also has a dark side, one that has been known for more than thirty years. If Bára can compute pairings, so can an attacker. With their help, the attacker moves the problem off the curve and somewhere else: from the point kP they calculate the number e(kP, Q) = e(P, Q)k, and instead of searching for k on the curve, they search for k among the numbers in the field Fp12. This trick is called the MOV attack, after Alfred Menezes, Tatsuaki Okamoto and Scott Vanstone, who described it in the early 1990s.

What does the attacker gain? Different weapons work in the two worlds.

On the curve, the attacker has only a general attack, which needs roughly as many steps as the square root of the number of points. The number of points r has 254 bits, so

r≈2254=2127.

Cryptographers call this 127 bits of security: the attack needs around 2127 steps, which is safely out of reach.

In a field of numbers, however, there is a much cleverer method, the number field sieve. It is related to the weapon used to factorise large numbers in the RSA cipher, and it is why RSA keys must be thousands of bits long. The MOV attack moves the problem into a field with p12 elements. When you raise to a power, the number of bits roughly multiplies, and since p is a little smaller than 2254, you get:

log2⁡p12=12⋅log2⁡p≈12⋅253.6≈3043.2.

The number p12 lies between 23043 and 23044, so it has 3,044 bits.

Two horizontal bars on the same scale. At the top a short blue bar r with the number 254, at the bottom an orange bar p to the twelfth with the number 3,044, about twelve times longer Two horizontal bars on the same scale. At the top a short blue bar r with the number 254, at the bottom an orange bar p to the twelfth with the number 3,044, about twelve times longer

The problem thus moves into a much bigger world, but one in which attacking is considerably easier. The degree 12 was chosen deliberately so that the two balance out. A field with 3,000 bits is roughly as strong as RSA with a 3,072-bit key, which according to the usual tables corresponds to about 128 bits of security, the same as on the curve itself. That is where the 128 in the name alt_bn128 comes from: this was the security it was designed to have.

But the number field sieve kept improving. In 2016 Taechan Kim and Razvan Barbulescu presented an improved variant (abbreviated exTNFS) that can exploit two peculiarities of pairing curves. The first is that the prime p is not random but comes from a polynomial in u. The second is that the degree 12 is a composite number, 12 = 3 · 4, so the field can be built up in layers. According to an estimate by Barbulescu and Sylvain Duquesne from 2017, this brought the security of BN254 down to roughly 100 bits.

Bar chart of security in bits. The blue bar for 2005 reaches 128, the red bar for 2017 only about 100. A green dashed horizontal line at a height of 128 Bar chart of security in bits. The blue bar for 2005 reaches 128, the red bar for 2017 only about 100. A green dashed horizontal line at a height of 128

A hundred bits is still a lot: about 2100 operations. If a billion computers could each manage a billion operations per second, it would take

2100109⋅109≈1.3⋅1012

seconds, or about 40,000 years. In practice it cannot be broken. But the standard for new cryptography is 128 bits, and a difference of 28 bits means 228, roughly 270 million times less work. The safety margin the curve was created with is gone.

Those who could moved elsewhere. Zcash, a cryptocurrency that was one of the first to use zero-knowledge proofs, replaced BN254 with a new curve, BLS12-381, in its Sapling upgrade in 2018. It was designed in 2017 by Sean Bowe, and its prime p has 381 bits, so the field the MOV attack targets is also much larger. Ethereum, however, had BN254 built directly into the network, and applications kept running on it. It added precompiled contracts for BLS12-381 only in the Pectra upgrade in May 2025.

What happened on 6 December 2026

On 6 December 2026 the Ethereum Foundation announced on its blog that BN254 can no longer be considered secure, not even against classical, non-quantum attackers. The post was signed by Justin Drake and Antonio Sanso. The foundation has not yet published the details of the attack. The warning goes further than the 100-bit estimate from the previous section, which meant only a smaller margin, not an immediate threat. According to the foundation, Ethereum itself, ether and tokens in ordinary wallets and most applications are not at risk. That makes sense: transaction signatures in Ethereum rely on a different curve, secp256k1. It advises Tornado Cash users to withdraw their funds calmly over the coming weeks and to watch out for fake websites and fraudulent “recovery services”. Users of RAILGUN and Privacy Pools should follow the instructions of those applications. Rollups, bridges and other applications with proofs on BN254, on any blockchain, should review their defence in depth. This is a different kind of threat from the quantum computer that post-quantum cryptography is being prepared against: here the attackers have ordinary computers.

See also