Skip to main content

derive_program_address

Function derive_program_address 

Source
pub fn derive_program_address(
    seed: &[u8; 32],
    program_id: &Pubkey,
    is_ephemeral: bool,
) -> Result<Pubkey, Box<dyn Error>>
Expand description

Derives a program address from seed components and program ID

This function creates a deterministic address by hashing the program ID, an ephemeral account flag, and the provided seed components.

§Arguments

  • seeds - Array of byte slices to use as seed components
  • program_id - The program ID pubkey

§Returns

A Result containing a tuple of (derived_pubkey, bump_seed) The bump_seed is always 0 in this implementation as we don’t use bump seed derivation

§Errors

Returns an error if the program_id cannot be converted to bytes