Crate solana_sdk

Source
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:

Re-exports§

pub extern crate bs58;
pub use signer::signers;
pub use solana_program::account_info;
pub use solana_program::clock;
pub use solana_program::fee_calculator;
pub use solana_program::native_token;
pub use solana_program::program_option;
pub use solana_program::program_pack;
pub use solana_program::rent;
pub use solana_program::serialize_utils;
pub use solana_program::stable_layout;
pub use solana_account as account;
pub use solana_bn254 as alt_bn128;
pub use solana_decode_error as decode_error;
pub use solana_derivation_path as derivation_path;
pub use solana_feature_set as feature_set;
pub use solana_inflation as inflation;
pub use solana_packet as packet;
pub use solana_program_memory as program_memory;
pub use solana_sanitize as sanitize;
pub use solana_secp256k1_recover as secp256k1_recover;
pub use solana_serde_varint as serde_varint;
pub use solana_short_vec as short_vec;

Modules§

account_utils
Useful extras for Account state.
address_lookup_table
The address lookup table program.
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.
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.
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
exit
Used by validators to run events on exit.
feature
Methods for working with Feature accounts.
fee
Fee structures.
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.
inner_instruction
instruction
keccak
Hashing with the keccak (SHA-3) hash function.
lamports
Re-exports the LamportsError type for backwards compatibility.
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 Instructions executed within a single transaction.
native_loader
The native loader native program.
net
nonce
Durable transaction nonces.
nonce_account
Functions related to nonce accounts.
offchain_message
Off-chain message container for storing non-transaction messages.
poh_config
Definitions of Solana’s proof of history.
precompiles
Solana precompiled programs.
program
Wrappers around solana-cpi with support for overwriting syscall stubs
program_error
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
quic
Definitions related to Solana over QUIC.
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.
sdk_idsDeprecated
A vector of Solana SDK IDs.
secp256k1_instruction
Instructions for the secp256k1 native program.
secp256k1_program
The secp256k1 native program.
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
slot_history
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.
saturating_add_assign
Convenience macro for AddAssign with saturating arithmetic. Replace by std::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.