Syscall Reference

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

SyscallDescriptionSource
abortHalts 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

SyscallDescriptionSource
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_pubkeyLogs 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_dataLogs arbitrary byte slices as base64-encoded data.SyscallLogData

PDA

SyscallDescriptionSource
sol_create_program_addressDerives 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_addressFinds a valid PDA by iterating bump seeds from 255 down to 1. Returns the address and bump.SyscallTryFindProgramAddress

Hashing

SyscallDescriptionSource
sol_sha256Computes a SHA-256 hash over one or more byte slices.SyscallHash<Sha256Hasher>
sol_keccak256Computes a Keccak-256 hash over one or more byte slices.SyscallHash<Keccak256Hasher>
sol_blake3Computes a Blake3 hash over one or more byte slices. Feature-gated.SyscallHash<Blake3Hasher>
sol_poseidonComputes a Poseidon hash over inputs. Feature-gated.SyscallPoseidon

Cryptography

SyscallDescriptionSource
sol_secp256k1_recoverRecovers a secp256k1 public key from a signed message hash and recovery ID.SyscallSecp256k1Recover
sol_curve_validate_pointValidates that a byte array is a valid point on Curve25519 (Edwards or Ristretto). Feature-gated.SyscallCurvePointValidation
sol_curve_group_opPerforms Curve25519 group operations (add, subtract, multiply) on Edwards or Ristretto points. Feature-gated.SyscallCurveGroupOps
sol_curve_multiscalar_mulPerforms multi-scalar multiplication on Curve25519 Edwards or Ristretto points. Feature-gated.SyscallCurveMultiscalarMultiplication
sol_alt_bn128_group_opPerforms alt_bn128 (BN254) group operations: G1 addition, G1 multiplication, and pairing check. Feature-gated.SyscallAltBn128
sol_alt_bn128_compressionCompresses and decompresses alt_bn128 G1 and G2 points. Feature-gated.SyscallAltBn128Compression
sol_big_mod_expComputes big integer modular exponentiation (base^exp mod modulus). Feature-gated.SyscallBigModExp

CPI

SyscallDescriptionSource
sol_invoke_signed_rustInvokes a cross-program instruction from a Rust program. Serializes instruction, accounts, and signer seeds using the Rust ABI.SyscallInvokeSignedRust
sol_invoke_signed_cInvokes a cross-program instruction from a C program. Uses the C SolInstruction ABI for serialization.SyscallInvokeSignedC

Sysvars

SyscallDescriptionSource
sol_get_clock_sysvarWrites the Clock sysvar to a program-provided buffer.SyscallGetClockSysvar
sol_get_epoch_schedule_sysvarWrites the EpochSchedule sysvar to a program-provided buffer.SyscallGetEpochScheduleSysvar
sol_get_rent_sysvarWrites the Rent sysvar to a program-provided buffer.SyscallGetRentSysvar
sol_get_epoch_rewards_sysvarWrites the EpochRewards sysvar to a program-provided buffer.SyscallGetEpochRewardsSysvar
sol_get_last_restart_slotWrites the LastRestartSlot sysvar to a program-provided buffer. Feature-gated.SyscallGetLastRestartSlotSysvar
sol_get_fees_sysvarWrites the deprecated Fees sysvar to a program-provided buffer. Feature-gated (deprecated).SyscallGetFeesSysvar
sol_get_sysvarGeneric sysvar access: reads a byte slice from any cached sysvar by its pubkey, offset, and length (SIMD-0127). Feature-gated.SyscallGetSysvar

Memory operations

SyscallDescriptionSource
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

SyscallDescriptionSource
sol_set_return_dataSets return data (max 1,024 bytes) for the current instruction. Readable by the caller after the CPI returns.SyscallSetReturnData
sol_get_return_dataReads 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_instructionRetrieves a previously executed sibling instruction at the same stack height (by reverse index). Returns program ID, data, and account metas.SyscallGetProcessedSiblingInstruction
sol_get_stack_heightReturns the current call stack height. Height 1 = top-level instruction; each CPI increments by 1.SyscallGetStackHeight

Compute

SyscallDescriptionSource
sol_remaining_compute_unitsReturns the number of compute units remaining in the transaction budget. Feature-gated.SyscallRemainingComputeUnits

Epoch stake

SyscallDescriptionSource
sol_get_epoch_stakeReturns total cluster stake (null pointer) or a specific vote account's delegated stake for the current epoch (SIMD-0133). Feature-gated.SyscallGetEpochStake

Memory allocation

SyscallDescriptionSource
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?

सामग्री तालिका

पृष्ठ संपादित करें

द्वारा प्रबंधित

© 2026 सोलाना फाउंडेशन। सर्वाधिकार सुरक्षित।
जुड़े रहें