Zero-dependency Secp256k1 library in pure Rust

Hey everyone,

I've been building cnfy — a suite of pure Rust libraries for Bitcoin cryptography with zero third-party dependencies. Everything from U256 arithmetic to secp256k1 is implemented from scratch.

A few key decisions I'd love feedback on:

  • No unsafe, no heap allocations — everything stack-based
  • Constant-time execution behind feature flags rather than on by default
  • One method per file with co-located tests (struct-per-directory pattern)

The codebase: https://codeberg.org/cnfy/cnfy-lib
Published crates: cnfy, cnfy-uint, cnfy-secp256k1

Still pre-1.0. Interested in feedback on the API design, the architecture, or anything that looks
off. Crypto review especially welcome.

Thanks!

These are the results for variable-time scalar-to-public-key multiplication on Apple M4.

And constant-time execution on Apple M2:

Full M2 results are listed here.

Would anyone be willing to run this on an x86 machine? I'd love to see how it compares on a non-ARM processor.

// Variable-time
cargo bench -p cnfy-bench --bench secp256k1 -- scalar_mul

// Constant-time
cargo bench -p cnfy-bench --bench secp256k1 --features ct-scalar -- scalar_mul

Full instructions:

Thanks!