Overview

  • Applications:
    • In Ethereum 1.x
    • Previously used by Zcash
  • aka BN128, alt_bn128, BN256
  • Pairing-friendly elliptic curve
  • Security of ~100 bits
  • Barreto-Naehrig curves are constructed using the Complex Multiplication (CM) method
  • Currently, the only curve with precompiled contracts on Ethereum for elliptic curve addition, scalar multiplication and pairings, thus the most practical choice of pairing-friendly curve to use for verifying on-chain zkSNARKs for ZKP such as Groth16 and PLONK
  • ​ is the curve  over 
  • ​ is the twisted curve  over 
  • =

as Abelian Group

  • let be the BN254 curve
  • there is isomorphism of abelian groups:
    • i.e. is a 1-dimensional vector space over
    • i.e. is the set of points on (which has exactly elements), can be viewed as black boxes that can be added, subtracted and multiplied by arbitrary scalars from
    • thus, one can think of as the base field for Elliptic Curve Cryptography (ECC) (despite the coordinates of the points are in ), and any “numbers” or “scalars” in ECC are elements of
    • since , we are doing something like 254 bits integer arithmetic

Parameters

ParameterNotesSymbolSymbol (FTROU)halo2curvesEquationValue (dec)Value (hex)
Basic Equation (Weierstrass form), a = 0, b = 3
Weierstrass: aa00x0
Weierstrass: bb30x3
Embedding Degreealso degree of field extension12
Parameter49656613671928488810x44e992b44a6909f1
Base Field Modulus254 bit prime, derived from ppp, q (fq.rs)218882428718392752222464057452572750886963111572978236626890378946452262085830x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47
1. Scalar Field Modulus
2. Curve Order
3. Number of points inc point at infinity
254 bit prime, also the Baby Jubjub primeqrr (fr.rs)218882428718392752222464057452572750885483644004160343436982041865758084956170x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001
Trace of Frobeniust
TypeMacroPrimeStructsize() usizePrime Field (PF) ReprPF BitsPF CapacityPF SFROBENIUS_COEFF_FQ_C1 Size
Frfield_commonr - 254 bits[u64; 4]256b = 32B[u8; 32] = 256b = 32B254b253bu32: 28
Fqfield_commonp - 254 bits[u64; 4]256b = 32B[u8; 32] = 256b = 32B254b253b0
Fq2field_common{c0: Fq, c1: Fq}64BFq2Bytes = [u8; 64] = 64B254b253b0[Fq; 2]
Fq6field_common{c0: Fq2, c1: Fq2, c2: Fq2}192B[Fq2; 6]
Fq12field_common{c0: Fq6, c1: Fq6}384B[Fq2: 12]
G1new_curve_implFq32B
G2new_curve_implFq264B

Reference