1

Usually the flow is

  1. createLookupTable
  2. Use that lookup table immediately after whilst having access to the pubkey.

But what if I want to prepare an ALT from early on and use that in the future? Are there any smart ways of easily deriving the pubkey from an earlier lookupTable? I.e. as easy as deriving the pubkey from the ALT authority pubkey?

1 Answer 1

2

To make it easier to locate the lookup table in the future, you may need to store its address in a different account (using a PDA), as one of the seeds used to derive the address of the lookup table is a recentSlot from when it was created.

https://github.com/solana-labs/solana-web3.js/blob/master/packages/library-legacy/src/programs/address-lookup-table/index.ts#L273

const [lookupTableAddress, bumpSeed] = PublicKey.findProgramAddressSync(
  [params.authority.toBuffer(), toBufferLE(BigInt(params.recentSlot), 8)],
  this.programId,
);
2
  • So if I only wanted one lookupTable for a program I could have an instruction that initialises a pda: ["SEED_ALT"], which would store the lookupTableAddress?
    – Burger Bob
    Commented Mar 28, 2023 at 7:28
  • Yea, that's what I was thinking. There may be better ways to approach it that others have found though. Mainly unsure how you would get the "recentSlot" used to derived a specific LUT after it's been created.
    – john
    Commented Mar 28, 2023 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.