Address lookup table program
The address lookup table program manages on-chain lists of public keys that version 0 (v0) messages can reference by small indexes. It lets a transaction move eligible account addresses out of its static key list while preserving their writable or read-only role. See Programs and instructions for the wider program API and Native program APIs for related native programs.
System role
v0 message lookups
The v0 message format stores a table address plus separate writable and read-only index lists. During compilation, the message checks the supplied table accounts and replaces eligible non-signer account keys with these indexes. During resolution, it loads the addresses in index order and joins them with the static keys. References: src/…/v0.ts• L24-42, src/…/v0.ts• L79-113, src/…/v0.ts• L142-221, src/…/compiled-keys.ts• L106-137
The lookup table must be available when the message is compiled or when its account keys are resolved. A missing table or an index outside the table address list prevents key resolution. The table does not provide signatures; signer keys remain in the message's static account keys. References: src/…/v0.ts• L79-113, src/…/v0.ts• L150-180, src/…/compiled-keys.ts• L109-120
Message integration
Address selection
Message compilation first gathers the accounts required by the transaction instructions. It then compares those accounts with each supplied table and moves matching eligible accounts into writable or read-only lookup entries. A table is included only when it contributes at least one account. References: src/…/v0.ts• L188-221, src/…/compiled-keys.ts• L25-57, src/…/compiled-keys.ts• L106-163
Address resolution
When a v0 message is read, its table lookups contain indexes rather than public keys. Resolution finds the matching AddressLookupTableAccount, reads each writable and read-only index from its ordered address list, and joins those results with the static account keys used by the message. References: src/…/v0.ts• L79-113, src/…/v0.ts• L142-185, src/…/account-keys.ts• L8-42
The version selector treats a message without a version prefix as legacy and supports version 0 for lookup-table messages. Other message versions are rejected by this client. References: src/…/versioned.ts• L5-35, src/…/v0.ts• L427-511
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the ordered address list contract aligned with v0 writable and read-only index resolution. A change to list order or index width can invalidate existing messages.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A v0 message is resolved without its referenced table account | Account-key resolution fails before instruction execution | Load each referenced AddressLookupTableAccount and pass it to message key resolution. |
| A lookup index is not present in the table address list | The message cannot resolve the referenced account | Use the table state that matches the message and keep its address order unchanged. |
Key files
| File | Why to read it |
|---|---|
| src/…/v0.ts | Shows how v0 messages compile, serialize, and resolve table-backed account keys. |
| src/…/compiled-keys.ts | Explains which instruction accounts can move from static keys into lookup tables. |
| src/…/account-keys.ts | Shows how static keys and resolved lookup keys form one message account-key space. |
| src/…/versioned.ts | Defines the boundary between legacy messages and supported versioned messages. |