MinaFoundation / ecosystem-ideas

Get inspired to build on MinaProtocol.
MIT License
1 stars 0 forks source link

Abstract gadgets/primitives #15

Open hgedia opened 1 month ago

hgedia commented 1 month ago

Summary

o1js is written in TypeScript and includes many primitives for building elliptic curve (EC) and hash function implementations, it's feasible to develop extensive gadgets similar to those in noble-hashes or noble-curves. Leveraging abstract classes would allow for easy maintenance and the addition of various cryptographic primitives.

For example, Merkle-Damgard construction here is used to later build sha256 and sha512 by setting different constants and sizes.

Foreign curve primitives in o1js support the weierstrass curves and is possible to instantiate any curve as long as it complies with the form can be used as an example to understand how to build re-usable primitives.