Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article covers ERC-2494, which proposes Baby Jubjub to make elliptic curve cryptography safe and efficient inside Ethereum zk-SNARK circuits.

This article translates, summarizes, and expands on the following material.

I have also written about a range of other EIPs.

Overview

ERC-2494 defines Baby Jubjub, an elliptic curve for use inside Ethereum zk-SNARK circuits. Ethereum uses the alt_bn128 (BN254) curve for zk-SNARK verification. Although this curve is suitable for generating and verifying zk-SNARK proofs, its arithmetic is not natively suited to elliptic curve cryptography inside the zk-SNARK circuit. Baby Jubjub is defined over the field corresponding to the prime order rr of BN254 and enables elliptic curve operations inside the circuit, such as Pedersen hashing and EdDSA signatures. This makes it possible to build advanced cryptographic functionality using zero-knowledge proofs in Ethereum smart contracts.

Motivation

Scalability (processing capacity) and privacy (keeping transaction details confidential) are two barriers to wider blockchain adoption. Zero-knowledge proofs (ZKPs) offer a way to address both. In particular, zk-SNARK proofs have properties that make them suitable for Ethereum.

  • Non-interactive: only one message is needed.
  • Very small proofs.
  • Fast verification.

Smart contracts can act as zk-SNARK verifiers. Anyone can generate a proof off-chain and submit it in a transaction; the contract then verifies it automatically and executes logic based on the result. This can improve privacy and scalability.

However, the BN254 curve used in Ethereum's existing zk-SNARK implementations supports proof verification but does not provide native elliptic curve arithmetic inside the circuit for operations such as Pedersen hashes and EdDSA signatures. The reason is that the curve needed for those operations must be defined over the same finite field FrF_r as the zk-SNARK circuit. This is why Baby Jubjub was proposed. It is defined over FrF_r and enables elliptic curve cryptography inside zk-SNARK circuits. This supports more advanced uses of ZKPs, such as zk-rollups for scalability and transaction processing that protects confidential information.

Specification

Definition

Baby Jubjub is a twisted Edwards curve defined over the finite field FrF_r. The finite field FrF_r has prime order and contains rr elements, with the four arithmetic operations defined (division by zero excluded). The proposal uses the following large prime.

r=21888242871839275222246405745257275088548364400416034343698204186575808495617r = 21888242871839275222246405745257275088548364400416034343698204186575808495617

The curve is given by the equation below.

ax2+y2=1+dx2y2a x^2 + y^2 = 1 + d x^2 y^2

Here, a=168700a = 168700 and d=168696d = 168696. Baby Jubjub consists of the FrF_r-rational points on this curve, meaning points whose coordinates belong to FrF_r.

Curve Order

The set of all points on the Baby Jubjub curve has the following order (total number of points).

n=21888242871839275222246405745257275088614511777268538073601725287587578984328n = 21888242871839275222246405745257275088614511777268538073601725287587578984328

The order nn factors as follows.

n=h×ln = h \times l

The cofactor hh is the ratio of the order nn to the prime ll and describes a structural property of the curve.

  • h=8h = 8 (cofactor)
  • $ l = 2736030358979909402780800718157159386076813972158567259200215660948447373041$ (a 251-bit prime)

Generator Point

The specification defines a point GG that generates all nn points on the curve.

Gx=995203441582195749578291179787384436505546430278305826713579947235728471134G_x = 995203441582195749578291179787384436505546430278305826713579947235728471134 Gy=5472060717959818805561601436314318772137091100104008585924551046643952123905G_y = 5472060717959818805561601436314318772137091100104008585924551046643952123905

Repeatedly adding this point produces every point on the curve.

Base Point

The specification also defines a base point BB that generates the prime-order subgroup of order ll (whose points satisfy l×P=Ol \times P = O).

Bx=5299619240641551281634865583518297030282874472190772894086521144482721001553B_x = 5299619240641551281634865583518297030282874472190772894086521144482721001553 By=16950150798460657717958625567821834550301663161624707787222815936182638968203B_y = 16950150798460657717958625567821834550301663161624707787222815936182638968203

This point serves as the base for cryptographic algorithms such as EdDSA.

Arithmetic

Given two points with coordinates (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2), point addition on Baby Jubjub is calculated as follows.

x3=x1y2+y1x21+dx1x2y1y2x_3 = \frac{x_1 y_2 + y_1 x_2}{1 + d x_1 x_2 y_1 y_2} y3=y1y2−ax1x21−dx1x2y1y2y_3 = \frac{y_1 y_2 - a x_1 x_2}{1 - d x_1 x_2 y_1 y_2}

The same formulas work for both point addition and doubling, simplifying the implementation. All operations take place over the finite field FrF_r.

These properties make Baby Jubjub a foundation for efficient and secure elliptic curve arithmetic inside zk-SNARK circuits. In particular, they enable cryptographic operations such as Pedersen hashing and EdDSA that are not native to the circuit when using Ethereum's existing alt_bn128 curve.

Additional Details

Baby Jubjub was designed to support secure and efficient elliptic curve cryptography inside zk-SNARK circuits. Three factors shaped the choice of curve: curve form, generation process, and security criteria.

Curve Form

Baby Jubjub is a twisted Edwards curve that is birationally equivalent to a Montgomery curve. There are several reasons for choosing this form.

First, EdDSA (Edwards-curve Digital Signature Algorithm) is based on twisted Edwards curves, so this form simplifies signature algorithm implementation. In addition, twisted Edwards curves allow point addition to use a single complete formula, making group operations efficient inside circuits. The curve can also be converted to Montgomery form, which can make point addition and doubling faster. An implementation can therefore use Montgomery form outside the circuit and twisted Edwards form inside it for efficiency.

Curve Generation Process

To reduce the risk of backdoors (deliberately introduced weaknesses), the generation process for Baby Jubjub is transparent and deterministic. It follows the criteria defined in Appendix A.1 of RFC 7748, using a procedure that anyone can reproduce. Given a prime p≡1mod  4p \equiv 1 \mod 4, the procedure searches for the smallest A>0A > 0 satisfying the following conditions.

  • A−2A - 2 is divisible by 4.
  • The Montgomery curve y2=x3+Ax2+xy^2 = x^3 + Ax^2 + x has cofactor 8.

The input is the order of the alt_bn128 curve used by Ethereum for zk-SNARK verification. The procedure yields A=168698A = 168698.

r=2188824287…95617r = 2188824287\ldots95617

The curve was converted from Montgomery form to twisted Edwards form, and Sage was used to verify the order n=8×ln = 8 \times l.

The generator GG was chosen as the point of order nn with the smallest positive xx coordinate. The base point BB was defined as B=8×GB = 8 \times G, giving it order ll.

Security Criteria

Baby Jubjub is intended to resist known attacks on elliptic curves. The curve was therefore required to meet the SafeCurves project's security criteria, which assess curves against the best known attack methods. The proposal reports that Baby Jubjub meets these criteria.

Compatibility

Baby Jubjub is a twisted Edwards curve, but it can be mapped to other curve forms through birational transformations. In practice, Baby Jubjub has been used mainly in three forms.

  • Standard Twisted Edwards form
  • Montgomery form
  • Reduced Twisted Edwards form

These are different coordinate representations of the same curve, with explicit formulas for converting between them.

Three Curve Forms

Twisted Edwards Form (Standard)

The equation is as follows.

ax2+y2=1+dx2y2a x^2 + y^2 = 1 + d x^2 y^2

The parameters are a=168700a = 168700 and d=168696d = 168696. This is the standard representation of Baby Jubjub, with a generator point for the entire curve and a base point that generates the subgroup of order ll.

Montgomery Form

The equation is as follows.

By2=x3+Ax2+xB y^2 = x^3 + A x^2 + x

The parameters are A=168698A = 168698 and B=1B = 1. Montgomery form supports efficient elliptic curve arithmetic, particularly doubling, making it suitable for computation outside the circuit and for certain algorithms.

Reduced Twisted Edwards Form

The equation is as follows.

a′x2+y2=1+d′x2y2a' x^2 + y^2 = 1 + d' x^2 y^2

The parameter a′=−1a' = -1, and this representation scales the coordinates of the standard form. Some cryptographic algorithms use this form to improve efficiency.

d′=12181644023421730124874158521699555681764249180949974110617291017600649128846d' = 12181644023421730124874158521699555681764249180949974110617291017600649128846

Converting Between Forms

Coordinate transformations allow conversion between the three forms. Let (u,v)(u, v) denote the coordinates in Montgomery form, (x,y)(x, y) those in standard Twisted Edwards form, and (x′,y′)(x', y') those in reduced Twisted Edwards form.

Some transformations use a scaling factor ff.

f=6360561867910373094066688120553762416144456282423235903351243436111059670888f = 6360561867910373094066688120553762416144456282423235903351243436111059670888

Its negative is as follows.

−f=15527681003928902128179717624703512672403908117992798440346960750464748824729-f = 15527681003928902128179717624703512672403908117992798440346960750464748824729

The main transformations are listed below.

  • Montgomery → Twisted Edwards
x=u/v,y=(u−1)/(u+1)x = u / v,\quad y = (u - 1) / (u + 1)
  • Twisted Edwards → Montgomery
u=(1+y)/(1−y),v=(1+y)/((1−y)x)u = (1 + y) / (1 - y),\quad v = (1 + y) / ((1 - y)x)
  • Montgomery → Reduced Twisted Edwards
x′=u⋅(−f)/v,y′=(u−1)/(u+1)x' = u \cdot (-f) / v,\quad y' = (u - 1) / (u + 1)
  • Reduced Twisted Edwards → Montgomery
u=(1+y′)/(1−y′),v=(−f)⋅(1+y′)/((1−y′)x′)u = (1 + y') / (1 - y'),\quad v = (-f) \cdot (1 + y') / ((1 - y') x')
  • Twisted Edwards → Reduced Twisted Edwards
x′=x⋅(−f),y′=yx' = x \cdot (-f),\quad y' = y
  • Reduced Twisted Edwards → Twisted Edwards
x=x′/(−f),y=y′x = x' / (-f),\quad y = y'

These conversions preserve the mathematical structure of Baby Jubjub while allowing an implementation to choose a representation that suits its algorithm and execution environment. This improves efficiency both inside and outside circuits and maintains compatibility with existing implementations and different libraries.

Security

The security of Baby Jubjub was assessed using SafeCurves, a widely recognized set of criteria for elliptic curve cryptography. The criteria cover resistance to known attacks and security properties relevant to cryptographic implementations. The major checks performed on Baby Jubjub are described below.

Curve Parameter Validation

First, the parameters in the specification were checked to ensure they define a valid elliptic curve over the finite field FrF_r. The checks cover the following conditions.

  • rr is prime.
  • The values of aa and dd correctly define the elliptic curve equation.
  • The product of the cofactor hh and the prime ll equals the curve order nn.
  • The generator point GG generates the entire curve.
  • ll is prime and the base point BB has order ll.

Difficulty of the Discrete Logarithm Problem

Elliptic curve cryptography relies on the difficulty of the elliptic curve discrete logarithm problem (ECDLP). Baby Jubjub was checked for sufficient resistance to the following known attacks.

  • Rho method
    • The computational cost is 0.886×l0.886 \times \sqrt{l} additions, which amounts to at least 21002^{100} operations.
  • Additive and multiplicative transfer attacks
    • The embedding degree is at least (l−1)/100(l - 1) / 100.
  • Complex multiplication discriminant attacks
    • The magnitude of the discriminant DD of the complex multiplication field exceeds 21002^{100}.

Implementation Security

Baby Jubjub also meets several security requirements relevant to cryptographic implementations.

  • Montgomery Ladder
    • Supports the Montgomery ladder, a scalar multiplication method that can help implementations resist side-channel attacks.
  • Twist security
    • Provides resistance to small-subgroup, invalid-curve, and twist attacks.
  • Completeness
    • The point addition and doubling formulas are complete, so they do not encounter exceptional cases for valid inputs.
  • Indistinguishability
    • A mapping is available to represent elliptic curve points in a form indistinguishable from random strings.

References

Barry WhiteHat (@barryWhiteHat), Marta Bellés (@bellesmarta), Jordi Baylina (@jbaylina), "ERC-2494: Baby Jubjub Elliptic Curve [DRAFT]," Ethereum Improvement Proposals, no. 2494, January 2020. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-2494.

Conclusion

This article covered ERC-2494, which proposes Baby Jubjub for secure and efficient elliptic curve cryptography inside Ethereum zk-SNARK circuits.

If you have any questions, feel free to send me a direct message on Twitter.

Twitter @cardene777

I also publish content on the following platforms.

https://chaldene.net/