pub fn create_program_address(
seeds: &[&[u8]],
program_id: &Address,
) -> Result<Address, ProgramError>Expand description
PDA (Program Derived Address) derivation and verification functions. Create a valid program derived address without searching for a bump seed.
Use this when your instruction already carries a bump and you want to verify exact PDA derivation against user-provided seeds.
/// Seed-based APIs require deterministic seed ordering.Program IDs must stay consistent across derivation and verification.
When a bump is required, prefer canonical bump derivation.
Use explicit bumps when needed.
ยงExamples
use pina::create_program_address;
use pina::try_find_program_address;
let program_id = pina::address!("11111111111111111111111111111111");
let seeds: &[&[u8]] = &[b"vault"];
// First derive the canonical PDA and bump:
let (pda, bump) =
try_find_program_address(seeds, &program_id).unwrap_or_else(|| panic!("no valid PDA"));
// Then recreate the address using the known bump:
let bump_seed = [bump];
let recreated = create_program_address(&[b"vault", &bump_seed], &program_id)
.unwrap_or_else(|e| panic!("failed to recreate: {e:?}"));
assert_eq!(pda, recreated);