<feed xmlns='http://www.w3.org/2005/Atom'>
<title>plonkers, branch feat/projective-coordinates</title>
<subtitle>PLONK from scratch</subtitle>
<id>http://src.lordello.net/plonkers/atom/?h=feat/projective-coordinates</id>
<link rel='self' href='http://src.lordello.net/plonkers/atom/?h=feat/projective-coordinates'/>
<link rel='alternate' type='text/html' href='http://src.lordello.net/plonkers/'/>
<updated>2025-08-01T14:03:13Z</updated>
<entry>
<title>Use Projective Coordinates</title>
<updated>2025-08-01T14:03:13Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2025-08-01T11:42:15Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/plonkers/commit/?id=e77561ac7f94668039adf9db57f0c6f9248eeb16'/>
<id>urn:sha1:e77561ac7f94668039adf9db57f0c6f9248eeb16</id>
<content type='text'>
I modified the curve implementation to use projective coordinates, but
there wasn't a material speedup of the BLS12-381 pairing implementation.
I suspect it is related to the fact that I am not implementing the
Miller Loop in a way that takes advantage of the coordinate projection,
which makes things take more time in the end.
</content>
</entry>
<entry>
<title>Batched Pairing Computation</title>
<updated>2025-08-01T12:49:14Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2025-08-01T12:49:14Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/plonkers/commit/?id=89f936fff830cd245d47fb5fb6e109c56216c7af'/>
<id>urn:sha1:89f936fff830cd245d47fb5fb6e109c56216c7af</id>
<content type='text'>
We batch pairing computations for efficient checking. This allows to
more efficiently implement things like BLS signatures (where we check
that some pairing dot another is equal to 1). This is because the
exponentiation in Fp12 is a _huge_ computational effort (and what takes
the most time in the pairing computation).

It looks like `@noble/curves` implements a pairing to another `Gt` that
is much more efficient to compute (as we do not need to untwist
coordinates at all, meaning no field inversion, and no computations in
Fp12), but I will hold off on implementing this until there is an actual
need for it (in case the current pairing implementation is too slow).
</content>
</entry>
<entry>
<title>Add Generator Test</title>
<updated>2025-08-01T10:08:24Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2025-08-01T09:41:26Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/plonkers/commit/?id=08c921a5ca703233185e9021d8cc50b620d08a39'/>
<id>urn:sha1:08c921a5ca703233185e9021d8cc50b620d08a39</id>
<content type='text'>
We use the `py_ecc` generator, and the generator test now passes as
expected. Note that we still haven't gotten to the bottom of why
`py_ecc` and `@noble/curves` have different `Gt` groups.
</content>
</entry>
<entry>
<title>Pairings With `py_ecc` Implementation</title>
<updated>2025-08-01T09:36:01Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2025-08-01T09:33:20Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/plonkers/commit/?id=b7f0c124574603619d10892f509558679aa59ddb'/>
<id>urn:sha1:b7f0c124574603619d10892f509558679aa59ddb</id>
<content type='text'>
We now have pairings working with the `py_ecc` implementation, but it
looks like different pairing implementations (such as `@noble/curves`)
map to different `Gt` groups.

I don't think it matters much (as long as we map to _some_ valid
group `GT`, and have bilinear properties), but I want to understand
_why_ this is the case.
</content>
</entry>
<entry>
<title>Refactor Curve Into Functor</title>
<updated>2025-07-30T07:01:58Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2025-07-30T07:01:58Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/plonkers/commit/?id=395fa4a06d5c4ac90f65838137728ed569bc4f90'/>
<id>urn:sha1:395fa4a06d5c4ac90f65838137728ed569bc4f90</id>
<content type='text'>
Curves can now be generically instantiated with a functor, depending
on its parameterization (underlying field, Weirstrass `b` value,
generator point and order).

This makes things very nice! We also now define `E12` explicitely,
with a test that `twist E2.g = E12.g`.
</content>
</entry>
<entry>
<title>Refactor Fields to be Functor Based</title>
<updated>2025-07-29T20:54:38Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2025-07-29T20:54:38Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/plonkers/commit/?id=c2f1680b6718a01c128fbb83ba3c50b70c3c5d7c'/>
<id>urn:sha1:c2f1680b6718a01c128fbb83ba3c50b70c3c5d7c</id>
<content type='text'>
Prime fields and polynomial extension fields are now functor based.
That is, you define field parameters and a functor will produce a
field module.

This is the first step to moving all BLS12-381 pairing definitions to
a single module, instead of splitting them. This makes the "this is
the curve and its pairing" very central, with the field and curve
modules being generic over their respective parameterization.

Added field exponentiation - and found out that Zarith supports
negative exponents, and `powm x ~-1 p` is a much more efficient way of
computing a field inverse (tests run ~5 times quicker).
</content>
</entry>
<entry>
<title>Prepare for Codeberg</title>
<updated>2025-07-29T06:46:40Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2025-07-29T06:46:40Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/plonkers/commit/?id=771605c6264289210a097dd5bbabbd709f549205'/>
<id>urn:sha1:771605c6264289210a097dd5bbabbd709f549205</id>
<content type='text'>
Add license, and fix dune project.
</content>
</entry>
<entry>
<title>Add Journal Entry for Pairings</title>
<updated>2025-07-28T18:47:01Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2025-07-28T18:45:43Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/plonkers/commit/?id=75c18079fcaa6297128b07ec2590c4aa8f753660'/>
<id>urn:sha1:75c18079fcaa6297128b07ec2590c4aa8f753660</id>
<content type='text'>
Explaining the motivation for them, and how they are magic.
</content>
</entry>
<entry>
<title>Compute `w^2` and `w^3` Only Once</title>
<updated>2025-07-28T15:30:48Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2025-07-28T15:30:48Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/plonkers/commit/?id=6bec1cc17d705c5468a53f63a84d247d1bf03232'/>
<id>urn:sha1:6bec1cc17d705c5468a53f63a84d247d1bf03232</id>
<content type='text'>
When twisting from E2 to E12, we need to compute `w` coefficients for
the twisted coordinates. We now compute this only once, and resuse the
value on every `twist` call.
</content>
</entry>
<entry>
<title>Pairing Tests and Refactor</title>
<updated>2025-07-28T10:35:51Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2025-07-28T10:35:51Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/plonkers/commit/?id=96c1a864a7c3cdd5006cef5ae8e30cdca61d303a'/>
<id>urn:sha1:96c1a864a7c3cdd5006cef5ae8e30cdca61d303a</id>
<content type='text'>
We refactored the extension field types to use an array for
coefficients instead of a tuple. Tests were modified to only have
string literals for numerical literals (istead of previously encoding
a whole `Fp12` in a single string for example). As a result, we get
better formatting and more line breaks instead of super dense and long
lines. Unfortunately, this makes a very big PR instead. The pairing
development will continue in the next one to not overgrow this too much.
</content>
</entry>
</feed>
