Skip to main content

zkVM symbol reference

Zesu builds its execution logic as a relocatable RISC-V ELF object named zesu.rv64im.o. This object leaves platform-specific behavior as unresolved extern symbol references that each zero-knowledge virtual machine (zkVM) target satisfies with a host object.

The host object implements each symbol using platform-native circuits or software fallbacks, then links against zesu.rv64im.o to produce the final guest binary. This keeps Ethereum Virtual Machine (EVM) logic separate from zkVM-specific integration code.

The symbols fall into three categories: I/O, runtime, and accelerators.

I/O symbols

I/O symbols are the channel between Zesu and the zkVM host at runtime. Zesu uses read_input to receive the zkVM private input and write_output to emit public output bytes.

SymbolSignatureDescription
read_input(*[*]const u8, *usize) voidReturn the location and length of the serialized input
write_output([*]const u8, usize) voidEmit the public output bytes

Runtime symbols

Runtime symbols provide execution environment support for logging, process termination, and memory management.

SymbolSignatureDescription
zkvm_log(u8, [*]const u8, usize) voidLog a message at the given level
zkvm_exit(i32) noreturnTerminate execution with the given exit code
ZKVM_HEAP_POSusize (var)Bump heap cursor advanced by the allocator
ZKVM_HEAP_TOPusize (var)Heap upper bound checked by the allocator

Accelerator symbols

Accelerator symbols delegate cryptographic operations to host-provided implementations. All accelerator symbols return i32: 0 for success, -1 for failure. Host implementations can satisfy these symbols using platform-native circuits or software fallbacks.

The precompile column shows the EVM precompile address that each accelerator corresponds to, where applicable. No precompile address is listed for zkvm_keccak256 or zkvm_secp256k1_verify.

SymbolPrecompileDescription
zkvm_keccak256Keccak-256 hash
zkvm_sha2560x02SHA-256 hash
zkvm_secp256k1_ecrecover0x01secp256k1 signature recovery
zkvm_secp256k1_verifysecp256k1 signature verification
zkvm_ripemd1600x03RIPEMD-160 hash
zkvm_modexp0x05Modular exponentiation (EIP-198)
zkvm_bn254_g1_add0x06BN254 G1 point addition (EIP-196)
zkvm_bn254_g1_mul0x07BN254 G1 scalar multiplication (EIP-196)
zkvm_bn254_pairing0x08BN254 pairing check (EIP-197)
zkvm_blake2f0x09BLAKE2f compression (EIP-152)
zkvm_kzg_point_eval0x0aKZG point evaluation (EIP-4844)
zkvm_bls12_g1_add0x0bBLS12-381 G1 addition (EIP-2537)
zkvm_bls12_g1_msm0x0cBLS12-381 G1 multi-scalar multiplication (EIP-2537)
zkvm_bls12_g2_add0x0dBLS12-381 G2 addition (EIP-2537)
zkvm_bls12_g2_msm0x0eBLS12-381 G2 multi-scalar multiplication (EIP-2537)
zkvm_bls12_pairing0x0fBLS12-381 pairing check (EIP-2537)
zkvm_bls12_map_fp_to_g10x10BLS12-381 Fp to G1 map (EIP-2537)
zkvm_bls12_map_fp2_to_g20x11BLS12-381 Fp2 to G2 map (EIP-2537)
zkvm_secp256r1_verify0x100P-256 signature verification (EIP-7212)