Skip to content
Numerology: Optimized ECC arithmetic library for secp256k1 in Solidity
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
contracts
migrations
test
.gitignore
README.md
truffle-init.json
truffle.js

README.md

Numerology

Optimized ECC arithmetic library for secp256k1 in Solidity

WARNING: Don't use it with any private input (e.g., a private key), as it's going to be exposed. Don't ever use this to sign something! Also, this is experimental -- Use at your own risk!

Numerology is a Solidity library for elliptic curve arithmetic on secp256k1. Its original goal is to support NuCypher smart contracts for Re-Encryption Verification of Umbral ciphertexts, which is done by means of Non-Interactive Zero Knowledge Proofs of Knowledge. In particular, Numerology provides optimized ECC algorithms useful for verifying Schnorr-like NIZKs. These algorithms are honed to spend as little gas as possible. For this reason, and also to bypass some EVM and Solidity limitations, the code can be ugly as hell sometimes (sorry for that!).

It's initially based on the ECCMath library, although it's completely rewritten.

Features:

  • Point addition and doubling in Jacobian coordinates with optimized formulas.
  • Simultaneous scalar multiplication with several optimizations (interleaving, WNAF representation, curve endomorphism).
  • Verifying an equation of the form aP + bQ = R takes approximately 500,000 gas.
You can’t perform that action at this time.