Function-level
Integrating specialized circuits within Pico
Last updated
Integrating specialized circuits within Pico
Last updated
Function-level coprocessors—commonly known as precompiles—are specialized circuits within Pico designed to optimize and streamline specific cryptographic operations and computational tasks. These precompiles handle operations such as elliptic curve arithmetic, hash functions, and signature verifications. In a general-purpose environment, these operations can be resource-intensive, but by offloading them to dedicated circuits, Pico significantly reduces computational costs, improves performance, and enhances scalability during proof generation and verification. Packaging these core operations into efficient, well-tested modules not only accelerates development cycles but also establishes a secure foundation for a wide range of zk-applications, including privacy-preserving transactions, rollups, and layer-2 scaling solutions.
Below is an example workflow of Keccak256 hash permutation precompile in Pico.
The Pico precompiles workflow involves several steps to efficiently execute and verify cryptographic operations. To illstrate how it works, we use Keccak-256 precompile as an example:
Developer Preparation: Developers begin by writing and preparing the necessary code, including the tiny-keccak patch for cryptographic hashing functions. This library provides the core primitives needed for SHA2, SHA3, and Keccak-based operations.
Tiny-Keccak Patch: Pico uses a forked and zero-knowledge-compatible version of tiny-keccak (sourced from the public debris repository). This patch optimizes hashing operations—particularly Keccak-256—to run efficiently within Pico.
Keccak256 Precompile: When a Keccak-256 hashing function is invoked, Pico’s Keccak256 precompile is triggered to handle the specific permutation operations. This specialized circuit, known internally as the keccak256_permute_syscall
, is optimized for performance, minimizing overhead and improving provability.
Rust Toolchain & ELF Generation: The Rust toolchain compiles your code, including the tiny-keccak patch, into an Executable and Linkable Format (ELF) file, which is the RISC0's support for zkVM executables.
By following this workflow, developers can perform cryptographic operations more efficiently and securely, taking full advantage of Pico’s precompile features to reduce proof overhead and streamline the development of ZK apps.
Pico is currently supporting these syscalls.
Pico is currently supporting the following patches:
tiny-keccak
https://github.com/brevis-network/tiny-keccak
sha2
https://github.com/brevis-network/hashes
sha3
https://github.com/brevis-network/hashes
curve25519-dalek
https://github.com/brevis-network/curve25519-dalek
bls12381
https://github.com/brevis-network/bls12_381
curve25519-dalek-ng
https://github.com/brevis-network/curve25519-dalek-ng
ed25519-consensus
https://github.com/brevis-network/ed25519-consensus
ecdsa-core
https://github.com/brevis-network/signatures
secp256k1
https://github.com/brevis-network/rust-secp256k1
substate-bn
https://github.com/brevis-network/bn
bigint
https://github.com/brevis-network/crypto-bigint
rev: