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 solana_commitment_config as commitment_config;full
pub use solana_program::account_info;
pub use solana_program::big_mod_exp;
pub use solana_program::blake3;
pub use solana_program::clock;
pub use solana_program::epoch_rewards;
pub use solana_program::fee_calculator;
pub use solana_program::keccak;
pub use solana_program::loader_instruction;
pub use solana_program::message;
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_program::vote;
pub use solana_genesis_config as genesis_config;full
pub use solana_hard_forks as hard_forks;full
pub use solana_rent_collector as rent_collector;full
pub use solana_shred_version as shred_version;full
pub use solana_account as account;
pub use solana_bn254 as alt_bn128;
pub use solana_client_traits as client;full
pub use solana_compute_budget_interface as compute_budget;full
pub use solana_decode_error as decode_error;
pub use solana_derivation_path as derivation_path;
pub use solana_ed25519_program as ed25519_instruction;full
pub use solana_epoch_info as epoch_info;
pub use solana_epoch_rewards_hasher as epoch_rewards_hasher;
pub use solana_feature_set as feature_set;
pub use solana_fee_structure as fee;
pub use solana_inflation as inflation;
pub use solana_nonce_account as nonce_account;
pub use solana_offchain_message as offchain_message;full
pub use solana_packet as packet;
pub use solana_poh_config as poh_config;
pub use solana_program_memory as program_memory;
pub use solana_quic_definitions as quic;full
pub use solana_rent_debits as rent_debits;
pub use solana_reserved_account_keys as reserved_account_keys;full
pub use solana_sanitize as sanitize;
pub use solana_secp256k1_program as secp256k1_instruction;full
pub use solana_secp256k1_recover as secp256k1_recover;
pub use solana_serde as deserialize_utils;
pub use solana_serde_varint as serde_varint;
pub use solana_short_vec as short_vec;
pub use solana_system_transaction as system_transaction;full
pub use solana_time_utils as timing;
pub use solana_transaction_context as transaction_context;
pub use solana_validator_exit as exit;

Modules§

account_utils
Useful extras for Account state.
address_lookup_table
borshborsh
Utilities for the borsh serialization format.
borsh0_10borsh
Utilities for the borsh serialization format, version 0.10.
borsh1borsh
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
config
The config native program.
debug_account_data
Debug-formatting of account data.
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_schedule
feature
hash
Hashing with the SHA-256 hash function, and a general Hash type.
incinerator
inner_instruction
instruction
lamports
Re-exports the LamportsError type for backwards compatibility.
loader_upgradeable_instruction
loader_v4
loader_v4_instruction
logprogram
native_loader
The native loader native program.
net
nonce
precompilesfull
Solana precompiled programs.
program
Wrappers around solana-cpi with support for overwriting syscall stubs
program_error
program_stubsNon-target_os="solana"
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
reward_infoDeprecated
reward_typeDeprecated
rpc_port
RPC default port numbers.
sdk_idsDeprecated
A vector of Solana SDK IDs.
secp256k1_program
The secp256k1 native program.
signaturefull
Functionality for public and private keys.
signerfull
signersfull
simple_vote_transaction_checkerfull
slot_hashes
slot_history
stake
stake_history
syscalls
Declarations of Solana program syscalls.
system_instruction
system_program
The system native program.
sysvar
transactionfull
transportfull
Defines the TransportError type.

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.