Skip to main content

Advanced

Embedded Allocator

SP1 programs use a simple bump allocator by default, which just increments a pointer to allocate memory. Although this works for many cases, some programs can still run out of memory in the SP1 zkVM. To address this, you can enable the embedded allocator feature on the SP1 zkVM.

The embedded allocator uses the embedded-alloc crate and offers more flexible memory management, albeit with extra cycle overhead.

To enable it, add the following to your sp1-zkvm dependency in Cargo.toml:

sp1-zkvm = { version = "...", features = ["embedded"] }

Once enabled, the embedded allocator replaces the default bump allocator.

Blake3 Public Values Hashing

In certain verification contexts (e.g. Bitcoin script), verifying public values hashed with Blake3 is more efficient than verifying public values hashed with SHA-256.

To enable blake3 public values hashing for your program, enable the blake3 feature on the sp1-zkvm dependency in Cargo.toml:

sp1-zkvm = { version = "...", features = ["blake3"] }

The committed hash of the public values for your proof will be hashed with Blake3 instead of SHA-256.

note

Verifying SP1 Groth16/PLONK proofs in Solidity with Blake3 public values hashing is not yet supported.