Expand description
The Solana host and client SDK.
This is the base library for all off-chain programs that interact with
Solana or otherwise operate on Solana data structures. On-chain programs
instead use the solana-program
crate, the modules of which are
re-exported by this crate, like the relationship between the Rust
core
and std
crates. As much of the functionality of this crate is
provided by solana-program
, see that crate’s documentation for an
overview.
Many of the modules in this crate are primarily of use to the Solana runtime
itself. Additional crates provide capabilities built on solana-sdk
, and
many programs will need to link to those crates as well, particularly for
clients communicating with Solana nodes over RPC.
Such crates include:
solana-client
- For interacting with a Solana node via the JSON-RPC API.solana-cli-config
- Loading and saving the Solana CLI configuration file.solana-clap-utils
- Routines for setting up the CLI usingclap
, as used by the Solana CLI. Includes functions for loading all types of signers supported by the CLI.
Re-exports§
Modules§
- account
- The Solana
Account
type. - account_
info - Account information.
- account_
utils - Useful extras for
Account
state. - address_
lookup_ table - The address lookup table program.
- alt_
bn128 - big_
mod_ exp - blake3
- Hashing with the blake3 hash function.
- borsh
- Utilities for the borsh serialization format.
- borsh0_
10 - Utilities for the borsh serialization format, version 0.10.
- borsh1
- Utilities for the borsh serialization format, version 1.
- bpf_
loader - The latest BPF loader native program.
- bpf_
loader_ deprecated - The original and now deprecated Solana BPF loader.
- bpf_
loader_ upgradeable - An upgradeable BPF loader native program.
- client
- Defines traits for blocking (synchronous) and non-blocking (asynchronous) communication with a Solana server as well a a trait that encompasses both.
- clock
- Information about the network’s clock, ticks, slots, etc.
- commitment_
config - Definitions of commitment levels.
- compute_
budget - The compute budget native program.
- config
- The config native program.
- debug_
account_ data - Debug-formatting of account data.
- decode_
error - Converting custom error codes to enums.
- derivation_
path - BIP-44 derivation paths.
- deserialize_
utils - Serde helpers.
- ed25519_
instruction - Instructions for the ed25519 native program.
- ed25519_
program - The ed25519 native program.
- entrypoint
- The Rust-based BPF program entrypoint supported by the latest BPF loader.
- entrypoint_
deprecated - The Rust-based BPF program entrypoint supported by the original BPF loader.
- epoch_
info - Information about the current epoch.
- epoch_
rewards - A type to hold data for the
EpochRewards
sysvar. - epoch_
rewards_ hasher - epoch_
schedule - Configuration for epochs and slots.
- exit
- Used by validators to run events on exit.
- feature
- Methods for working with
Feature
accounts. - feature_
set - Collection of all runtime features.
- fee
- Fee structures.
- fee_
calculator - Calculation of transaction fees.
- genesis_
config - The chain’s genesis config.
- hard_
forks - The list of slot boundaries at which a hard fork should occur.
- hash
- Hashing with the SHA-256 hash function, and a general
Hash
type. - incinerator
- A designated address for burning lamports.
- inflation
- configuration for network inflation
- inner_
instruction - instruction
- Types for directing the execution of Solana programs.
- keccak
- Hashing with the keccak (SHA-3) hash function.
- lamports
- Defines the
LamportsError
type. - loader_
instruction - Instructions for the non-upgradable BPF loader.
- loader_
upgradeable_ instruction - Instructions for the upgradable BPF loader.
- loader_
v4 - The v4 built-in loader program.
- loader_
v4_ instruction - Instructions for the v4 built-in loader program.
- message
- Sequences of
Instruction
s executed within a single transaction. - native_
loader - The native loader native program.
- native_
token - Definitions for the native SOL token and its fractional lamports.
- net
- nonce
- Durable transaction nonces.
- nonce_
account - Functions related to nonce accounts.
- offchain_
message - Off-chain message container for storing non-transaction messages.
- packet
- The definition of a Solana network packet.
- poh_
config - Definitions of Solana’s proof of history.
- precompiles
- Solana precompiled programs.
- program
- Cross-program invocation.
- program_
error - The
ProgramError
type and related definitions. - program_
memory - Basic low-level memory operations.
- program_
option - A C representation of Rust’s
Option
, used across the FFI boundary for Solana program interfaces. - program_
pack - The
Pack
serialization trait. - program_
stubs - Implementations of syscalls used when
solana-program
is built for non-SBF targets. - program_
utils - Contains a single utility function for deserializing from bincode.
- pubkey
- Solana account addresses.
- quic
- Definitions related to Solana over QUIC.
- rent
- Configuration for network rent.
- rent_
collector - calculate and collect rent from Accounts
- rent_
debits - reserved_
account_ keys - Collection of reserved account keys that cannot be write-locked by transactions. New reserved account keys may be added as long as they specify a feature gate that transitions the key into read-only at an epoch boundary.
- reward_
info - reward_
type - Enumeration of reward types.
- rpc_
port - RPC default port numbers.
- sanitize
- A trait for sanitizing values and members of over the wire messages.
- sdk_ids
Deprecated - A vector of Solana SDK IDs.
- secp256k1_
instruction - Instructions for the secp256k1 native program.
- secp256k1_
program - The secp256k1 native program.
- secp256k1_
recover - Public key recovery from secp256k1 ECDSA signatures.
- serde_
varint - Integers that serialize to variable size.
- serialize_
utils - Helpers for reading and writing bytes.
- short_
vec - Compact serde-encoding of vectors with small length.
- shred_
version - Calculation of shred versions.
- signature
- Functionality for public and private keys.
- signer
- Abstractions and implementations for transaction signers.
- simple_
vote_ transaction_ checker - slot_
hashes - A type to hold data for the
SlotHashes
sysvar. - slot_
history - A type to hold data for the
SlotHistory
sysvar. - stake
- The stake native program.
- stake_
history - A type to hold data for the
StakeHistory
sysvar. - syscalls
- Declarations of Solana program syscalls.
- system_
instruction - Instructions and constructors for the system program.
- system_
program - The system native program.
- system_
transaction - The
system_transaction
module provides functionality for creating system transactions. - sysvar
- Access to special accounts with dynamically-updated data.
- timing
- The
timing
module provides std::time utility functions. - transaction
- Atomically-committed sequences of instructions.
- transaction_
context - Data shared between program runtime and built-in programs as well as SBF programs.
- transport
- Defines the
TransportError
type. - vote
- The vote native program.
Macros§
- custom_
heap_ default - Define the default global allocator.
- custom_
panic_ default - Define the default global panic handler.
- declare_
deprecated_ id - Same as
declare_id
except report that this id has been deprecated. - declare_
deprecated_ sysvar_ id - Same as
declare_sysvar_id
except that it reports that this ID has been deprecated. - declare_
id - Convenience macro to declare a static public key and functions to interact with it.
- declare_
sysvar_ id - Declares an ID that implements
SysvarId
. - impl_
sysvar_ get - Implements the
Sysvar::get
method for both SBF and host targets. - msg
- Print a message to the log.
- pubkey
- Convenience macro to define a static public key.
- pubkeys
- Convenience macro to define multiple static public keys.
- respan
- A proc-macro which respans the tokens in its first argument (a
Path
) to be resolved at the tokens of its second argument. For internal use only. - saturating_
add_ assign - Convenience macro for
AddAssign
with saturating arithmetic. Replace bystd::num::Saturating
once stable - unchecked_
div_ by_ const - Convenience macro for doing integer division where the operation’s safety can be checked at compile-time.