EIPs
ZKP related EIPs
Final (11)
⭐ EIP-196: Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128
TL;DR
This EIP introduces precompiled contracts for elliptic curve operations to enable zkSNARK verification within the block gas limit, enhancing privacy and scalability on Ethereum.
Specification
Two precompiled contracts were added on the alt_bn128 curve (Y^2 = X^3 + 3):
- Point Addition (ECADD)
- Address:
0x6 - Gas Cost:
500 - Input: Two curve points
(x, y). - Output: The resulting curve point from the addition.
- Address:
- Scalar Multiplication (ECMUL)
- Address:
0x7 - Gas Cost:
40,000 - Input: A curve point
(x, y)and a scalars. - Output: The resulting curve point from the multiplication.
- Address:
Key Details
- Encoding: Field elements and scalars are 32-byte big-endian numbers. Curve points
are
(x, y), with infinity as(0, 0). - Error Handling: Contracts fail if input points are not on the curve or if coordinates exceed the field modulus.
- Rationale: The
alt_bn128curve was chosen for its efficiency in pairing-based cryptography and for compatibility with ZCash components.
⭐ EIP-197: Precompiled contracts for optimal ate pairing check on the elliptic curve alt_bn128
TL;DR
This EIP introduces a precompiled contract for pairing checks on the alt_bn128 elliptic
curve. This is a crucial component for verifying zkSNARKs efficiently on-chain, complementing EIP-196.
Specification
A precompiled contract was added to perform a pairing check, which is a form of multiplicatively homomorphic operation essential for zkSNARKs.
- Pairing Check (BNPAIR)
- Address:
0x8 -
Gas Cost:
80,000 * k + 100,000(wherekis the number of pairs) - Input: A series of point pairs
(a1, b1, a2, b2, ..., ak, bk). -
Output: Returns
1if the pairing equatione(a1, b1) * ... * e(ak, bk) = 1is satisfied, otherwise0.
- Address:
Key Details
- Groups: The operation involves two groups,
G1(onF_p) andG2(onF_p^2), both derived from thealt_bn128curve. - Input Encoding: The input is a concatenation of encoded points. The total length must be a multiple of 192 bytes (96 bytes for a G1 point and 96 for a G2 point).
- Rationale: Instead of evaluating a full pairing, this EIP specifies a pairing
*check*. This is sufficient for zkSNARK verification and avoids the complexity of handling the
pairing's output field (
F_p^12).
EIP-1108: Reduce alt_bn128 precompile gas costs
TL;DR
This EIP significantly reduces the gas costs for the alt_bn128 curve operations (ECADD, ECMUL, and pairing checks) to reflect performance improvements in Ethereum
clients like Geth and Parity.
Gas Cost Reduction
The gas costs for precompiles introduced in EIP-196 and EIP-197 were updated as follows:
| Contract | Previous Cost | New Cost |
|---|---|---|
ECADD | 500 | 150 |
ECMUL | 40,000 | 6,000 |
| Pairing Check | 80,000 * k + 100,000 | 34,000 * k + 45,000 |
Rationale
The cost reduction makes privacy and scaling solutions (like AZTEC, Matter Labs, and Zether) that rely on these elliptic curve operations much more practical and affordable on the Ethereum mainnet.
ERC-1271: Standard Signature Validation Method for Contracts
TL;DR
This EIP defines a standard way for smart contracts to verify signatures, enabling them to act
like externally owned accounts (EOAs) for authentication. Contracts can implement an isValidSignature function, allowing other contracts to check if a signature is valid on their behalf. This is crucial
for applications like decentralized exchanges with off-chain order books where smart contract wallets
need to sign orders.
Specification
A contract that wishes to be able to sign messages must implement the ERC1271 interface,
which contains a single function:
function isValidSignature(
bytes32 _hash,
bytes memory _signature
) public view returns (bytes4 magicValue); - Functionality: When called, this function should return a magic value (
0x1626ba7e) if the signature is valid for the given hash. Otherwise, it should return a different value. - State: The function must not modify state (it is a
viewfunction). - Flexibility: The implementation can use any logic to validate the signature, such as checking against a list of authorized signers, using multi-sig logic, or supporting different signature schemes.
ERC-2098: Compact Signature Representation
TL;DR
This ERC proposes a compact 64-byte signature representation for secp256k1 signatures,
down from the standard 65 bytes. It achieves this by storing the yParity bit (recovery
ID) in the most significant bit of the s value, which is otherwise unused in canonical
signatures. This saves space and gas, especially in contexts like meta-transactions.
Specification
A standard signature consists of r, s, and yParity. Since
the top bit of s is always zero for canonical signatures (per EIP-2), this ERC "hijacks"
that unused bit to store the yParity. The resulting 64-byte signature is a
concatenation of two 32-byte values:
-
r: The first 32 bytes, representing the x-coordinate of the signature point. -
yParityAndS: The second 32 bytes, which combines theyParityands.
Visually, the structure is:
[256-bit r value][1-bit yParity value][255-bit s value] ⭐ EIP-2537: Precompile for BLS12-381 curve operations
Updated
TL;DR
This EIP introduces a set of precompiled contracts for operations on the BLS12-381 curve, providing a higher security level (120+ bits) compared to the older BN254 curve. These operations are essential for advanced cryptographic schemes like BLS signatures, which are critical for Ethereum's scalability and consensus upgrades.
New Precompiles
Seven new precompiles were added to support various operations:
| Operation | Address | Gas Cost |
|---|---|---|
| G1 Addition | 0x0b | 375 |
| G2 Addition | 0x0d | 600 |
| G1 MSM | 0x0c | Formula-based |
| G2 MSM | 0x0e | Formula-based |
| Pairing Check | 0x0f | 32,600 * k + 37,700 |
| Map Fp to G1 | 0x10 | 5,500 |
| Map Fp2 to G2 | 0x11 | 23,800 |
Rationale
- MSM as a separate call: Providing a dedicated Multi-Scalar Multiplication (MSM)
precompile is more gas-efficient than performing many individual multiplication and addition calls.
It saves on both computational cost (by using algorithms like Pippenger's) and the overhead of
multiple
CALLopcodes. - No dedicated MUL call: A separate multiplication (MUL) precompile is unnecessary
because a single multiplication is just an MSM with one pair (
k=1). The MSM precompile handles this case efficiently.
EIP-2565: ModExp Gas Cost
TL;DR
This EIP reprices the ModExp (modular exponentiation) precompile to more accurately
reflect its true computational cost. This makes various cryptographic functions that depend on it
(like VDFs, SNARKs, and accumulators) cheaper and more practical to use on Ethereum.
New Gas Cost Formula
A new algorithm was introduced to calculate the gas cost, replacing the one from EIP-198. The formula is designed to better approximate the complexity of the underlying "bigint" library operations.
max(200, floor(multiplication_complexity * iteration_count / 3)) - Multiplication Complexity: Approximates the cost of a multiplication, calculated
as
(ceil(max(base_length, modulus_length) / 8))^2. - Iteration Count: Approximates the number of multiplications needed, based on the bit length of the exponent.
Rationale
The previous formula from EIP-198 was found to be an inaccurate approximation. The new formula
better models the performance of modern exponentiation algorithms, and the gas cost is
calibrated against other precompiles like ECRecover to ensure network security and prevent
DoS vectors.
ERC-5732: Commit Interface
TL;DR
This ERC defines a standard interface for commit-reveal schemes. It provides a generic commit function that can be added to any contract, allowing users to commit to an action without revealing
it immediately. This helps prevent front-running attacks and adds a layer of privacy to applications
like voting systems. The reveal mechanism is intentionally left open for developers to implement
as needed.
Specification
The standard defines two interfaces for implementing commit-reveal schemes. The core interface is minimal for backward compatibility, while the general interface provides more features.
interface IERC_COMMIT_CORE {
function commit(bytes32 _commitment) payable external;
}
interface IERC_COMMIT_GENERAL {
event Commit(
uint256 indexed _timePoint,
address indexed _from,
bytes32 indexed _commitment,
bytes _extraData);
function commitFrom(
address _from,
bytes32 _commitment,
bytes calldata _extraData)
payable external returns(uint256 timePoint);
}
ERC-6492: Signature Validation for Predeploy Contracts
TL;DR
This ERC extends EIP-1271 to allow signature verification for smart contracts that have not been deployed yet (counterfactual accounts). It introduces a wrapper format for signatures that includes the necessary data to deploy the contract, enabling dApps to verify signatures from users who haven't made their first on-chain transaction.
Specification
When a contract is not yet deployed, it wraps its standard EIP-1271 signature with deployment
data. The wrapper format is detected by a specific magicBytes suffix.
- Wrapper Format:
concat(abi.encode((create2Factory, factoryCalldata, originalSignature)), magicBytes) - Magic Suffix: The signature ends with
0x64926492...6492. - Verification Process: A verifier checks for the magic suffix. If present, it uses
the provided
create2FactoryandfactoryCalldatato deploy the contract. After deployment, it calls the standardisValidSignaturefunction on the now-deployed contract with the original, unwrapped signature.
ERC-7007: Verifiable AI-Generated Content Token
TL;DR
This ERC extends ERC-721 to create verifiable AI-Generated Content (AIGC) NFTs. It provides a standard way to prove that a piece of digital content was generated by a specific AI model with a specific prompt, using techniques like Zero-Knowledge Machine Learning (zkML) or Optimistic Machine Learning (opML). This enables on-chain provenance for AI art and new monetization models for model creators.
Specification
The standard introduces a core interface, IERC7007, which must be implemented alongside ERC-721. It includes:
-
addAigcData(...): A function to associate AI-generated data (the content) and a proof with a token. -
verify(...): A view function that checks if the AI-generated data is valid for a given prompt and proof. This is where the zkML or opML verification logic resides. - Optional Extensions: Includes
Enumerablefor discovering prompts/tokens andUpdatableto handle data changes, which is particularly useful in optimistic systems.
A key design choice is that the tokenId is derived from the hash of the prompt, ensuring that each unique prompt corresponds to a single, unique NFT.
ERC-7734: Decentralized Identity Verification (DID)
TL;DR
This ERC introduces a minimalistic standard for decentralized identity (DID) verification. It allows users to create, verify, and revoke their identity through a smart contract, using cryptographic hashes to keep sensitive data off-chain. The goal is to provide a simple, private, and user-controlled identity layer for dApps without the complexity of other DID solutions.
Specification
The standard defines an IDecentralizedIdentity interface with the following key components:
-
IdentityStruct: Stores the user's address, an identity hash, verification hashes, and a booleanisVerifiedstatus. - Core Functions:
-
createIdentity(bytes32 identityHash): Creates a new identity for the caller. -
verifyIdentity(bytes32[2] calldata verificationHashes): Verifies the identity by submitting hashes derived from off-chain proofs. revokeIdentity(): Revokes the verification status of an identity.
-
- Events: Emits
IdentityCreated,IdentityVerified, andIdentityRevokedevents for transparency and traceability.
Last Call (1)
ERC-7913: Signature Verifiers
Updated
TL;DR
This ERC provides a standard way to verify signatures from keys that don't have a native Ethereum address, such as those from mobile secure enclaves (secp256r1), RSA hardware, or ZK-based systems. It extends ERC-1271 by introducing shared "verifier" contracts, making it cheaper and easier to integrate diverse cryptographic keys into account abstraction.
Specification
Instead of identifying a signer by a single address, this standard uses a (verifier, key) pair:
- Verifier: A smart contract that knows how to validate signatures for a specific type of key (e.g., a secp256r1 verifier).
- Key: The public key material, represented as
bytes.
The verifier contract must implement the IERC7913SignatureVerifier interface, which
has a single function:
interface IERC7913SignatureVerifier {
function verify(
bytes calldata key,
bytes32 hash,
bytes calldata signature
) external view returns (bytes4);
}
On successful verification, the function must return its own selector (0x024ad318).
Review (2)
ERC-7812: ZK Identity Registry
Updated
TL;DR
This ERC introduces a singleton on-chain registry for storing private, provable statements. It allows users and protocols to anchor commitments (blinded data) to a shared database and later use Zero-Knowledge proofs to verify claims about this data without revealing it. This creates a standardized, reusable foundation for ZK-based identity, reputation, and other privacy-preserving systems.
Specification
The system is built around a central EvidenceRegistry contract that manages a provable
key-value store called EvidenceDB, which is implemented as a Sparse Merkle Tree
(SMT).
-
EvidenceRegistry: A singleton contract that acts as the main entry point. It provides functions likeaddStatement,removeStatement, andupdateStatement. - Namespace Isolation: Each statement is stored under an isolated key, generated by hashing the sender's address with the provided key. This prevents one registrar from overwriting another's data.
- Registrars: Developers can build custom "Registrar" contracts for specific use cases (e.g., identity, proof-of-attendance) that interact with the central registry.
- ZK-Friendly: The standard recommends using ZK-friendly hash functions like Poseidon to make it efficient to generate proofs of inclusion or exclusion for the stored data.
EIP-7951: Precompile for secp256r1 Curve Support
New
TL;DR
This EIP adds a precompile for secp256r1 ECDSA signature verification, enabling native
support for signatures from modern hardware like Apple's Secure Enclave and Android Keystore. This
is crucial for account abstraction and improves user experience by allowing device-native authentication.
It also fixes critical security vulnerabilities found in a previous, similar proposal (RIP-7212).
Specification
A new precompile, P256VERIFY, is introduced at address 0x100.
- Operation: Performs ECDSA signature verification on the
secp256r1curve. - Gas Cost:
6900 - Input: 160 bytes, consisting of the message hash (32 bytes), signature components
rands(32 bytes each), and the public key coordinatesqxandqy(32 bytes each). - Output: Returns
1on successful verification and an empty response on failure. It includes strict input validation and does not revert on error.
Rationale
This EIP was designed to be a secure replacement for RIP-7212, fixing critical bugs related to
point-at-infinity and modular comparison checks. It uses signature verification (rather than key
recovery like ecrecover) because it aligns with hardware standards and is more
efficient for this curve.