pub struct Pubkey(/* private fields */);Expand description
The address of a Solana account.
Some account addresses are ed25519 public keys, with corresponding secret
keys that are managed off-chain. Often, though, account addresses do not
have corresponding secret keys — as with program derived
addresses — or the secret key is not relevant to the operation
of a program, and may have even been disposed of. As running Solana programs
can not safely create or manage secret keys, the full Keypair is not
defined in solana-program but in solana-sdk.
Implementations§
Source§impl Address
impl Address
pub const fn new_from_array(address_array: [u8; 32]) -> Address
Sourcepub const fn from_str_const(s: &str) -> Address
pub const fn from_str_const(s: &str) -> Address
Decode a string into an Address, usable in a const context
Sourcepub fn new_unique() -> Address
pub fn new_unique() -> Address
Create a unique Address for tests and benchmarks.
pub const fn to_bytes(&self) -> [u8; 32]
Sourcepub fn is_on_curve(&self) -> bool
pub fn is_on_curve(&self) -> bool
Checks whether the given address lies on the Ed25519 curve.
On-curve addresses correspond to valid Ed25519 public keys (and therefore can have associated private keys). Off-curve addresses are typically used for program-derived addresses (PDAs).
Trait Implementations§
Source§impl BorshDeserialize for Address
impl BorshDeserialize for Address
fn deserialize_reader<__R>(reader: &mut __R) -> Result<Address, Error>where
__R: Read,
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSchema for Address
impl BorshSchema for Address
Source§fn declaration() -> String
fn declaration() -> String
Source§fn add_definitions_recursively(definitions: &mut BTreeMap<String, Definition>)
fn add_definitions_recursively(definitions: &mut BTreeMap<String, Definition>)
Source§impl BorshSerialize for Address
impl BorshSerialize for Address
impl Copy for Address
impl Eq for Address
Source§impl From<Address> for ZeroCopyPubkey
impl From<Address> for ZeroCopyPubkey
Source§impl From<ZeroCopyPubkey> for Pubkey
impl From<ZeroCopyPubkey> for Pubkey
Source§fn from(value: ZeroCopyPubkey) -> Self
fn from(value: ZeroCopyPubkey) -> Self
Source§impl Hash for Address
Custom impl of Hash for Address.
impl Hash for Address
Custom impl of Hash for Address.
This allows us to skip hashing the length of the address which is always the same anyway.