Skip to content

secp256k1 elliptic curve cryptography in pure Solidity for on- and offchain operations

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

verklegarden/crysol

Repository files navigation

crysol

Tests Apache2/MIT licensed

crysol is a $secp256k1$ elliptic curve library for EVM applications. It targets security, correctness, simplicity, readability, and reviewability as its primary goals.

Features:

  • Key generation, verification and de/serialization
  • ECDSA and Schnorr signature generation, verification and de/serialization
  • Point arithmetic based on complete addition formulas and ecrecover precompile optimizations
  • Prime field arithmetic
  • Secure, simple and stable interfaces

For usage examples, see examples/.

Libraries

src
├─ Secp256k1 - "Secp256k1 cryptography library"
├─ arithmetic
│  ├─ Points "Secp256k1 point arithmetic library"
│  └─ Fp"Secp256k1 prime field arithmetic library"
└─ signatures
   ├─ ECDSA"ECDSA signature library"
   └─ Schnorr"Schnorr signature library"

offchain
├─ RandomOffchain - "Access to cryptographically secure randomness"
├─ Secp256k1Offchain - "Offchain secp256k1 cryptography library"
└─ signatures
   ├─ ECDSAOffchain"Offchain ECDSA signature library"
   └─ SchnorrOffchain"Offchain Schnorr signature library"

unsafe
└─ signatures
   └─ ECDSAUnsafe"Library for unsafe ECDSA signature operations"

Installation

Install with Foundry:

$ forge install verklegarden/crysol

Contributing

The project uses the Foundry toolchain. You can find installation instructions here.

Setup:

$ git clone https://github.com/verklegarden/crysol
$ cd crysol/
$ forge install

Note that the Makefile provides commands for common development operations:

$ make help
>
>  ██████ ██████  ██    ██ ███████  ██████  ██
> ██      ██   ██  ██  ██  ██      ██    ██ ██
> ██      ██████    ████   ███████ ██    ██ ██
> ██      ██   ██    ██         ██ ██    ██ ██
>  ██████ ██   ██    ██    ███████  ██████  ███████
>
> build                                              Build project
> clean                                              Clean build artifacts
> coverage                                           Update coverage report and print summary
> examples                                           Run examples
> fmt                                                Format project
> help                                               Print list of all commands
> test-intense                                       Run full test suite with intense fuzzing
> test-summary                                       Print summary of test suite
> test                                               Run full test suite
> todos                                              Grep TODO's in src/ and test/

Safety

This is experimental software and is provided on an "as is" and "as available" basis.

We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

secp256k1 elliptic curve cryptography in pure Solidity for on- and offchain operations

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •