Skip to main content

Constants

MAX_VK_BYTES leaves room for a leading STOP byte and a backend byte under EIP-170’s 24,576-byte runtime-code limit.

Circuit ID

A circuit ID commits to the backend and exact verification-key bytes:
For UltraHonk, backend is the single byte 0x02. Recompiling a circuit may change its verification key and circuit ID. Circuit names and versions remain offchain.

ABI

Registration and storage

register performs these steps:
  1. Require backend 0x02 and a verification key between 256 and 24,574 bytes.
  2. Compute the circuit ID from backend || vk.
  3. Return the existing pointer if the circuit ID is already registered.
  4. Deploy a CircuitRegistryBlob with CREATE2, using the circuit ID as its salt.
  5. Record the pointer and emit CircuitRegistered.
Each pointer contains this runtime code:
The leading 0x00 is STOP. A call to the pointer halts before the EVM interprets backend || verificationKey as instructions. The registry skips the STOP byte and reads the remaining bytes as data using EXTCODECOPY.

Proof request wire

Pass the following request to the ABI function verify(bytes):
verify resolves pointerOf[circuitId], reads the registered key, and inserts the key material before forwarding this wire to 0xF2:
keyLen includes the one-byte backend tag. The precompile recomputes keccak256(backend || verificationKey) and requires it to equal circuitId before verifying the proof. Send the application wire as the argument to verify(bytes). Sending that wire directly to 0xF0 without the ABI selector does not invoke verification.

Verification result

verify returns true only when 0xF2 returns the exact 32-byte encoding of 1. It returns false for:
  • a request shorter than 32 bytes;
  • an unknown circuit ID;
  • malformed proof lengths, public-input counts, or trailing bytes;
  • invalid stored key shape;
  • a backend or key that does not match the circuit ID;
  • an invalid proof; or
  • a failed or malformed precompile response.
Treat every false result as proof rejection. The result does not identify which check failed. The 0xF2 precompile charges:
The factor of 64 is Metal’s CPU precompile gas multiplier. This excludes the EVM overhead of calling CircuitRegistry and copying the stored key.

Event

The event is emitted for a new registration. An idempotent call returns the existing values without emitting another event.

Errors

Malformed requests, unknown circuits, and invalid proofs produce a false result from verify.

Circuits and proofs

Understand how MIP410 composes its proof system.

Shielded payment circuits

Inspect the sender and recipient proof boundaries.