Part 2: Technical Overview

The Building Blocks

Curve BLS12-381

  • BLS12-381 is a cryptographically secure, pairing-friendly elliptic curve.
  • Bilinear pairings enable important features such as signature aggregation and polynomial commitments.

This chapter is a revised and updated version of my original homage to curve BLS12-381. It is not required reading – it's fine to treat the elliptic curve implementation as a black box – but I've included it for those who enjoy digging deeper. While curve BLS12-281 is the main focus, much of what follows covers broader background material on elliptic curves and pairings in general. As a non-mathematician1, all of this was very mysterious when I first encountered it; it has taken me quite a while to feel that I have some grasp of what's going on.

Introduction

Elliptic curves have been part of the blockchain toolkit since day one. For example, both Bitcoin and Ethereum use the curve known as secp256k1 to sign users' transactions with ECDSA, the "elliptic curve digital signature algorithm".

Curve secp256k1 is not used in Ethereum's consensus layer, however. Instead we use a curve called BLS12-381 because it supports a mathematical operation called bilinear pairing - it is a "pairing-friendly" elliptic curve. Pairings are very cool because, among other things, they allow us to do signature aggregation and polynomial commitments, operations that have become foundational to Ethereum's consensus but are not supported by most elliptic curves.

Pairing-friendly elliptic curves are curves with both a favourable embedding degree (to be explained below), and a large prime-order subgroup (also see below). These are rare. If you create an elliptic curve at random, it has a miniscule chance of being pairing-friendly. Nevertheless, they can be constructed, and several families of pairing-friendly curves are known in addition to the BLS curves.

Some good reading if you want to learn more about pairing-based cryptography:

  • Vitalik has a great general introduction to elliptic curve pairings.
  • Alin Tomescu gives an entertaining review of the history of the development of pairing based cryptography and some of its applications in a blog post, Pairings or bilinear maps2.
  • The NIST report on pairing-based cryptography is quite readable. I recommend Section 2 and the Appendix.
  • Also good background is the draft IETF standard for pairing-friendly curves.

If you really want to understand this stuff then Pairings for Beginners is unsurpassed. It turns out to be a lot less scary than it looks if you work through it carefully, studying the examples as you go.

BLS12-381 in Ethereum

The possibility of signature aggregation was the key breakthrough that made Ethereum's beacon chain possible. It allowed us to abandon the previous, impractical, proof of stake plans in mid-2018 and go all-in on the beacon chain approach.

To perform signature aggregation, we need to use a cryptographically secure, pairing-friendly elliptic curve. As noted, these are quite rare.

The main reason for the choice of BLS12-381 for the beacon chain is that it is a sweet-spot among the available pairing-friendly curves in terms of security (originally thought to be around 128 bits, but see below), speed of the pairing operation, and the sizes of the public key (48 bytes) and signature (96 bytes). Among other candidates, the BN128/BN254 curve has smaller signatures but lower security (~100 bits). Other pairing-friendly curves (such as the BW, MNT, and KSS families) tend to have larger signatures or slower pairings for a similar security level.

Other influential factors were the following.

  • BLS12-381 was designed for Zcash and was already being adopted by other chains such as Chia. There is safety in numbers (more scrutiny, better libraries), and interoperability between chains was a guiding principle at the time, although that ambition has faded since.
  • The original paper3 about signature aggregation for blockchains used BLS12-381 in its analysis.
  • BLS curves are included in the IETF pairing-friendly curve standardisation process. Standardisation makes everything easier4.

It's worth mentioning that BLS12-381 is also designed to be efficient for ZK-SNARK proving (which is Zcash's main purpose for it), but this wasn't a major consideration for Ethereum's original adoption of it.

All in all, I don't recall any significant debate about the adoption of curve BLS12-381; it was simply the obvious choice at the time.

About curve BLS12-381

History

Curve BLS12-381 was designed by Sean Bowe in early 2017 as the foundation for an upgrade to the Zcash protocol. It is both pairing-friendly (making it efficient for digital signatures) and effective for constructing ZK-SNARKs.

Ethereum 2.0 was a fairly early adopter of the curve. A number of other blockchains (Zcash, Chia, Dfinity, Filecoin, Algorand) also use BLS12-381, and several cryptographic libraries support it. The main library used by Ethereum clients is Blst, which was commissioned by the Ethereum Foundation for this purpose; other libraries that implement the curve are Gnark, Noble, Herumi/mcl, and Constantine.

As for standardisation, BLS12-381 is included in the emerging IETF standard for Pairing-Friendly Curves. It also appears in the draft standards for Hashing to Elliptic Curves, and BLS signatures5.

Naming

BLS12-381 is part of a family of curves described by Barreto, Lynn, and Scott (they are the B, L, and S in view here - a mostly different BLS trio appears in connection with BLS signatures).

The 12 is the embedding degree of the curve: neither too low, nor too high. We'll discuss embedding degrees in a little while.

The 381 is the number of bits needed to represent coordinates on the curve: the field modulus, qq. The coordinates of a point come from a finite field that has a prime order, and that prime number, qq, is 381 bits wide. 381 is a fairly handy number as we can use 48 bytes per field element, with 3 bits left over for useful flags or arithmetic optimisations. The size of this number is guided both by security requirements and implementation efficiency.

Curve equation and parameters

The basic equation of the BLS12-381 curve is y2=x3+4y^2=x^3+4.6

The key parameters for a BLS curve are set using a single parameter x\tt x (different from the xx in the curve equation!) that can be selected to give the curve nice properties for implementation. BLS12-381 is derived from the k0(mod 6)k\equiv0\,\text{(mod 6)} case of Construction 6.6 in the taxonomy.

Specific design goals for BLS12-381 are:

  • x\tt x has "low hamming weight", meaning that it has very few bits set to 1. This is particularly important for the efficiency of the algorithm that calculates pairings (the Miller loop).
  • The field modulus qq mentioned above is prime and has 383 bits or fewer, which makes 64-bit or 32-bit arithmetic on it more efficient.
  • The order rr of the subgroups we use is prime and has 255 bits or fewer, which is good for the same reason as above.
  • The security target is 128 bits - see below.
  • To support ZK-SNARK schemes, we want to have a large power of two root of unity in the field FrF_r. This means we want 2n2^n to be a factor of r1r-1, for some biggish nn. Making x\tt x a multiple of 2n22^\frac{n}{2} will achieve this. This property is key to being able to use fast Fourier transforms for interesting things like polynomial multiplication.

The value x={\tt x}= -0xd201000000010000 (hexadecimal, note that it is negative) gives the largest qq and the lowest Hamming weight meeting these criteria. With this x\tt x value we have,

Parameter EquationValueComments
Field modulusqq13(x1)2(x4x2+1)+x\frac{1}{3}{({\tt x}-1)}^2\allowbreak {({\tt x}^4-{\tt x}^2+1)}\allowbreak +{\tt x}Hex: 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab
Dec: 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787
381 bits, prime
Subgroup sizerr(x4x2+1){({\tt x}^4-{\tt x}^2+1)}Hex: 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001
Dec: 52435875175126190479447740508185965837690552500527637822603658699938581184513
255 bits, prime
Field extensions

Field extensions are fundamental to elliptic curve pairings. The "12" in BLS12-381 is not only the embedding degree, it is also (relatedly) the degree of field extension that we will need to use to calculate pairings.

The field FqF_q can be thought of as just the integers modulo qq: 0,1,,q10,1,\ldots,q-1. But what kind of beast is Fq12F_{q^{12}}, the twelfth extension of FqF_q?

I have been unable to find any straightforward explainers of field extensions, so here's my attempt.

Let's construct Fq2F_{q^2}, the quadratic extension of FqF_q. In Fq2F_{q^2} we will represent field elements as first-degree polynomials like a0+a1xa_0 + a_1x, which we can write more concisely as (a0,a1)(a_0, a_1) if we wish.

Adding two elements is easy: (a,b)+(c,d)=a+bx+c+dx=(a+c)+(b+d)x=(a+c,b+d){(a, b) + (c, d)} = {a + bx + c + dx} = {(a+c) + (b+d)x} = {(a+c, b+d)}. We just need to be sure to reduce a+ca+c and b+db+d modulo qq.

What about multiplying? (a,b)×(c,d)=(a+bx)(c+dx)=ac+(ad+bc)x+bdx2=???{(a, b) \times (c, d)} = {(a + bx)(c + dx)} = {ac + (ad+bc)x+ bdx^2} = {\tt ???}. Oops - what are we supposed to do with the x2x^2 that's appeared?

We need a rule for reducing polynomials so that they have a degree less than two. In this example we're going to take x2+1=0{x^2 + 1} = 0 as our rule, but we could make other choices. There are only two rules about our rule7,

  1. it must be a degree kk polynomial, where kk is our extension degree, 22 in this case; and
  2. it must be irreducible in the field we are extending. That means it must not be possible to factor it into two or more lower degree polynomials.

Applying our rule, by substituting x2=1x^2 = -1 to eliminate the unwanted x2x^2 term, gives us the final result (a,b)×(c,d)=ac+(ad+bc)x+bdx2=(acbd)+(ad+bc)x=(acbd,ad+bc){(a, b) \times (c, d)} = {ac + (ad+bc)x + bdx^2} = {(ac-bd) + (ad+bc)x} = {(ac-bd, ad+bc)}. This might look a little familiar from complex arithmetic: (a+ib)×(c+id)=(acbd)+(ad+bc)i{(a+ib) \times (c+id)} = {(ac-bd) + (ad+bc)i}. This is not a coincidence! The complex numbers are a quadratic extension of the real numbers.

Complex numbers can't be extended any further because there are no irreducible polynomials over the complex numbers. But for finite fields, if we can find an irreducible kk-degree polynomial in our field FqF_q, and we often can, then we are able to extend the field to FqkF_{q^k}, and represent the elements of the extended field as degree k1k-1 polynomials, a0+a1x++ak1xk1a_0 + a_1x + \cdots + a_{k-1}x^{k-1}. We can write this compactly as (a0,,ak1)(a_0,\ldots,a_{k-1}), as long as we remember that there may be some very funky arithmetic going on.

Also worth noting is that modular reductions like this (our reduction rule) can be chosen so that they play nicely with the twisting operation.

In practice, large extension fields like Fq12F_{q^{12}} are implemented as towers of smaller extensions. That's an implementation aspect, so I've put it in the more practical section below.

The curves

One of the initially non-obvious things about BLS12-381 is that we're really dealing with two curves, not one. Both curves share more-or-less the same curve equation, but are defined over different fields.

The simpler one is over the finite field FqF_q, which is just the integers mod qq. So the curve has points only where the equation y2=x3+4y^2=x^3+4 has solutions with xx and yy both integers less than qq. Such a point is (0,2)(0,2), for example8. We shall call this curve E(Fq)E(F_q).

The other curve is defined over an extension of FqF_q to Fq2F_{q^2} (think complex numbers). In this case, the curve equation is slightly modified to be y2=x3+4(1+i)y^2=x^3+4(1+i)9, and we'll call the curve E(Fq2)E'(F_{q^2})10. We'll explain where this comes from in the section on Twists.

As an aside, the curve order of E(Fq2)E'(F_{q^2}) (the number of points on the curve) is vastly bigger than that of E(Fq)E(F_q); the curve equation has many more solutions when the domain is extended to the complex numbers. In fact, the order of EE is close to qq, and the order of EE' is close to q2q^2. This is not a coincidence, but a result of the Hasse bound. See the reference section for the actual values of these numbers.

The Subgroups

In this section and the next I'll attempt to explain how BLS12-381 ended up having two curve equations rather than one.

A pairing is a bilinear map. This means that it takes as input two points, each from a group of the same order, rr. This rr must be prime, and for security needs to be large. Also, for rather technical reasons11, these two groups need to be distinct. Let's call them G1G_1 and G2G_2.

Unfortunately, our simple curve E(Fq)E(F_q) has only a single large subgroup, so we can't define a useful pairing based solely on E(Fq)E(F_q).

However, if we keep extending the field over which EE is defined, it can be proved that we eventually find a curve that has more than one subgroup of order rr (in fact, r+1r+1 of them). That is, for some kk, E(Fqk)E(F_{q^k})12 contains other subgroups of order rr that we can use. One of these subgroups contains only points having a trace of zero13, and we choose that subgroup to be G2G_2.

This number kk, the amount that we need to extend the base field by to find the new group, is called the embedding degree of the curve, which in our case is the "12" in BLS12-381. We'll discuss embedding degree more in a moment.

For completeness, note that each of G1G_1 and G2G_2 shares with its containing curve the "point at infinity". This is the identity element of the elliptic curve arithmetic group, often denoted O\mathcal{O}. For any point PP, P+O=O+P=PP+\mathcal{O}=\mathcal{O}+P=P.

To summarise where we've got to, we now have a group G1G_1 of order rr in E(Fq)E(F_q), and we have a distinct group G2G_2 of order rr in E(Fq12)E(F_{q^{12}}). Yay - we can do pairings!

Twists

But there's another challenge. As discussed earlier, doing arithmetic in Fq12F_{q^{12}} is horribly complicated and inefficient, and curve operations need a lot of arithmetic. But there is a way to side-step this.

A twist is something like a coordinate transformation. Rather wonderfully, this can be used to transform our E(Fq12)E(F_{q^{12}}) curve into a curve defined over a lower degree field that still has an order rr subgroup. Moreover, this subgroup has a simple mapping to and from our G2G_2 group14.

Curve BLS12-381 uses a "sextic twist". This means that it reduces the degree of the extension field by a factor of six. So G2G_2 on the twisted curve can be defined over Fq2F_{q^2} instead of Fq12F_{q^{12}}, which is a huge saving in complexity.

If we can find a uu such that u6=(1+i)1u^6=(1+i)^{-1}, then we can define our twisting transformation as (x,y)(x/u2,y/u3)(x,y)\rightarrow(x/u^2,y/u^3)15. This transforms our original curve E:y2=x3+4E:y^2=x^3+4 into the curve E:y2=x3+4/u6=x3+4(1+i)E':y^2 = {x^3 + 4/u^6} = {x^3 + 4(1+i)}. EE and EE' look different, but are actually the same object presented with respect to coefficients in different base fields16.

When the twist is done correctly, the resulting EE' has a subgroup of order rr that maps to our G2G_2 group and vice-versa. So, it turns out that we can work in EE' over Fq2F_{q^2} for most purposes, and map G2G_2 back to E(Fq12)E(F_{q^{12}}) only when required (that is, only while actually computing pairings).

So these are the two groups we will be using:

  • G1G_1 E(Fq)\subset E(F_q) where E:y2=x3+4E: y^2 = x^3 + 4
  • G2G_2 E(Fq2)\subset E'(F_{q^2}) where E:y2=x3+4(1+i)E': y^2 = x^3 + 4(1+i)

And that's the story of why BLS12-381 looks like two curves, not one. E(Fq2)E'(F_{q^2}) is called the twist of, or the twisted curve corresponding to, E(Fq)E(F_q).

Note that coordinates of points in the G1G_1 group are pairs of integers, and coordinates of points in the G2G_2 group are pairs of complex integers, so G2G_2 points take twice the amount of storage, and are more expensive to work with. This leads to interesting implementation trade-offs.

Pairings

So, what's this pairing thing all about?

As far as BLS12-381 is concerned, a pairing is a function that simply takes a point PG1E(Fq)P\in G_1\subset E(F_q), and a point QG2E(Fq2)Q\in G_2\subset E'(F_{q^2}) and outputs a point from a group GTFq12G_T\subset F_{q^{12}}. That is, a pairing ee is a mapping, e:G1×G2GTe:G_1\times G_2\rightarrow G_T.

Elliptic curve pairings are usually denoted e(,)e(\cdot,\cdot) (they take a pair of operands, hence the name) and have certain properties.

  1. e(,)e(\cdot,\cdot) is bilinear.
  2. e(,)e(\cdot,\cdot) is efficiently computable. For any PP and QQ, we must have a polynomial time algorithm for computing e(P,Q)e(P,Q).
  3. e(,)e(\cdot,\cdot) is non-degenerate. That is, for a non-zero PG1P \in G_1 there must exist some QG2Q \in G_2 such that e(P,Q)1e(P,Q) \neq 1 (the identity in GTG_T), and vice versa. This ensures that the pairing is "non-trivial" and actually useful.
Bilinearity

The property of pairings that we are most interested in is that they are bilinear. That is, e(P,Q)e(P,Q) is linear in both its arguments.

Anyone who can do multiplication is familiar with bilinearity : let f(a,b)a×bf(a,b) \equiv a \times b, then f(a1+a2,b)=f(a1,b)+f(a2,b){f(a_1 + a_2, b)} = {f(a_1, b) + f(a_2, b)}, and f(a,b1+b2)=f(a,b1)+f(a,b2){f(a, b_1 + b_2)} = {f(a, b_1) + f(a, b_2)} - multiplication is linear in both its arguments.

We could construct a similar bilinear function for elliptic curve points by multiplying the discrete logarithms of the two input points. If gg is a generator of an elliptic curve group, then a point PP is, by definition, a multiple of that generator, P=[p]gP=[p]g, and pp is said to be the discrete logarithm of PP17. So, given points P=[p]gP=[p]g and Q=[q]gQ=[q]g, we could find pp and qq and define e(P,Q)=[pq]ge(P,Q) = [pq]g - this boils down to integer multiplication and is therefore bilinear. The flaw with this, however, is that taking discrete logarithms on our elliptic curve is assumed to be very, very expensive by design. It basically requires brute-force calculation with a cost proportional to the curve order, which is what keeps our signature scheme secure. This is why the pairing operation needs its second property: it must be efficiently computable.

Bilinear pairings

I'm not going to go into all the details of how the efficiently computable pairing function e(,)e(\cdot,\cdot) is constructed – we can pretty much treat it as a black box – nevertheless, a great introduction is Vitalik's article, and for all the glorious details let me pitch again Pairings for Beginners.

Recall that ee is a mapping, e:G1×G2GTe:G_1\times G_2\rightarrow G_T. Since e(,)e(\cdot,\cdot) is linear in both its arguments, it behaves as follows.

  • e(P,Q+R)=e(P,Q)e(P,R)e(P, Q + R) = e(P, Q) \cdot e(P, R), and
  • e(P+S,R)=e(P,R)e(S,R)e(P + S, R) = e(P, R) \cdot e(S, R)

From this, we can deduce that all of the following identities hold:

  • e([a]P,[b]Q)=e(P,[b]Q)a=e(P,Q)ab=e(P,[a]Q)b=e([b]P,[a]Q){e([a]P,[b]Q)} = {e(P,[b]Q)^a} = {e(P,Q)^{ab}} = {e(P,[a]Q)^b} = {e([b]P,[a]Q)}

Note that, traditionally, the group operation in G1G_1 and G2G_2 is written additively, and the group operation in GTG_T is written multiplicatively18 - I've used a "\cdot" to show that above. So we write [n]P[n]P or [n]Q[n]Q for applying the group operation nn times on PG1P \in G_1 or on QG2Q \in G_2, but we write e(P,Q)ne(P,Q)^n (rather than [n]e(P,Q)[n]e(P,Q)) because e(P,Q)GTe(P,Q) \in G_T.

If we look past this notational weirdness, then we can loosely think of a pairing as being a way to "multiply" a point in G1G_1 by a point in G2G_2, an operation that cryptographically secure elliptic curves don't normally support in any practical way.

In any case, bilinearity is just what we need when verifying BLS digital signatures.

Embedding degree

We've mentioned the embedding degree several times, and it is significant enough to appear in the name of the curve.

The embedding degree, kk, is calculated as the smallest positive integer such that rr divides (qk1)(q^k − 1). So, in the case of BLS12-381, rr is a factor of (q121)(q^{12}-1)19, but not of any lower power.

It turns out that this number, kk, gives the smallest field extension FqkF_{q^k} that satisfies the two equivalent conditions:

  • FqkF_{q^k} contains more than one subgroup of order rr (used for constructing G2G_2, see above);
  • FqkF_{q^k} contains all the rrth roots of unity (used for constructing GTG_T, see below)

These are the conditions we need to satisfy for pairings to be possible.

The choice of an embedding degree is a balance between security and efficiency (as ever). On the security front, the embedding degree is also known as the security multiplier: a higher embedding degree makes the discrete logarithm problem harder to solve in GTG_T. However, a high embedding degree means we have to do field operations in high-degree extensions, such as Fq12F_{q^{12}}, which is clunky and inefficient. (This is true even when using twists: the maximum available twist is degree six, so the best we can do is to reduce the field extension degree by six. And in any case pairing must be done in the large extension field.)

Embedding degrees of 12 or 24 seem to be a current sweet-spot for many applications. Once again, the embedding degree of BLS12-381 is 12 - it's in the name.

Security level

Security of cryptographic systems is measured in bits. Informally, I take nn-bit security to mean something like, "would need about 2n2^n operations to break it".

For elliptic curve cryptography, security is all about making the discrete logarithm problem hard. That is, given a point gg and a point gkg^k (in multiplicative group notation), finding kk must be infeasible without prior knowledge, meaning that we want it to take at least 2n2^n operations for n>100n>100 or so, in today's terms.

For pairing-friendly curves, the discrete logarithm problem must be hard in each of the three of the groups we are using, G1G_1, G2G_2, and GTG_T. Thus, to target nn-bit security,

  • The prime group order rr must be at least 2n2n bits long as there are algorithms such as Pollard's rho algorithm that have cost O(r)O(\sqrt{r}).
  • Our extension field FqkF_{q^k} must be large enough not to be vulnerable to methods like the number field sieve.

BLS12-381 was intended to offer around a 128 bit security level, based on these criteria, and this was supported by initial analyses. See Table 1.1 in the Taxonomy, for example.

However, on closer examination it seems that "the finite extension field of size 3072 = 12 × 256 bits is not big enough" (quoting section 2 here), in view of the second criterion above.

According to a report by NCC Group, citing other sources, the actual security level is probably between 117 and 120 bits (see pages 8 and 9). They regard this as a perfectly adequate level of security: "The value of reaching '128-bit' [being] mostly psychological". Sean Bowe has also commented on the security level in the light of the original design goals. The draft IETF specification for BLS12-381 is less pessimistic than the NCC Group, and cites a security level of 126 bits.

Cofactor

A subgroup's cofactor is the ratio of the size of the whole group to the size of the subgroup. Normal elliptic curve cryptography requires the cofactor to be very small, usually one, in order to avoid small subgroup attacks on discrete logarithms. In pairing-based cryptography, however, this is not the case, and the cofactors of the G1G_1 and G2G_2 groups can be truly enormous.

It turns out that, with care, we can have large cofactors and still be secure. Namely, when the cofactors of G1G_1, G2G_2 and GTG_T contain no prime factors smaller than rr. Section 3.2 of this paper discusses this in detail. This is not the case for BLS12-381, however, and the G1G_1 and G2G_2 cofactors both have several small factors. Thus, we have to be mindful of small subgroup attacks in our implementations.

I've listed the prime factors of the curve orders in the reference section, as well as the cofactors themselves. The G1G_1 cofactor contains small prime factors like 3, 11, and 10177; the G2G_2 cofactor contains small prime factors like 13, 23, and 2713.

It's not all bad news when it comes to the cofactors, though. It turns out that multiplying by the group's cofactor is a straightforward way to map any arbitrary point on the elliptic curve into the respective subgroup, G1G_1 or G2G_220. This is important when doing "hash to curve" operations and the like: we first make a point on the curve, and then we map it into the appropriate group by multiplying by the cofactor, so-called cofactor clearing.

Roots of unity

Just a note on roots of unity, because they appear in two completely different and unrelated contexts, which can be confusing.

First, we said that to support ZK-SNARK schemes with this curve, for some biggish nn we want to have a 2n2^nth root of unity in the field FrF_r (not FqF_q, note). This is to facilitate efficient fast Fourier transforms for manipulating very large polynomials over the scalar field FrF_r. From the hexadecimal representation of r1r-1, it's clearly a multiple of 2322^{32}, so there is a 2322^{32}th root of unity (2322^{32} of them, in fact).

Second, and completely unrelated, the effect of the pairing is to map the two points from G1G_1 and G2G_2 onto an rrth root of unity in Fq12F_{q^{12}}. These rrth roots of unity actually form a subgroup in Fq12F_{q^{12}} of order rr21, which is the group we call GTG_T.

Let's briefly revisit our discussion of extending the base field for EE to Fq12F_{q^{12}}, which we did in order to find another subgroup of order rr. It also turns out Fq12F_{q^{12}} treated as a multiplicative group is the smallest field extension that contains the rrth roots of unity in the field, the 12 coming from the embedding degree once again. This is why GTG_T is defined over Fq12F_{q^{12}}.

Using curve BLS12-381

This section is a miscellany of things relevant to using BLS12-381 in practice.

BLS digital signatures

Now it's time to introduce the other BLS: Boneh, Lynn and Shacham. (The L is the same L as in BLS12-381; the B and the S are different.)

BLS signatures were introduced back in 2001, a little before the BLS curve family was published in 2002. Pleasingly, they go hand-in-hand. (BLS signatures can use other curves; BLS curves have uses other than signatures. But it's nice when they come together.)

The BLS signature scheme is described briefly below. See the BLS Signatures chapter for a fuller exploration of how we have implemented them in Ethereum 2. You can find a pretty concise but lucid description of the BLS signature scheme in the draft IETF standard.

Private and public keys

The private/secret key (to be used for signing) is just a randomly chosen number between 11 and r1r-1 inclusive. We'll call it sksk.

The corresponding public key (if we're using G1G_1 for public keys) is pk=[sk]g1pk = [sk]g_1, where g1g_1 is the chosen generator of G1G_1. That is, g1g_1 multiplied by sksk, which is g1g_1 added to itself sksk times.

The discrete logarithm problem means that it is unfeasible to recover sksk given the public key pkpk.

Signing

To sign a message mm we first need to map mm onto a point in group G2G_2 (if we're using G2G_2 for signatures). See hashing to the curve, below, for a discussion on ways to do this. Anyway, let's assume we can do this, and call the resulting G2G_2 point H(m)H(m).

We sign the message by calculating the signature σ=[sk]H(m)\sigma = [sk]H(m). That is, by multiplying the hash point by our secret key.

Verification

Given a message mm, a signature σ\sigma, and a public key pkpk, we want to verify that it was signed with the sksk corresponding to pkpk.

This is where pairing comes in. The signature is valid if, and only if, e(g1,σ)=e(pk,H(m))e(g_1,\sigma) = e(pk,H(m)).

We can confirm this using the properties of pairings: e(pk,H(m))=e([sk]g1,H(m))=e(g1,H(m))(sk)=e(g1,[sk]H(m))=e(g1,σ){e(pk,H(m))} = {e([sk]g_1,H(m))} = {e(g_1,H(m))^{(sk)}} = {e(g_1,[sk]H(m))} = {e(g_1,\sigma)}.

Aggregation

A really neat property of BLS signatures is that they can be aggregated (see also the original paper), so that we need only two pairings to verify a single message signed by nn parties, or n+1n+1 pairings to verify nn different messages signed by nn parties, rather than 2n2n pairings you might naively expect to need. Pairings are expensive to compute, so this is very attractive.

It's possible to aggregate signatures over different messages, or signatures over the same message. In the case of Ethereum 2.0 we aggregate over the same message, so for brevity I'm just going to consider that.

To aggregate signatures we just have to add up the G2G_2 points they correspond to: σagg=σ1+σ2++σn\sigma_{agg} = \sigma_1+\sigma_2+\cdots+\sigma_n. We also aggregate the corresponding G1G_1 public key points pkagg=pk1+pk2++pknpk_{agg} = pk_1+pk_2+\cdots+pk_n.

Now the magic of pairings means that we can just verify that e(g1,σagg)=e(pkagg,H(m))e(g_1,\sigma_{agg}) = e(pk_{agg},H(m)) to verify all the signatures together with just two pairings.

Swapping G1 and G2

For many purposes, the G1G_1 and G2G_2 groups are interchangeable. For example, with the BLS signature scheme, we can choose our public keys to be members of G1G_1 and our signatures to be members of G2G_2, or we can do it the other way round - the pairing function doesn't care; everything still works if we swap the groups over.

The trade-offs are execution speed and storage size. G1G_1 has small points and is fast; G2G_2 has large points and is slow. BLS12-381 was initially designed to implement Zcash, and for performance reasons they chose to use G1G_1 to represent signatures and G2G_2 to represent public keys.

With respect to Zcash, most other implementations are "reversed". In Ethereum 2.0 we use G1G_1 for public keys: for one thing, aggregation of public keys happens much more often than aggregation of signatures; for another, public keys of validators need to be stored in state, so keeping the representation small is important. Signatures, then, are G2G_2 points.

Point compression

(Note that sometimes, the twisting operation is referred to as point compression - that's something completely different to what we're discussing here.)

For storing and transmitting elliptic curve points, it is common to drop the yy-coordinate. This halves the amount of data. For BLS12-381, G1G_1 points are reduced from 96 bytes (2 × 381 bits-rounded-to-bytes) to 48 bytes, and G2G_2 points are reduced from 192 bytes to 96 bytes.

Any elliptic curve point can be regenerated from the xx coordinate by using the relevant curve equation, EE or EE'. For any valid xx coordinate on the curve, yy is either zero or has two possible values that are the negative of each other: y=±x3+4y=\pm\sqrt{x^3+4} for G1G_1, and analogously for G2G_2.

Since field elements are 381 bits, and 48 bytes is 384 bits, we have some bits to spare for flags. The most important is a flag to show which of the yy values the point corresponds to (positive or negative). Another bit is used to signal whether this is the point at infinity (which has many possible representations). A third is simply to indicate whether this is a compressed or uncompressed representation, though context should handle this in practice.

For both G1G_1 and G2G_2, about half of xx values are not on the curve. In this case, the point is conventionally decoded to the point at infinity. But unless the infinity flag is set – in which case we would not have attempted to decode the point – this is an error condition.

The specific details of how the flag bits and xx values are encoded is here.

Subgroup membership checks

When dealing with any point with an unknown origin, whether it comes to us compressed or uncompressed, it's important that we check that it lies in the correct subgroup. The point decompression described above only results in a point on the curve; we don't know whether it lies in the appropriate G1G_1 or G2G_2.

The main issue seems to be that both E(Fq)E(F_{q}) and E(Fq2)E'(F_{q^2}) contain small subgroups (you can see this by factoring the cofactors22 - see the reference section for the actual factors). Inadvertently working with points in these small subgroups could lead to vulnerabilities, as discussed in this paper.

Subgroup checks are easy in principle: simply multiply our point by rr. For points in G1G_1 or G2G_2 this will result in the respective points at infinity; for points outside the groups, it won't.

Unfortunately, this is slow in practice, especially for G2G_2, since rr is so large. As an alternative, there are new techniques making use of endomorphisms for performing faster subgroup checks.

Generators

G1G_1 and G2G_2 are cyclic groups of prime order, so any point (except the identity/point at infinity) is a generator. Thus, picking generators is just a matter of convention.

Generator points for G1G_1 and G2G_2 are specified in decimal here and the same points in hexadecimal here.

These were chosen as follows:

The generators of G1G_1 and G2G_2 are computed by finding the lexicographically smallest valid x-coordinate, and its lexicographically smallest y-coordinate and scaling it by the cofactor such that the result is not the point at infinity.

By my calculations, with h1h_1 and h2h_2 the respective group cofactors, this makes the G1G_1 generator g1=[h1]p1g_1=[h_1]p_1, with p1p_1 as follows,

  • p1=p_1 = (0x04, 0x0a989badd40d6212b33cffc3f3763e9bc760f988c9926b26da9dd85e928483446346b8ed00e1de5d5ea93e354abe706c)

and the G2G_2 generator g2=[h2]p2g_2=[h_2]p_2, with p2p_2 as follows,

  • p2=p_2 = ([0x02, 0x00],[0x013a59858b6809fca4d9a3b6539246a70051a3c88899964a42bc9a69cf9acdd9dd387cfa9086b894185b9a46a402be73,0x02d27e0ec3356299a346a09ad7dc4ef68a483c3aed53f9139d2f929a3eecebf72082e5e58c6da24ee32e03040c406d4f])

(I think "lexicographically smallest" means treating all numbers in the base field as non-negative, and just taking the smaller one, prioritising real parts over imaginary parts.)

Final exponentiation

Calculation of a pairing has two parts: the Miller loop and the final exponentiation. Both parts are quite expensive, but there's a nice hack you can do to reduce the impact of the final exponentiation.

Normally, we calculate two full pairings in order to perform signature verification, to check whether e(g1,σ)=e(pk,H(m))e(g_1,\sigma)=e(pk,H(m)).

If we denote as e(,)e'(\cdot,\cdot) the pairing without the final exponentiation, then for, some xx, we are checking whether e(g1,σ)x=e(pk,H(m))xe'(g_1,\sigma)^x=e'(pk,H(m))^x. (xx happens to be (q121)/r(q^{12} − 1)/r, which is huge23.)

We know how to multiply in group GTG_T, so we can reorganise this as a check whether (e(g1,σ)e(pk,H(m)))x=1(e'(-g_1,\sigma)e'(pk,H(m)))^x=1. (We can negate any one of the points: the magic of pairings makes this equivalent to taking the inverse in GTG_T.)

So, to verify a signature, we do the two Miller loops, one with a negated input value, multiply the results and then do a single final exponentiation. If the result is unity in GTG_T then our pairings match. This ought to give a worthwhile speedup.

Hashing to the curve

To calculate a digital signature over a message, we first need to transform an arbitrary message (byte string) to a point on the G2G_2 curve (if we are using G2G_2 for signatures). There are many ways to do this, with varying degrees of efficiency and security.

Hash and check

The initial implementation in Eth2 was "hash-and-check". This is very simple.

  1. Hash your message to an integer modulo qq.
  2. Check if there is a point on the curve with this xx-coordinate (real part xx, imaginary part 00). If not, add one to xx and repeat this step.
  3. We have a point on the curve! Multiply by the G2G_2 cofactor to convert it into a point in G2G_2 (cofactor clearing).

About half the points that we try will result in a point on the curve, so this is not constant time: we don't know how many iterations it will take to find one. In one sense it doesn't matter: all the information is public, so we're not leaking anything. However, it does open up a griefing attack. An attacker could pre-calculate messages that take a very long time to find a point (1 in one million messages will take 20 tries, for example) and slow us down considerably.

Simplified SWU map

We have now adopted a better approach which is described in this paper and defined in RFC 9380, the IETF standard for hashing to curves. As before (but a bit differently to ensure a uniform distribution of output points) we first create a field point by hashing the message mod qq (the "expand message" step).

Next we use a special map (the SWU map) that is guaranteed to translate that field point into a valid point on an elliptic curve. For technical reasons, this is not the curve E(Fq2)E'(F_{q^2}), but a curve isogenous to it (i.e. having the same number of points). We then use another map (3-isogeny) to transfer this to a point on E(Fq2)E'(F_{q^2}). Finally we use cofactor clearing to end up with a point in G2G_2.

You can take a look at my implementation of this in Java , based on the reference code in Python. The idea is for this approach to be generally adopted to enhance the interoperability of blockchains.

Cofactor clearing

We discussed multiplying by the cofactor as a way to make an arbitrary point on EE or EE' into a point in G1G_1 or G2G_2 respectively. This is useful when hashing to the curve, for example.

The G2G_2 co-factor is huge, so multiplying by it is slow. However, there are faster ways to map curve points into G2G_2 using an endomorphism (a map of a group to itself). This features in the RFC 9380 standard.

The endomorphism we use was until recently subject to a patent, but, as of 2020, this patent has expired everywhere.

As a workaround to the patent before it expired, instead of multiplying by the G2G_2 cofactor, the standard suggests multiplying by an effective cofactor, heffh_{eff} (see section 8.8.2 of RFC 9380 for the value), which gives the same result as the endomorphism. The effective cofactor is even larger than the G2G_2 cofactor, but the multiplication can be implemented using an addition chain as an optimisation.

Now that the patent has expired, the endomorphism can be just dropped in as a replacement for the effective cofactor multiplication.

Extension towers

Recall our discussion of field extensions? In practice, rather than implementing a massive 12th-degree extension directly, it is more efficient to build it up from smaller extensions: a tower of extensions.

For BLS12-381, the Fq12F_{q^{12}} field is implemented as a quadratic (degree two) extension, on top of a cubic (degree three) extension, on top of a quadratic extension of FqF_q.

As long as the modular reduction polynomial (our reduction rule) is irreducible (can't be factored) in the field being extended at each stage, then this all works out fine.

Specifically:

  1. Fq2F_{q^2} is constructed as Fq(u)/(u2β)F_q(u) / (u^2 - \beta) where β=1\beta = -1.
  2. Fq6F_{q^6} is constructed as Fq2(v)/(v3ξ)F_{q^2}(v) / (v^3 - \xi) where ξ=u+1\xi = u + 1.
  3. Fq12F_{q^{12}} is constructed as Fq6(w)/(w2γ)F_{q^6}(w) / (w^2 - \gamma) where γ=v\gamma = v

Interpreting these in terms of our previous explanation:

  1. We write elements of the Fq2F_{q^2} field as first degree polynomials in uu, with coefficients from FqF_q, and apply the reduction rule u2+1=0u^2 + 1 = 0, which is irreducible in FqF_q.
    • an element of Fq2F_{q^2} looks like a0+a1ua_0 + a_1u where ajFqa_j \in F_q.
  2. We write elements of the Fq6F_{q^6} field as second degree polynomials in vv, with coefficients from the Fq2F_{q^2} field we just constructed, and apply the reduction rule v3(u+1)=0v^3 - (u + 1) = 0, which is irreducible in Fq2F_{q^2}.
    • an element of Fq6F_{q^6} looks like b0+b1v+b2v2b_0 + b_1v + b_2v^2 where bjFq2b_j \in F_{q^2}.
  3. We write elements of the Fq12F_{q^{12}} field as first degree polynomials in ww, with coefficients from the Fq6F_{q^6} field we just constructed, and apply the reduction rule w2v=0w^2 - v = 0, which is irreducible in Fq6F_{q^6}.
    • an element of Fq12F_{q^{12}} looks like c0+c1wc_0 + c_1w where cjFq6c_j \in F_{q^6}.

This towered extension can replace the direct extension as a basis for pairings, and when well-implemented can save a huge amount of arithmetic when multiplying Fq12F_{q^{12}} points. See Pairings for Beginners section 7.3 for a full discussion of the advantages.

Coordinate systems

Finding the inverse of a field element (i.e. division) is an expensive operation, so implementations of elliptic curve arithmetic try to avoid it as much as possible. It helps if we choose the right coordinate system for representing our points.

Affine coordinates

Affine coordinates are the traditional representation of points with just an (x,y)(x,y) pair of coordinates, where xx and yy satisfy the curve equation. This is what we normally use when storing and transmitting points.

However, it is not always the most efficient form to use when actually working with points, and there are two other schemes I'm aware of that are used for BLS12-381.

The basic idea is to represent the coordinate using notional fractions, reducing the number of actual division operations needed. To do this, a third coordinate is introduced and we use (X,Y,Z)(X, Y, Z) for the internal representation of a point. Like our familiar fractions, there are many representations of the same value, all corresponding to a single actual value (12\frac{1}{2}, 36\frac{3}{6}, 197394\frac{197}{394} are all the same number).

The two systems I know of in use for BLS12-381 are Standard Projective coordinates and Jacobian coordinates.

Standard Projective coordinates

The Standard Projective coordinate point (X,Y,Z)(X, Y, Z) represents the Affine coordinate point (X/Z,Y/Z)(X/Z, Y/Z).

These are also called homogeneous projective coordinates because the curve equation takes on the homogeneous form Y2Z=X3+4Z3Y^2Z=X^3+4Z^3. Points become straight lines through the origin in (X,Y,Z)(X, Y, Z) space, with the Affine point being the intersection of the line with the plane Z=1Z=1. Figure 2.10 in Pairings for Beginners gives a nice illustration.

Standard Projective coordinates are used by the Apache Milagro BLS12-381 library, and also by the noble-curves implementation.

Jacobian coordinates

A different kind of projective coordinates are Jacobian coordinates. In this scheme, the Jacobian point (X,Y,Z)(X, Y, Z) represents the Affine point (X/Z2,Y/Z3)(X/Z^2, Y/Z^3). The curve equation becomes Y2=X3+4Z6Y^2=X^3+4Z^6.

The sample code for the constant-time hash-to-curve uses Jacobian coordinates, as does the gnark-crypto library.

Note that, in both schemes, the easiest way to import the Affine point (x,y)(x, y) is to map it to (x,y,1)(x, y, 1).

BLS12-381 Reference

General
Parameter EquationValueComments
Curve parameterx{\tt x} -0xd201000000010000
Field modulusqq13(x1)2(x4x2+1)+x\frac{1}{3}{({\tt x}-1)}^2\allowbreak {({\tt x}^4-{\tt x}^2+1)}\allowbreak +{\tt x}Hex: 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab
Dec: 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787
381 bits, prime
Subgroup size: G1\vert G_1\vert, G2\vert G_2\vert, GT\vert G_T\vertrr(x4x2+1){({\tt x}^4-{\tt x}^2+1)}Hex: 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001
Dec: 52435875175126190479447740508185965837690552500527637822603658699938581184513
255 bits, prime
Curve E(F_q)
Equationy2=x3+4y^2=x^3+4
Order E(Fq)\vert E(F_q)\vert0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb15400008c0000000000aaab
Order (decimal)4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129030796414117214202539
Prime Factorisation3 ×\times 112^2 ×\times 101772^2 ×\times 8592672^2 ×\times 524378992^2 ×\times rr

The product of the factors of the group order, excluding rr, are (by definition) the cofactor of the subgroup with order rr (G1G_1 in this case).

Observe that the number of points on curve EE, its order, E(Fq)|E(F_q)|, is (in some sense) very close to the field modulus, qq. This is a consequence of the Hasse bound.

Subgroup G_1
Orderrr
Generator(0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb,
0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1)
Cofactor0x396c8c005555e1568c00aaab0000aaab

The G1G_1 cofactor is the factorisation of the curve order, E(Fq)|E(F_q)|, excluding the rr term.

Curve E'(F_q^2)
Equationy2=x3+4(1+i)y^2=x^3+4(1+i)
Order E(Fq2)\vert E'(F_{q^2})\vert0x2a437a4b8c35fc74bd278eaa22f25e9e2dc90e50e7046b466e59e49349e8bd050a62cfd16ddca6ef53149330978ef0137697386bf984315744a2d5eb3dd4d213f2484c55b94474ab096de2c62640b2643116b1e2788e6a8b2a9fffe1c7238e5
Order (decimal)16019282247729705411943748644318972617695120099330552659862384536985976748491357143400656079302193429974954385540174732940659106207100323726025938325193045129788127168347624263893040187112659960846674086295148469572963088890738917
Prime Factorisation132^2 ×\times 232^2 ×\times 2713 ×\times 11953 ×\times 262069 ×\times 402096035359507321594726366720466575392706800671181159425656785868777272553337714697862511267018014931937703598282857976535744623203249 ×\times rr

The order of curve EE', E(Fq2)|E'(F_{q^2})|, is close to the square of the field modulus, q2q^2.

Subgroup G_2
Orderrr
Generator([0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8, 0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e],
[0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801, 0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be])
Cofactor0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5

The G2G_2 cofactor is the factorisation of the curve order, E(Fq2)|E'(F_{q^2})|, excluding the rr term.

Resources and further reading

There are lots of references linked in the above, and I'm not going to repeat many here. I'll just pick out a few particularly useful or interesting things.

Useful reference material:

In general, implementations of pairing libraries tend to be highly optimised and/or very generic (supporting many curves) which makes them quite hard to learn from. The Noble BLS12-381 library in JavaScript/TypeScript by Paul Miller is among the easier to follow.

The blsh REPL (a wrapper around the BLST library) is excellent for exploring the curve itself. See the grammar for the full functionality - the info command alone is worth it. You can manually verify BLS signatures if you like.

Finally, a couple of random but fun and interesting reads:

  • This white paper on Curve9769 is not directly relevant to BLS12-381, but is a well-written and wonderful exploration of the joys and pains of designing and implementing an elliptic curve (not a pairing-friendly one in this case).
  • Pairings are not dead, just resting. A great overview presentation. Some BLS12-381 things.

Footnotes

  1. While I did study mathematics many, many years ago, I diligently shirked anything, such as group theory, that smelt like pure maths. I regret this now.

  2. Do click through to the short clip of Dan Boneh explaining why all mathematicians should spend time in jail.

  3. Compact Multi-Signatures for Smaller Blockchains, Boneh, Drijvers, and Neven, 2018.

  4. That Ethereum's execution layer uses the almost, but not quite standard Keccak hash rather than the SHA-3 standard remains a burr in the underpants to this day.

  5. This document does not have the full force of an IETF standard. For one thing, it remains a draft (that is now expired), for another it is an IRTF document, meaning that it is from a research group rather than being on the IETF standards track. Some context from Brian Carpenter, former IETF chair,

    I gather that you are referring to an issue in draft-irtf-cfrg-bls-signature-04. That is not even an IETF draft; it's an IRTF draft, apparently being discussed in an IRTF Research Group. So it is not even remotely under consideration to become an IETF standard...

  6. This now deleted page is the reference for much of this section. Lots of curve data is also in the IETF specification.

  7. Our rule is "an extension field modular reduction" (terminology from here, section 4.4). We can think of it as analogous to the modulo operation in normal arithmetic: it keeps the degree of polynomials to within a given bound, just as the modulo operation keeps the size of numbers to within a given bound. The irreducibility requirement is akin to the polynomial being "prime", that is, having no non-trivial factors.

  8. Another point on E(Fq)E(F_q) is (0x04,0x0a989badd40d6212b33cffc3f3763e9bc760f988c9926b26da9dd85e928483446346b8ed00e1de5d5ea93e354abe706c). On average about half of xx values result in a point on the curve, and for most of those both (x,y)(x,y) and (x,y)(x,-y) are on the curve (for some, y=0y=0). You soon get used to these ridiculously big numbers.

  9. Sometimes uu is used rather than ii here, with u2+1=0u^2+1=0. I'm using ii.

  10. Here's a point on the EE' curve: (1+i, 0x17faa6201231304f270b858dad9462089f2a5b83388e4b10773abc1eef6d193b9fce4e8ea2d9d28e3c3a315aa7de14ca + i * 0xcc12449be6ac4e7f367e7242250427c4fb4c39325d3164ad397c1837a90f0ea1a534757df374dd6569345eb41ed76e)

  11. See the Asymmetric Pairings paragraph in the introduction to Subgroup security in pairing-based cryptography for more on why we prefer distinct subgroups for G1G_1 and G2G_2. In short, asymmetric pairings are more secure and more efficient to compute than symmetric pairings, since the latter exist only on supersingular curves.

  12. Note that we lost the ' on EE here - this is the original curve y2=x3+4y^2=x^3+4, but now defined over FqkF_{q^k}.

  13. Basically, the trace of a point is i=0k1(xqi,yqi)\sum_{i=0}^{k-1}(x^{q^i},y^{q^i}), where k=12 in our case. Understanding this involves stuff like the Frobenius endomorphism, and that rabbit hole goes deep.

  14. Because we previously selected the trace zero subgroup. Pairings for Beginners dives into the details on this.

  15. This doesn't seem to be documented anywhere, but I got here by attempting to decode section 3 of Pairing-Friendly Elliptic Curves of Prime Order by Barreto and Naehrig.

  16. My thanks to Olivier Bégassat for this insight.

  17. Cue my usual rant about why it is still called discrete logarithm rather than discrete division in additively written groups.

  18. It is natural to write elliptic curve groups (like G1G_1 and G2G_2) additively due to the way that elliptic curve point addition is constructed geometrically. GTG_T is not an elliptic curve group, but rather a finite field subgroup, in which multiplication is the more intuitive group operation.

  19. Numbers in this world are truly enormous. The number of times rr divides (q121)(q^{12}-1) is 1299 digits long in decimal. This number is actually used in the final exponentiation when computing pairings (a multiplicative version of cofactor clearing).

  20. This is easy to see. The subgroup GG has order rr, and its cofactor is hh, such that hr=nhr = n, the order of the whole elliptic curve group. Consider an arbitrary element PP of the elliptic curve group. We have O=[n]P=[r]([h]P)\mathcal{O} = [n]P = [r] ([h]P). Thus, [h]PG[h]P\in G. Alternatively, for every subgroup that is not GG, hh is a multiple of its order, so multiplying by hh "kills" all components of PP that are not in GG. While not specific to BLS12-381, here is an excellent article about cofactor clearing.

  21. This is a general property of roots of unity in multiplicative groups, not special to elliptic curves or pairings. For example, the set of fourth roots of unity in Fq2F_{q^2}, {1,i,1,i}\{1, -i, -1, i\}, forms a group of order four under multiplication.

  22. A couple of online tools for factoring huge numbers are dCode, and Dario Alpern's tool)

  23. (q121)/r(q^{12} − 1)/r is actually the cofactor of the GTG_T group in Fq12F^*_{q^{12}}. Performing the exponentiation maps the element produced by the Miller loop into GTG_T, the group of rrth roots of unity. When we account for the notational difference between additive and multiplicative groups, this is analogous to cofactor clearing for G1G_1 and G2G_2 discussed elsewhere in this section.

Created by Ben Edgington. Licensed under CC BY-SA 4.0. Published 2025-07-12 08:05 UTC. Commit 6517e04.