Skip to main content

Crate sp1_lib

Crate sp1_lib 

Source
Expand description

Syscalls for the SP1 zkVM.

Documentation for these syscalls can be found in the zkVM entrypoint sp1_zkvm::syscalls module.

Modules§

bls12381
bn254
ecdsa
An implementation of the types needed for CurveArithmetic.
ed25519
io
mprotect
poseidon2
secp256k1
secp256r1
unconstrained
utils

Macros§

invalid_hint
Halts the zkVM with exit code 3 (invalid prover hint), optionally writing a formatted diagnostic to stderr first.
unconstrained
Executes a block of code unconstrained by the VM. This macro is useful for running code that helps provide information to the program but does not need to be constrained by the VM. For example, running ecrecover is expensive in the VM but verifying a signature when you know the public key is not. unconstrained can be used to provide the public key without spending VM CPU cycles.

Structs§

ReadVecResult

Functions§

halt_invalid_hint
Halts the zkVM with exit code 3, signalling that a prover-supplied hint failed verification.
read_vec_raw⚠
Reads a buffer from the input stream.
sys_alloc_aligned⚠
Allocates a buffer aligned to the given alignment.
sys_bigint⚠
Computes a big integer operation with a modulus.
syscall_bls12381_add⚠
Executes a BLS12-381 curve addition on the given points.
syscall_bls12381_decompress⚠
Decompresses a BLS12-381 point.
syscall_bls12381_double⚠
Executes a BLS12-381 curve doubling on the given point.
syscall_bls12381_fp2_addmod⚠
Executes a BLS12-381 Fp2 addition on the given inputs.
syscall_bls12381_fp2_mulmod⚠
Executes a BLS12-381 Fp2 multiplication on the given inputs.
syscall_bls12381_fp2_submod⚠
Executes a BLS12-381 Fp2 subtraction on the given inputs.
syscall_bls12381_fp_addmod⚠
Executes a BLS12-381 field addition on the given inputs.
syscall_bls12381_fp_mulmod⚠
Executes a BLS12-381 field multiplication on the given inputs.
syscall_bls12381_fp_submod⚠
Executes a BLS12-381 field subtraction on the given inputs.
syscall_bn254_add⚠
Executes a Bn254 curve addition on the given points.
syscall_bn254_double⚠
Executes a Bn254 curve doubling on the given point.
syscall_bn254_fp2_addmod⚠
Executes a BN254 Fp2 addition on the given inputs.
syscall_bn254_fp2_mulmod⚠
Executes a BN254 Fp2 multiplication on the given inputs.
syscall_bn254_fp2_submod⚠
Executes a BN254 Fp2 subtraction on the given inputs.
syscall_bn254_fp_addmod⚠
Executes a BN254 field addition on the given inputs.
syscall_bn254_fp_mulmod⚠
Executes a BN254 field multiplication on the given inputs.
syscall_bn254_fp_submod⚠
Executes a BN254 field subtraction on the given inputs.
syscall_ed_add⚠
Executes an Ed25519 curve addition on the given points.
syscall_ed_decompress⚠
Executes an Ed25519 curve decompression on the given point.
syscall_enter_unconstrained⚠
Enters unconstrained mode.
syscall_exit_unconstrained⚠
Exits unconstrained mode.
syscall_halt⚠
Halts the program with the given exit code.
syscall_hint_len⚠
Returns the length of the next element in the hint stream.
syscall_hint_read⚠
Reads the next element in the hint stream into the given buffer.
syscall_keccak_permute⚠
Executes the Keccak-256 permutation on the given state.
syscall_mprotect⚠
Executes the mprotect syscall.
syscall_mprotect_flush⚠
Flushes all pending mprotect changes.
syscall_poseidon2⚠
Executes the Poseidon2 permutation on the given state buffer in-place.
syscall_read⚠
Reads the bytes from the given file descriptor into the given buffer.
syscall_secp256k1_add⚠
Executes an Sepc256k1 curve addition on the given points.
syscall_secp256k1_decompress⚠
Executes an Secp256k1 curve decompression on the given point.
syscall_secp256k1_double⚠
Executes an Secp256k1 curve doubling on the given point.
syscall_secp256r1_add⚠
Executes an Secp256r1 curve addition on the given points.
syscall_secp256r1_decompress⚠
Executes an Secp256r1 curve decompression on the given point.
syscall_secp256r1_double⚠
Executes an Secp256r1 curve doubling on the given point.
syscall_sha256_compress⚠
Executes the SHA-256 compress operation on the given word array and a given state.
syscall_sha256_extend⚠
Executes the SHA-256 extend operation on the given word array.
syscall_u256x2048_mul⚠
Executes a 256-bit by 2048-bit multiplication on the given inputs.
syscall_uint256_add_with_carry⚠
Executes Uint256 addition operation with carry.
syscall_uint256_mul_with_carry⚠
Executes Uint256 multiplication operation with carry.
syscall_uint256_mulmod⚠
Executes an uint256 multiplication on the given inputs.
syscall_verify_sp1_proof⚠
Defers the verification of a valid SP1 zkVM proof.
syscall_write⚠
Writes the bytes in the given buffer to the given file descriptor.