Summary
Programs interact with the runtime through syscalls covering logging, hashing, cryptography, CPI, sysvars, memory operations, and more. Each deducts compute units from the transaction's shared budget.
Syscalls
Programs interact with the runtime through syscalls registered in
create_program_runtime_environment_v1().
Each syscall deducts compute units from the transaction's compute budget.
Syscall costs
Each syscall's base compute unit cost constants are defined in
SVMTransactionExecutionCost.
Some syscalls combine these constants into more complex formulas in their
implementation (e.g., scaling with input size or adding syscall_base_cost
overhead). See the individual syscall source links below for exact cost
calculations.
Available syscalls
The complete set of syscalls available to sBPF programs, as registered in
create_program_runtime_environment_v1().
Feature-gated syscalls are only available when the corresponding feature is
active on the cluster.
Control flow
| Syscall | Description | Source |
|---|---|---|
abort | Halts the program immediately. Inserted by LLVM for untenable conditions; not intended for explicit use. | SyscallAbort |
sol_panic_ | Halts the program with a file name, line, and column number for diagnostics. | SyscallPanic |
Logging
| Syscall | Description | Source |
|---|---|---|
sol_log_ | Logs a UTF-8 string message to the program log. | SyscallLog |
sol_log_64_ | Logs five u64 values as hex to the program log. | SyscallLogU64 |
sol_log_pubkey | Logs a Pubkey as a base58 string to the program log. | SyscallLogPubkey |
sol_log_compute_units_ | Logs the remaining compute units to the program log. | SyscallLogBpfComputeUnits |
sol_log_data | Logs arbitrary byte slices as base64-encoded data. | SyscallLogData |
PDA
| Syscall | Description | Source |
|---|---|---|
sol_create_program_address | Derives a program address from seeds and a program ID. Returns 1 if the derived address is on the Ed25519 curve (invalid PDA). | SyscallCreateProgramAddress |
sol_try_find_program_address | Finds a valid PDA by iterating bump seeds from 255 down to 1. Returns the address and bump. | SyscallTryFindProgramAddress |
Hashing
| Syscall | Description | Source |
|---|---|---|
sol_sha256 | Computes a SHA-256 hash over one or more byte slices. | SyscallHash<Sha256Hasher> |
sol_keccak256 | Computes a Keccak-256 hash over one or more byte slices. | SyscallHash<Keccak256Hasher> |
sol_blake3 | Computes a Blake3 hash over one or more byte slices. Feature-gated. | SyscallHash<Blake3Hasher> |
sol_poseidon | Computes a Poseidon hash over inputs. Feature-gated. | SyscallPoseidon |
Cryptography
| Syscall | Description | Source |
|---|---|---|
sol_secp256k1_recover | Recovers a secp256k1 public key from a signed message hash and recovery ID. | SyscallSecp256k1Recover |
sol_curve_validate_point | Validates that a byte array is a valid point on Curve25519 (Edwards or Ristretto). Feature-gated. | SyscallCurvePointValidation |
sol_curve_group_op | Performs Curve25519 group operations (add, subtract, multiply) on Edwards or Ristretto points. Feature-gated. | SyscallCurveGroupOps |
sol_curve_multiscalar_mul | Performs multi-scalar multiplication on Curve25519 Edwards or Ristretto points. Feature-gated. | SyscallCurveMultiscalarMultiplication |
sol_alt_bn128_group_op | Performs alt_bn128 (BN254) group operations: G1 addition, G1 multiplication, and pairing check. Feature-gated. | SyscallAltBn128 |
sol_alt_bn128_compression | Compresses and decompresses alt_bn128 G1 and G2 points. Feature-gated. | SyscallAltBn128Compression |
sol_big_mod_exp | Computes big integer modular exponentiation (base^exp mod modulus). Feature-gated. | SyscallBigModExp |
CPI
| Syscall | Description | Source |
|---|---|---|
sol_invoke_signed_rust | Invokes a cross-program instruction from a Rust program. Serializes instruction, accounts, and signer seeds using the Rust ABI. | SyscallInvokeSignedRust |
sol_invoke_signed_c | Invokes a cross-program instruction from a C program. Uses the C SolInstruction ABI for serialization. | SyscallInvokeSignedC |
Sysvars
| Syscall | Description | Source |
|---|---|---|
sol_get_clock_sysvar | Writes the Clock sysvar to a program-provided buffer. | SyscallGetClockSysvar |
sol_get_epoch_schedule_sysvar | Writes the EpochSchedule sysvar to a program-provided buffer. | SyscallGetEpochScheduleSysvar |
sol_get_rent_sysvar | Writes the Rent sysvar to a program-provided buffer. | SyscallGetRentSysvar |
sol_get_epoch_rewards_sysvar | Writes the EpochRewards sysvar to a program-provided buffer. | SyscallGetEpochRewardsSysvar |
sol_get_last_restart_slot | Writes the LastRestartSlot sysvar to a program-provided buffer. Feature-gated. | SyscallGetLastRestartSlotSysvar |
sol_get_fees_sysvar | Writes the deprecated Fees sysvar to a program-provided buffer. Feature-gated (deprecated). | SyscallGetFeesSysvar |
sol_get_sysvar | Generic sysvar access: reads a byte slice from any cached sysvar by its pubkey, offset, and length (SIMD-0127). Feature-gated. | SyscallGetSysvar |
Memory operations
| Syscall | Description | Source |
|---|---|---|
sol_memcpy_ | Copies n bytes from source to destination. Aborts if regions overlap in VM address space. | SyscallMemcpy |
sol_memmove_ | Copies n bytes from source to destination, handling overlapping regions correctly. | SyscallMemmove |
sol_memcmp_ | Compares n bytes of two memory regions. Writes the result (first differing byte comparison) to a result address. | SyscallMemcmp |
sol_memset_ | Fills n bytes of a memory region with a given byte value. | SyscallMemset |
Program data
| Syscall | Description | Source |
|---|---|---|
sol_set_return_data | Sets return data (max 1,024 bytes) for the current instruction. Readable by the caller after the CPI returns. | SyscallSetReturnData |
sol_get_return_data | Reads the return data set by the most recent CPI. Returns the data length and the program ID that set it. | SyscallGetReturnData |
sol_get_processed_sibling_instruction | Retrieves a previously executed sibling instruction at the same stack height (by reverse index). Returns program ID, data, and account metas. | SyscallGetProcessedSiblingInstruction |
sol_get_stack_height | Returns the current call stack height. Height 1 = top-level instruction; each CPI increments by 1. | SyscallGetStackHeight |
Compute
| Syscall | Description | Source |
|---|---|---|
sol_remaining_compute_units | Returns the number of compute units remaining in the transaction budget. Feature-gated. | SyscallRemainingComputeUnits |
Epoch stake
| Syscall | Description | Source |
|---|---|---|
sol_get_epoch_stake | Returns total cluster stake (null pointer) or a specific vote account's delegated stake for the current epoch (SIMD-0133). Feature-gated. | SyscallGetEpochStake |
Memory allocation
| Syscall | Description | Source |
|---|---|---|
sol_alloc_free_ | Legacy bump allocator for dynamic memory allocation. Disabled for new deployments; only available to programs deployed before the feature gate. | SyscallAllocFree |
Is this page helpful?