Skip to content

Precompiles

Precompiles are built-in system functions inside the Venus zkVM that accelerate computationally expensive and frequently used operations -- e.g. the Keccak-f permutation, SHA-256, Poseidon2, and elliptic-curve operations over Secp256k1, Secp256r1, BN254, and BLS12-381.

These precompiles improve proving efficiency by offloading intensive computations from guest programs to dedicated, pre-integrated sub-processors.

How Precompiles Work

Precompiles are invoked through system calls. In practice, they are usually surfaced to a guest program by patching third-party crates that already implement these primitives, replacing their costly software paths with Venus syscalls. This way, common cryptographic primitives in your dependency tree run in constant-time precompile circuits inside the proof.

For an example of a patched crate, see the upstream zisk-patch-tiny-keccak project; the same patching approach applies to Venus.

Available Precompiles

The syscall surface lives under ziskos/entrypoint/src/syscalls/ in the Venus repository.

Syscall Description
syscall_add256 Addition over 256-bit non-negative integers.
syscall_arith256 Multiplication followed by addition over 256-bit non-negative integers.
syscall_arith256_mod Modular multiplication followed by addition over 256-bit non-negative integers.
syscall_arith384_mod Modular multiplication followed by addition over 384-bit non-negative integers.
syscall_keccak_f Keccak-f 1600 permutation function.
syscall_sha256_f SHA-256 extend and compress function.
syscall_poseidon2 Poseidon2 compression function.
syscall_secp256k1_add Elliptic-curve point addition over Secp256k1.
syscall_secp256k1_dbl Elliptic-curve point doubling over Secp256k1.
syscall_secp256r1_add Elliptic-curve point addition over Secp256r1.
syscall_secp256r1_dbl Elliptic-curve point doubling over Secp256r1.
syscall_bn254_curve_add Elliptic-curve point addition over BN254.
syscall_bn254_curve_dbl Elliptic-curve point doubling over BN254.
syscall_bn254_complex_add Complex addition in the quadratic extension of BN254's base field.
syscall_bn254_complex_sub Complex subtraction in the quadratic extension of BN254's base field.
syscall_bn254_complex_mul Complex multiplication in the quadratic extension of BN254's base field.
syscall_bls12_381_curve_add Elliptic-curve point addition over BLS12-381.
syscall_bls12_381_curve_dbl Elliptic-curve point doubling over BLS12-381.
syscall_bls12_381_complex_add Complex addition in the quadratic extension of BLS12-381's base field.
syscall_bls12_381_complex_sub Complex subtraction in the quadratic extension of BLS12-381's base field.
syscall_bls12_381_complex_mul Complex multiplication in the quadratic extension of BLS12-381's base field.

For an even cheaper path on hot precompile call sites, see the Hints Stream, which lets you precompute results outside the VM and stream them back as verifiable data.