{"eip":2494,"title":"Baby Jubjub Elliptic Curve","description":"This proposal defines Baby Jubjub, an elliptic curve designed to work inside zk-SNARK circuits in Ethereum.","authors":["Barry WhiteHat (@barryWhiteHat)","Marta Bellés (@bellesmarta)","Jordi Baylina (@jbaylina)"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2020-01-29","discussionsTo":"https://ethereum-magicians.org/t/eip-2494-baby-jubjub-elliptic-curve/3968","repo":"ERCs","label":"ERC-2494","officialUrl":"https://eips.ethereum.org/EIPS/eip-2494","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-2494.md","url":"https://eips.huatuo.xyz/eip-2494/","tldr":{"en":"Defines Baby Jubjub, a twisted Edwards curve built over the BN254 scalar field so that signatures and Pedersen hashes can be computed cheaply inside zk-SNARK circuits verified on Ethereum.","ja":"Baby Jubjub を定義する。BN254 のスカラー体上に作られたねじれエドワーズ曲線で、Ethereum 上で検証される zk-SNARK 回路の内部で、署名と Pedersen ハッシュを安価に計算できる。","ko":"Baby Jubjub을 정의한다. BN254 스칼라 체 위에 만든 뒤틀린 에드워즈 곡선으로, 이더리움에서 검증되는 zk-SNARK 회로 안에서 서명과 Pedersen 해시를 저렴하게 계산할 수 있게 한다.","zh":"定义 Baby Jubjub：一条建立在 BN254 标量域上的扭曲爱德华曲线，使签名和 Pedersen 哈希可以在以太坊上验证的 zk-SNARK 电路内部低成本地计算。"},"tags":["cryptography","elliptic-curve","zk-snark","eddsa","zero-knowledge"],"explainers":{"en":{"lang":"en","tldr":"Defines Baby Jubjub, a twisted Edwards curve built over the BN254 scalar field so that signatures and Pedersen hashes can be computed cheaply inside zk-SNARK circuits verified on Ethereum.","tags":["cryptography","elliptic-curve","zk-snark","eddsa","zero-knowledge"],"related":[196,197,3026],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-2494/","markdown":"## What problem does it solve?\n\nEthereum verifies zk-SNARK proofs over the alt_bn128 (BN254) curve, using the precompiles from [EIP-196](/eip-196/) and [EIP-197](/eip-197/). A circuit proven on BN254 works with numbers modulo BN254's prime group order `r`. That is fine for arithmetic, but if you want the circuit itself to do elliptic-curve cryptography (check an EdDSA signature, compute a Pedersen hash, derive a public key) you need a *second* curve whose coordinates live in that same field `F_r`. BN254 itself doesn't qualify.\n\nBaby Jubjub is that curve. Because its points are pairs of `F_r` elements, curve operations become native field arithmetic inside the circuit, which keeps constraint counts small.\n\n## How it works\n\n- **Field:** `F_r` with `r = 21888242871839275222246405745257275088548364400416034343698204186575808495617`, the order of BN254.\n- **Curve:** twisted Edwards form `a·x² + y² = 1 + d·x²·y²` with `a = 168700`, `d = 168696`.\n- **Order:** `n = 8 · l`, where the cofactor is 8 and `l` is a 251-bit prime.\n- **Points:** a generator `G` of the whole group and a base point `B = 8·G` that generates the prime-order subgroup. Protocols should work in the subgroup generated by `B`.\n- **Addition:** a single complete formula handles both addition and doubling, which is very efficient in circuits:\n\n```text\nx3 = (x1*y2 + y1*x2) / (1 + d*x1*x2*y1*y2)\ny3 = (y1*y2 - a*x1*x2) / (1 - d*x1*x2*y1*y2)\n```\n\nThe curve was generated deterministically (following RFC 7748's method) from the Montgomery form `y² = x³ + 168698·x² + x`, and the authors state it passes the SafeCurves criteria. The spec also gives the equivalent Montgomery and \"reduced twisted Edwards\" (`a' = -1`) forms and formulas to convert points between them; implementations often use the reduced form, so check which one a library expects.\n\n## Sample code\n\nPoint addition in TypeScript using native `BigInt` (no library):\n\n```ts\nconst r = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;\nconst A = 168700n, D = 168696n;\n\nconst mod = (x: bigint) =\u003e ((x % r) + r) % r;\nconst inv = (x: bigint) =\u003e {           // modular inverse via Fermat\n  let res = 1n, b = mod(x), e = r - 2n;\n  while (e \u003e 0n) { if (e \u0026 1n) res = mod(res * b); b = mod(b * b); e \u003e\u003e= 1n; }\n  return res;\n};\n\ntype Point = [bigint, bigint];\n\nexport function add([x1, y1]: Point, [x2, y2]: Point): Point {\n  const t = mod(D * x1 * x2 * y1 * y2);\n  const x3 = mod((x1 * y2 + y1 * x2) * inv(1n + t));\n  const y3 = mod((y1 * y2 - A * x1 * x2) * inv(1n - t));\n  return [x3, y3];\n}\n\nexport const isOnCurve = ([x, y]: Point) =\u003e\n  mod(A * x * x + y * y) === mod(1n + D * x * x * y * y);\n```\n\n## Things to know\n\n- **Status: Stagnant.** The proposal was never finalized as a standard, but the curve itself is widely used in zk tooling (for example circom/circomlib's EdDSA and Pedersen hash gadgets).\n- It is an ERC only in the sense of a shared definition: there is no precompile or contract interface. Baby Jubjub operations normally happen inside circuits, not in Solidity.\n- Mind the cofactor of 8: validate that points are in the prime-order subgroup before using them in signatures, or small-subgroup issues can arise.\n- Different libraries may use the twisted Edwards or reduced form with different coordinates for the same point; mixing them silently produces wrong results.\n"},"ja":{"lang":"ja","tldr":"Baby Jubjub を定義する。BN254 のスカラー体上に作られたねじれエドワーズ曲線で、Ethereum 上で検証される zk-SNARK 回路の内部で、署名と Pedersen ハッシュを安価に計算できる。","tags":["cryptography","elliptic-curve","zk-snark","eddsa","zero-knowledge"],"related":[196,197,3026],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-2494/","markdown":"## 何を解決するのか\n\nEthereum は、[EIP-196](/eip-196/) と [EIP-197](/eip-197/) のプリコンパイルを使って、alt_bn128（BN254）曲線上の zk-SNARK 証明を検証します。BN254 上で証明される回路は、BN254 の素数位数 `r` を法とする数を扱います。算術には問題ありませんが、回路自体に楕円曲線暗号（EdDSA 署名の検証、Pedersen ハッシュの計算、公開鍵の導出）をさせたい場合は、座標が同じ体 `F_r` に属する*第 2 の*曲線が必要です。BN254 自身はこれに該当しません。\n\nBaby Jubjub がその曲線です。点が `F_r` の要素の組なので、曲線演算は回路内でネイティブな体の算術になり、制約の数を小さく抑えられます。\n\n## 仕組み\n\n- **体：** `F_r`。`r = 21888242871839275222246405745257275088548364400416034343698204186575808495617`、これは BN254 の位数です。\n- **曲線：** ねじれエドワーズ形式 `a·x² + y² = 1 + d·x²·y²`、`a = 168700`、`d = 168696`。\n- **位数：** `n = 8 · l`。余因子は 8 で、`l` は 251 ビットの素数です。\n- **点：** 群全体の生成元 `G` と、素数位数の部分群を生成するベースポイント `B = 8·G`。プロトコルは `B` が生成する部分群の中で扱うべきです。\n- **加算：** 単一の完全な公式で加算と 2 倍算の両方を扱え、回路内で非常に効率的です。\n\n```text\nx3 = (x1*y2 + y1*x2) / (1 + d*x1*x2*y1*y2)\ny3 = (y1*y2 - a*x1*x2) / (1 - d*x1*x2*y1*y2)\n```\n\nこの曲線は、モンゴメリ形式 `y² = x³ + 168698·x² + x` から（RFC 7748 の方法に従って）決定論的に生成されており、作者は SafeCurves の基準を満たすと述べています。仕様には、等価なモンゴメリ形式と「簡約ねじれエドワーズ」（`a' = -1`）形式、およびそれらの間で点を変換する公式も載っています。実装では簡約形式がよく使われるので、ライブラリがどちらを期待しているか確認してください。\n\n## サンプルコード\n\nTypeScript のネイティブな `BigInt` による点の加算（ライブラリなし）:\n\n```ts\nconst r = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;\nconst A = 168700n, D = 168696n;\n\nconst mod = (x: bigint) =\u003e ((x % r) + r) % r;\nconst inv = (x: bigint) =\u003e {           // modular inverse via Fermat\n  let res = 1n, b = mod(x), e = r - 2n;\n  while (e \u003e 0n) { if (e \u0026 1n) res = mod(res * b); b = mod(b * b); e \u003e\u003e= 1n; }\n  return res;\n};\n\ntype Point = [bigint, bigint];\n\nexport function add([x1, y1]: Point, [x2, y2]: Point): Point {\n  const t = mod(D * x1 * x2 * y1 * y2);\n  const x3 = mod((x1 * y2 + y1 * x2) * inv(1n + t));\n  const y3 = mod((y1 * y2 - A * x1 * x2) * inv(1n - t));\n  return [x3, y3];\n}\n\nexport const isOnCurve = ([x, y]: Point) =\u003e\n  mod(A * x * x + y * y) === mod(1n + D * x * x * y * y);\n```\n\n## 知っておくべきこと\n\n- **ステータス：Stagnant。** この提案が標準として確定することはありませんでしたが、曲線自体は zk ツールで広く使われています（たとえば circom/circomlib の EdDSA や Pedersen ハッシュのガジェット）。\n- 共通の定義という意味でのみ ERC です。プリコンパイルもコントラクトインターフェースもありません。Baby Jubjub の演算は通常、Solidity ではなく回路の内部で行われます。\n- 余因子 8 に注意してください。署名で使う前に、点が素数位数の部分群に属することを検証しないと、小部分群の問題が起こりえます。\n- ライブラリによっては、同じ点に対してねじれエドワーズ形式と簡約形式のどちらか、異なる座標を使うことがあります。混ぜて使うと、黙って誤った結果になります。\n"},"ko":{"lang":"ko","tldr":"Baby Jubjub을 정의한다. BN254 스칼라 체 위에 만든 뒤틀린 에드워즈 곡선으로, 이더리움에서 검증되는 zk-SNARK 회로 안에서 서명과 Pedersen 해시를 저렴하게 계산할 수 있게 한다.","tags":["cryptography","elliptic-curve","zk-snark","eddsa","zero-knowledge"],"related":[196,197,3026],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-2494/","markdown":"## 어떤 문제를 해결하나요?\n\n이더리움은 [EIP-196](/eip-196/)과 [EIP-197](/eip-197/)의 프리컴파일을 사용해 alt_bn128(BN254) 곡선 위의 zk-SNARK 증명을 검증합니다. BN254에서 증명되는 회로는 BN254의 소수 군 위수 `r`을 법으로 하는 수를 다룹니다. 산술에는 문제가 없지만, 회로 자체가 타원곡선 암호(EdDSA 서명 검증, Pedersen 해시 계산, 공개키 유도)를 하게 하려면 좌표가 같은 체 `F_r`에 속하는 *두 번째* 곡선이 필요합니다. BN254 자체는 여기에 해당하지 않습니다.\n\nBaby Jubjub이 바로 그 곡선입니다. 점이 `F_r` 원소의 쌍이므로 곡선 연산이 회로 안에서 네이티브 체 산술이 되어 제약 수가 작게 유지됩니다.\n\n## 어떻게 동작하나요?\n\n- **체:** `F_r`, 여기서 `r = 21888242871839275222246405745257275088548364400416034343698204186575808495617`, 즉 BN254의 위수입니다.\n- **곡선:** 뒤틀린 에드워즈 형태 `a·x² + y² = 1 + d·x²·y²`, `a = 168700`, `d = 168696`.\n- **위수:** `n = 8 · l`, 여기서 공통인수(cofactor)는 8이고 `l`은 251비트 소수입니다.\n- **점:** 전체 군의 생성원 `G`와, 소수 위수 부분군을 생성하는 기준점 `B = 8·G`. 프로토콜은 `B`가 생성하는 부분군 안에서 동작해야 합니다.\n- **덧셈:** 하나의 완전한 공식으로 덧셈과 두 배 연산을 모두 처리하며, 회로에서 매우 효율적입니다.\n\n```text\nx3 = (x1*y2 + y1*x2) / (1 + d*x1*x2*y1*y2)\ny3 = (y1*y2 - a*x1*x2) / (1 - d*x1*x2*y1*y2)\n```\n\n이 곡선은 Montgomery 형태 `y² = x³ + 168698·x² + x`에서 (RFC 7748의 방법에 따라) 결정론적으로 생성되었으며, 작성자들은 SafeCurves 기준을 통과한다고 밝힙니다. 명세에는 동등한 Montgomery 형태와 \"간소화된 뒤틀린 에드워즈\"(`a' = -1`) 형태, 그리고 그 사이에서 점을 변환하는 공식도 실려 있습니다. 구현에서는 간소화된 형태를 자주 쓰므로, 라이브러리가 어느 쪽을 기대하는지 확인하세요.\n\n## 샘플 코드\n\nTypeScript 네이티브 `BigInt`로 구현한 점 덧셈(라이브러리 없음):\n\n```ts\nconst r = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;\nconst A = 168700n, D = 168696n;\n\nconst mod = (x: bigint) =\u003e ((x % r) + r) % r;\nconst inv = (x: bigint) =\u003e {           // modular inverse via Fermat\n  let res = 1n, b = mod(x), e = r - 2n;\n  while (e \u003e 0n) { if (e \u0026 1n) res = mod(res * b); b = mod(b * b); e \u003e\u003e= 1n; }\n  return res;\n};\n\ntype Point = [bigint, bigint];\n\nexport function add([x1, y1]: Point, [x2, y2]: Point): Point {\n  const t = mod(D * x1 * x2 * y1 * y2);\n  const x3 = mod((x1 * y2 + y1 * x2) * inv(1n + t));\n  const y3 = mod((y1 * y2 - A * x1 * x2) * inv(1n - t));\n  return [x3, y3];\n}\n\nexport const isOnCurve = ([x, y]: Point) =\u003e\n  mod(A * x * x + y * y) === mod(1n + D * x * x * y * y);\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** 이 제안은 표준으로 확정된 적이 없지만, 곡선 자체는 zk 도구에서 널리 쓰입니다(예: circom/circomlib의 EdDSA와 Pedersen 해시 가젯).\n- 공통 정의라는 의미에서만 ERC입니다. 프리컴파일도 컨트랙트 인터페이스도 없습니다. Baby Jubjub 연산은 보통 Solidity가 아니라 회로 안에서 일어납니다.\n- 공통인수 8에 유의하세요. 서명에 쓰기 전에 점이 소수 위수 부분군에 속하는지 검증하지 않으면 작은 부분군 문제가 생길 수 있습니다.\n- 라이브러리마다 같은 점에 대해 뒤틀린 에드워즈 형태나 간소화된 형태, 서로 다른 좌표를 쓸 수 있습니다. 섞어 쓰면 조용히 잘못된 결과가 나옵니다.\n"},"zh":{"lang":"zh","tldr":"定义 Baby Jubjub：一条建立在 BN254 标量域上的扭曲爱德华曲线，使签名和 Pedersen 哈希可以在以太坊上验证的 zk-SNARK 电路内部低成本地计算。","tags":["cryptography","elliptic-curve","zk-snark","eddsa","zero-knowledge"],"related":[196,197,3026],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-2494/","markdown":"## 它解决什么问题？\n\n以太坊使用 [EIP-196](/eip-196/) 和 [EIP-197](/eip-197/) 的预编译，在 alt_bn128（BN254）曲线上验证 zk-SNARK 证明。在 BN254 上证明的电路处理的是模 BN254 素数群阶 `r` 的数。这对算术没有问题，但如果你想让电路本身做椭圆曲线密码学（验证 EdDSA 签名、计算 Pedersen 哈希、推导公钥），就需要一条*第二条*曲线，其坐标位于同一个域 `F_r` 中。BN254 本身不满足这一点。\n\nBaby Jubjub 就是这样一条曲线。由于它的点是 `F_r` 元素的有序对，曲线运算在电路内变成了原生的域算术，从而使约束数量保持很小。\n\n## 它如何运作\n\n- **域：** `F_r`，其中 `r = 21888242871839275222246405745257275088548364400416034343698204186575808495617`，即 BN254 的阶。\n- **曲线：** 扭曲爱德华形式 `a·x² + y² = 1 + d·x²·y²`，`a = 168700`，`d = 168696`。\n- **阶：** `n = 8 · l`，其中余因子为 8，`l` 是 251 位素数。\n- **点：** 整个群的生成元 `G`，以及生成素数阶子群的基点 `B = 8·G`。协议应在由 `B` 生成的子群中工作。\n- **加法：** 一个完备公式同时处理加法和倍点，在电路中非常高效：\n\n```text\nx3 = (x1*y2 + y1*x2) / (1 + d*x1*x2*y1*y2)\ny3 = (y1*y2 - a*x1*x2) / (1 - d*x1*x2*y1*y2)\n```\n\n该曲线是从 Montgomery 形式 `y² = x³ + 168698·x² + x` 出发，按 RFC 7748 的方法确定性生成的，作者声明它通过了 SafeCurves 的各项标准。规范还给出了等价的 Montgomery 形式和\"简化扭曲爱德华\"（`a' = -1`）形式，以及在它们之间转换点的公式；实现中常用简化形式，所以请确认所用的库期望哪一种。\n\n## 示例代码\n\n用 TypeScript 原生 `BigInt` 实现点加法（不依赖库）：\n\n```ts\nconst r = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;\nconst A = 168700n, D = 168696n;\n\nconst mod = (x: bigint) =\u003e ((x % r) + r) % r;\nconst inv = (x: bigint) =\u003e {           // modular inverse via Fermat\n  let res = 1n, b = mod(x), e = r - 2n;\n  while (e \u003e 0n) { if (e \u0026 1n) res = mod(res * b); b = mod(b * b); e \u003e\u003e= 1n; }\n  return res;\n};\n\ntype Point = [bigint, bigint];\n\nexport function add([x1, y1]: Point, [x2, y2]: Point): Point {\n  const t = mod(D * x1 * x2 * y1 * y2);\n  const x3 = mod((x1 * y2 + y1 * x2) * inv(1n + t));\n  const y3 = mod((y1 * y2 - A * x1 * x2) * inv(1n - t));\n  return [x3, y3];\n}\n\nexport const isOnCurve = ([x, y]: Point) =\u003e\n  mod(A * x * x + y * y) === mod(1n + D * x * x * y * y);\n```\n\n## 需要注意\n\n- **状态：Stagnant。** 该提案从未被最终确定为标准，但这条曲线本身在 zk 工具中被广泛使用（例如 circom/circomlib 的 EdDSA 和 Pedersen 哈希组件）。\n- 它只是在\"共享定义\"的意义上算 ERC：没有预编译，也没有合约接口。Baby Jubjub 运算通常发生在电路内部，而不是 Solidity 中。\n- 注意余因子 8：在签名中使用点之前，要验证它们属于素数阶子群，否则可能出现小子群问题。\n- 不同的库对同一个点可能使用扭曲爱德华形式或简化形式，坐标各不相同；混用会悄无声息地产生错误结果。\n"}}}
