HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
mratsim
constantine
Nim2020–2026
mratsim / constantine

constantine

Constantine: modular, high-performance, zero-dependency cryptography stack for verifiable computation, proof systems and blockchain protocols.

6Distinct people
18Mentions
0Explicit recommenders
502GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Constantine: modular, high-performance, zero-dependency cryptography stack for verifiable computation, proof systems and blockchain protocols.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year18 dated mentions

Observed mentions: 2020-04-22 15:55:41 UTC to 2026-05-26 15:31:04 UTC.

02462020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments20232024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 6 mentions; 1 submissions, 5 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC505
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC202
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC000
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC413
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC615
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC000
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC101

What Hacker News says

18 sources
You can see all the details at: https://github.com/mratsim/constantine , but to answer your "how" question briefly here, something Nim shares with most (all?) "systems programming languages" is "easy" integration with assembly languages -- whatever the backend for "most" compiled code is (whatever that "most" even is - weighted by any number of measures of static source size or dynamic instruction counts). Of course, hand-rolled assembly can cost you a lot in portability/effort to port to new platforms/etc. The entire concept of the "performance of a PLang" in terms of the run-time of programs written "mostly in it" is rather seriously under-specified, TBH. This is (or should be) uncontentious in spite of the slew of articles with titles like the one for this thread.
In Performance of Rust Language [pdf]
BLS signatures are general purpose, the only Ethereum specific thing is choosing which elliptic curves are used for public keys and which for signatures as well as a prefix before hashing inputs. Similarly KZG polynomial commitments are generic, the Ethereum specific thing is the trusted setup ceremony which needs to be specialized per protocol. The finite field backends and the elliptic curves supported are all generic as well: https://github.com/mratsim/constantine/blob/master/constanti...
In Constantine: modular, high-performance, zero-dependency cryptography stack
Great question, first of all I did extensive research https://github.com/mratsim/constantine/wiki/Constant-time-ar.... Then the library defines its own types SecretBool and SecretWord throughough library that cannot be mixed with regular Nim types and are based on uint32/uint64 so the compiler cannot assume 0/1 and do boolean logic. Assembly is used to avoid compilers getting too smart and reintroducing branches but the no-assembly fallback should still compile without branches. By convention, all variable-time cryptographic functions are suffixed _vartime. There is a plan to add automated constant-time checks as well https://github.com/mratsim/constantine/issues/7.
In Constantine: modular, high-performance, zero-dependency cryptography stack
`when myCondition():` instead of `if myCondition:` is done at compile-time. Alternatively you can use a `static:` code block to force compile time evaluation. Or tag a function {.compileTime.} or tag function inputs with `static` modifier. It is possible to create a compiler or an assembler running fully in Nim macros as well: - https://github.com/mratsim/constantine/blob/master/constanti... (all that file runs at compile-time) You can also implement Continuation-Passing-Style transformation at compile-time: - https://github.com/nim-works/cps Or a neural network DSL or for a self-contained example, einsum: - https://github.com/mratsim/Arraymancer/blob/master/src/array... It's worth noting that nim async/await transformation is fully implemented as a library in macros.
In D Programming Language
I usually explain extension fields as similar to complex numbers with regards to reals. I've collected a lot of extension fields references while working on my own implementation: https://github.com/mratsim/constantine/tree/master/constanti... The best likely being - Arithmetic of Finite Fields Chapter 5 of Guide to Pairing-Based Cryptography Jean Luc Beuchat, Luis J. Dominguez Perez, Sylvain Duquesne, Nadia El Mrabet, Laura Fuentes-Castañeda, Francisco Rodríguez-Henríquez, 2017 https://www.researchgate.net/publication/319538235_Arithmeti...
In Elliptic Curve Cryptography Explained (2019)
> Syntax wise Nim it is a step back. It's hard to read and understand while any C/C++ dev will have next to no effort reading through D code. And of course while D is C ABI compliant it interoperates with C++ well too. On the other hand, people coming from Python, Ruby, Pascal, Ada will appreciate the minimal amount of sigils. > I seriously doubt that Nim or any other language in this regard has better metaprogramming than D. Can you write an Embedded DSL + compiler running at compile-time in D - https://github.com/numforge/laser/tree/master/laser/lux_comp... Can you write a cryptographic library with hex conversion to big integer and modular arithmetic running at compile-time in D? - https://github.com/mratsim/constantine/blob/master/constanti... Can you generate a state machine that lowers down to optimized computed gotos with no dynami
Read the rest
c allocation suitable for multithreading runtimes and embedded devices and able to display the actual graph at compiletime? - https://github.com/mratsim/Synthesis Can you describe x86 opcodes in a declarative way for a JIT assembler and do all the rex/modrm/sib computation at compile-time? - https://github.com/mratsim/photon-jit/blob/master/photon_jit... And the same thing for an emulator? - https://github.com/mratsim/glyph/blob/master/glyph/snes/opco... Can you implement async as a library? Can you emulate classes with ADTs to solve the expression problem, avoid cache misses and multithreading problem due to OOP and the double indirection due to the visitor pattern? - https://github.com/mratsim/trace-of-radiance/blob/master/tra... > Nim might have a speed overhead in certain tasks but that depends on a benchmark. Besides, does Nim have anything similar to NumPy which is actually faster? D does. It does: - https://github.com/mratsim/Arraymancer With CPU, OpenCL and Cuda backends (in differing state of maturity) and it's being used for data analysis for example ancestry prediction: - http://home.chpc.utah.edu/~u6000771/somalier-ancestry.html You can even run a neural network and see its training live: - https://github.com/Vindaar/NeuralNetworkLiveDemo AFAIK D doesn't have any plotting library while Nim has plot.ly integration and a ggplot2 port in pure Nim: - https://github.com/brentp/nim-plotly - https://github.com/Vindaar/ggplotnim And lastly nim can easily call Python: - https://github.com/yglukhov/nimpy or be called from Python: - https://github.com/Pebaz/nimporter
In Ray Tracing in Nim
OCaml, with D, are probably the languages that feel the most similar to Nim. Regarding Haskell, you can do category theory[1] if you want or do integer operations within the type system like dependently typed languages[2], including BigInt computation at compile-time[3]. Regarding speed, Haskell and OCaml are sometimes as fast as C, Nim is always as fast as C. [1]: https://github.com/unicredit/emmy#algebraic-structures [2]: https://github.com/mratsim/constantine/blob/0400187f/constan... [3]: https://github.com/mratsim/constantine/blob/0400187f/constan...
In NimConf 2020 Videos

Showing the 15 most recent of 18 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.