Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AmadiMichael/p256-verifier-huff
Hyper-Optimised Secp256r1/P256 Verifier Huff Implementation
https://github.com/AmadiMichael/p256-verifier-huff
Last synced: about 2 months ago
JSON representation
Hyper-Optimised Secp256r1/P256 Verifier Huff Implementation
- Host: GitHub
- URL: https://github.com/AmadiMichael/p256-verifier-huff
- Owner: AmadiMichael
- Created: 2023-10-16T22:59:01.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-22T08:35:09.000Z (about 1 year ago)
- Last Synced: 2024-11-09T01:41:41.309Z (about 2 months ago)
- Language: Solidity
- Homepage:
- Size: 331 KB
- Stars: 26
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-huff - Secp256r1/P256-Verifier-Huff
README
## P256 Curve Verifier Huff implementation
Secp256r1 (a.k.a p256) curve signature verifier rewritten and optimized in [Huff Language](https://huff.sh). This was greatly inspired by [dcposch's](https://github.com/dcposch) and [nalinbhardwaj's](https://github.com/nalinbhardwaj) implementation [here](https://github.com/daimo-eth/p256-verifier/blob/master/src/P256Verifier.sol) and [pcaversaccio's](https://github.com/pcaversaccio) Vyper implementation [here](https://github.com/pcaversaccio/p256-verifier-vyper/blob/main/src/P256Verifier.vy). Also, for more technical details, please refer to [EIP-7212](https://eips.ethereum.org/EIPS/eip-7212).
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 losses incurred through any use of this code base.
## Gas Benchmark
| Implementation | Min gas | Avg gas | Max gas | OnChain Address | Available Networks |
| ---------------------------- | ------- | ------- | ------- | ------------------------------------------ | ------------------------------------------ |
| FCL Solidity P256 Verifier | | | 227,000 | 0xE9399D1183a5cf9E14B120875A616b6E2bcB840a | Polygon(M), Sepolia, Base, OP, Linea |
| Huff P256 Verifier | 228,475 | 239,164 | 249,574 | 0x00000083Ea3aBb243c4acfDB095DB5aD5A606fc5 | Goerli, Sepolia, Base Goerli, Base Sepolia |
| Daimo Solidity P256 Verifier | 319,943 | 333,892 | 347,505 | 0xc2b78104907F722DABAc4C69f826a522B2754De4 | Mainnet, Base(T) |
| Vyper P256 Verifier | | | | 0xD99D0f622506C2521cceb80B78CAeBE1798C7Ed5 | Goerli, Sepolia, Holesky |### Networks deployed to
- Goerli: [0x00000083Ea3aBb243c4acfDB095DB5aD5A606fc5](https://goerli.etherscan.io/address/0x00000083Ea3aBb243c4acfDB095DB5aD5A606fc5)
- Sepolia: [0x00000083Ea3aBb243c4acfDB095DB5aD5A606fc5](https://sepolia.etherscan.io/address/0x00000083Ea3aBb243c4acfDB095DB5aD5A606fc5)
- Base Goerli: [0x00000083Ea3aBb243c4acfDB095DB5aD5A606fc5](https://sepolia.basescan.org//address/0x00000083Ea3aBb243c4acfDB095DB5aD5A606fc5)
- Base Goerli: [0x00000083Ea3aBb243c4acfDB095DB5aD5A606fc5](https://goerli.basescan.org//address/0x00000083Ea3aBb243c4acfDB095DB5aD5A606fc5)## Actions
To regenerate test vectors:
```
cd test-vectors
npm i# Download, extract, clean test vectors
# This regenerates ../test/vectors.jsonl
npm run generate_wycheproof# Validate that all vectors produce expected results with SubtleCrypto and noble library implementation
npm test# Validate that all vectors also work with EIP-7212
# Test the fallback contract...
cd ..
forge test -vvv# In future, execution spec and clients can test against the same clean vectors
```### Further References
- Daimo's GitHub Repository: [daimo-eth/p256-verifier](https://github.com/daimo-eth/p256-verifier)
- Daimo's Blog: [blog/p256verifier](https://daimo.xyz/blog/p256verifier)
- Daimo's Website: [p256.eth.limo](https://p256.eth.limo/)