Home

Awesome

P256 Curve Verifier Huff implementation

Secp256r1 (a.k.a p256) curve signature verifier rewritten and optimized in Huff Language. This was greatly inspired by dcposch's and nalinbhardwaj's implementation here and pcaversaccio's Vyper implementation here. Also, for more technical details, please refer to 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

ImplementationMin gasAvg gasMax gasOnChain AddressAvailable Networks
FCL Solidity P256 Verifier227,0000xE9399D1183a5cf9E14B120875A616b6E2bcB840aPolygon(M), Sepolia, Base, OP, Linea
Huff P256 Verifier228,475239,164249,5740x00000083Ea3aBb243c4acfDB095DB5aD5A606fc5Goerli, Sepolia, Base Goerli, Base Sepolia
Daimo Solidity P256 Verifier319,943333,892347,5050xc2b78104907F722DABAc4C69f826a522B2754De4Mainnet, Base(T)
Vyper P256 Verifier0xD99D0f622506C2521cceb80B78CAeBE1798C7Ed5Goerli, Sepolia, Holesky

Networks deployed to

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