Lookup table and auxiliary program APIs
The lookup table and auxiliary program APIs build and decode instructions for transaction address compression, transaction notes, resource limits, program deployment, validator voting, and token metadata. They connect high-level actions to the account and data rules expected by their Solana programs. For the shared instruction-builder model, see Program instruction builders; for the main system and stake flows, see System and stake programs, and for token movement and mint actions, see Token programs.
API scope
These helpers serve two related jobs. They create instructions for transactions, and they turn on-chain account or instruction data back into useful Go values. Each helper keeps the program-specific account roles and data shape together so callers can use the same instruction in a transaction or in a decoder.
Program helper groups
The APIs cover distinct parts of a transaction or validator workflow:
| Helper group | System goal | Main result |
|---|---|---|
| Address lookup table | Store reusable account addresses outside the static message key list | Create, change, retire, close, fetch, and resolve table-backed addresses |
| Memo | Attach a human-readable note to a transaction | A UTF-8 message with optional signer accounts |
| Compute budget | Set transaction resource and priority limits | Compute units, heap size, loaded account data, or priority price |
| BPF loader | Publish executable program data | A staged set of transactions that creates, writes, and finalizes a program buffer |
| Vote | Operate validator vote accounts | Initialization, voting, authority changes, state updates, withdrawals, and reward settings |
| Token registry | Publish and query token display metadata | Token name, symbol, logo, website, and registry account data |
References: programs/…/instructions.go• L28-43 programs/…/Create.go• L28-35 programs/…/instruction.go• L45-65 programs/…/loader.go• L100-225 programs/…/instructions.go• L54-77 programs/…/instruction.go• L59-76
Address lookup tables
An address lookup table is an on-chain list of public keys that a versioned message can reference by index. The API manages the table account and can load all referenced tables from RPC before resolving the message into its complete account-key set.
Table lifecycle
The lifecycle starts with an authority-controlled table and ends either with an immutable table that remains available or with a deactivated table whose rent can be reclaimed. A table can hold up to 256 addresses, which makes it useful for reusing a large set of accounts across versioned transactions.
flowchart LR
A[Derive table address] --> B[Create table]
B --> C[Extend with addresses]
C --> D{Need more changes?}
D -->|Yes| C
D -->|No| E[Freeze for immutable use]
D -->|Retire| F[Deactivate table]
F --> G[Wait for cooldown]
G --> H[Close and send rent to recipient]
The create helper derives the table address from the authority and a recent slot. Extension uses the current authority and can include a payer when the table needs more rent. The system program is included with that payer path. Freeze removes further modification rights. Deactivation starts the close path, and close sends the reclaimed lamports to a recipient.
References: programs/…/CreateLookupTable.go• L14-33 programs/…/CreateLookupTable.go• L174-209 programs/…/ExtendLookupTable.go• L14-30 programs/…/ExtendLookupTable.go• L56-63 programs/…/FreezeLookupTable.go• L13-21 programs/…/DeactivateLookupTable.go• L13-21 programs/…/CloseLookupTable.go• L13-24
Table state and RPC resolution
Table state records whether the table is active, who controls it, when it was last extended, and the ordered address list. GetAddressLookupTable and its option-aware form fetch one table account and decode that state. ResolveMessageLookupsFromRPC fetches every table named by a versioned message in one RPC request, rejects missing or incomplete results, and then resolves the message keys.
sequenceDiagram
participant C as Caller
participant R as RPC client
participant M as Versioned message
C->>R: Fetch referenced table accounts
R-->>C: Table account data
C->>C: Decode table states
C->>M: Set address tables
C->>M: Resolve lookups
M-->>C: Static and table-backed account keys
The resolution helper is a no-op for legacy messages, messages without lookups, and messages that already have resolved lookups. It does not call RPC or mutate account keys in those cases. For a versioned message with lookups, writable addresses are added before readonly addresses in the resolved key set. A missing table or truncated table data is an error because silently omitting addresses would leave instruction account indexes unsafe to use.
References: programs/…/address-lookup.go• L19-58 programs/…/address-lookup.go• L60-182 programs/…/resolve.go• L26-47 programs/…/resolve.go• L48-119 programs/…/resolve_test.go• L88-183 programs/…/resolve_test.go• L185-197
Transaction notes and resource controls
Memo and compute-budget helpers change transaction meaning without managing a user-owned data account. A memo records context for readers, while compute-budget instructions tell the runtime how much work or account data the transaction may use and what priority price it offers.
Memo records
The memo API adds a non-empty UTF-8 message to a transaction. The message can be unsigned, or one or more signer accounts can be attached when the application needs approvals that are visible in the transaction.
The builder keeps the note separate from the optional signer set. Validation catches an absent message and invalid UTF-8 before the instruction is built.
References: programs/…/Create.go• L28-35 programs/…/Create.go• L38-63 programs/…/Create.go• L73-103 programs/…/Create.go• L135-149
Compute budget controls
Compute-budget instructions set transaction-wide execution limits and priority signals. They do not name application accounts, so they can be placed alongside the application instructions whose resource needs they describe. In v1 (SIMD-0385) transactions, these instructions are no-ops; callers use solana.TransactionConfig for those settings instead.
| Control | Purpose | Important boundary |
|---|---|---|
| Compute unit limit | Cap the units the transaction may consume | The helper accepts a non-zero value up to 1,400,000 units |
| Compute unit price | Offer a priority fee in micro-lamports per unit | The helper requires a non-zero price |
| Heap frame | Request a larger program heap for the transaction | The request is non-zero and no larger than 256 KiB |
| Loaded account data size | Cap the account data the transaction may load | The helper requires a non-zero byte limit |
| Deprecated request-units form | Represent the older combined resource request | It remains in the instruction set for compatibility but is marked deprecated |
These settings describe transaction-wide limits. The heap request also applies to programs reached through cross-program calls, so a caller must treat it as a transaction setting rather than a setting for one instruction.
References: programs/…/instruction.go• L45-65 programs/…/SetComputeUnitLimit.go• L26-79 programs/…/SetComputeUnitPrice.go• L26-73 programs/…/RequestHeapFrame.go• L26-79 programs/…/SetLoadedAccountsDataSizeLimit.go• L26-73
BPF program deployment
The BPF loader helper turns program bytes into a staged deployment plan. It prepares an executable buffer account, splits the program data into transaction-sized writes, and returns a final transaction that marks the loaded program ready for execution.
Deployment stages
Deployment is split so the program data can fit within the network packet limit and so account setup can happen before writes begin. The returned builders let a caller submit the stages in order and account for any extra lamports needed to make the buffer rent-exempt.
flowchart LR
A[Program bytes and buffer account] --> B[Initial setup]
B --> C[Chunked buffer writes]
C --> D[Final loader instruction]
D --> E[Executable program account]
The setup stage creates or completes the buffer account and assigns it to the selected loader. The write stage uses chunks sized from the serialized transaction space. The final stage changes the buffer from loaded data to an executable program. Existing buffers are checked for ownership, executable state, size, and unexpected balance before the plan is returned.
References: programs/…/loader.go• L12-35 programs/…/loader.go• L37-98 programs/…/loader.go• L100-199 programs/…/loader.go• L201-225
Validator voting
The vote package models the validator-facing control plane for vote accounts. It covers account creation, vote submission, vote-state updates, authority management, withdrawals, and the commission settings that govern reward collection.
Vote account lifecycle
Initialization binds a vote account to a validator node identity, an authorized voter, an authorized withdrawer, and an initial commission. The newer initialization form also carries the voter’s BLS public key and proof of possession plus separate commission rates for inflation rewards and block revenue. Later instructions can replace voting or withdrawal authority, including checked, seed-based, and BLS-aware forms, while withdrawal moves lamports to a recipient under the withdraw authority.
The account roles matter to the workflow: the vote account is writable, the relevant authority must sign, and system clock or other vote sysvars supply the chain state required by the program. The builders expose those roles so a transaction can preserve the program’s expected account order.
References: programs/…/InitializeAccount.go• L27-43 programs/…/InitializeAccount.go• L52-70 programs/…/Authorize.go• L28-40 programs/…/types.go• L113-176 programs/…/types.go• L186-292 programs/…/Withdraw.go• L28-41
Vote submission and state updates
Voting records slots with a bank hash and an optional timestamp. State-update instructions carry the validator’s vote tower, which is the ordered set of lockouts and its optional root and timestamp. The package also supports compact and tower-sync forms for newer vote-state exchange paths, with tower sync carrying a block identifier.
flowchart TD
A[Validator observes confirmed slots] --> B[Build vote or state update]
B --> C[Vote authority signs]
C --> D[Vote program updates vote account]
D --> E[Cluster uses vote state for consensus]
The vote instruction uses the slot-hashes and clock sysvars. State-update instructions instead use the vote account and vote authority directly. Their shared purpose is to move signed validator observations into the vote account state that the cluster uses. Decoding rejects a declared lockout count that cannot fit in the remaining data, which prevents malformed input from causing an unsafe allocation.
References: programs/…/Vote.go• L28-70 programs/…/Vote.go• L73-111 programs/…/UpdateVoteState.go• L13-38 programs/…/types.go• L294-476 programs/…/vote_state_update_count_test.go• L11-21 programs/…/instructions.go• L54-77
Commission and reward controls
Commission helpers let an authorized withdrawer change the vote account commission and, for newer reward paths, choose the collector and commission rate for a reward bucket. The package names the supported buckets as inflation rewards and block revenue, which keeps reward policy distinct from vote submission.
References: programs/…/UpdateCommission.go• L13-38 programs/…/UpdateCommissionCollector.go• L14-42 programs/…/UpdateCommissionCollector.go• L100-128 programs/…/types.go• L178-184
Token registry metadata
The token registry helper publishes and reads display metadata for a token mint. It complements the token program APIs by describing how a token should be presented rather than moving balances or changing mint authority.
Metadata registration
Registration associates a mint with a metadata account, an owner, and fixed-size display fields for a logo, name, symbol, and website. The API converts short strings into the fixed-width values used by the registry and converts those values back to readable strings when decoding account data.
References: programs/…/instruction.go• L59-76 programs/…/instruction.go• L125-149 programs/…/types.go• L27-39 programs/…/types.go• L51-121
Metadata lookup
The registry supports two read patterns through RPC: find metadata for one mint, or fetch all accounts with the registry’s token-metadata size. A missing mint returns the RPC not-found result, while malformed account data returns a decode error instead of partial metadata.
The registry program address follows the selected network and can be explicitly overridden. This makes the same lookup API usable across deployments, but the caller must select the program address that matches the chain being queried.
References: programs/…/rpc.go• L28-58 programs/…/rpc.go• L61-89 programs/…/program.go• L26-47 programs/…/types.go• L41-49
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the address-table state format, the table address order, and message lookup resolution aligned. A mismatch can produce valid-looking messages with wrong account indexes.
- Preserve the lifecycle link between table deactivation and close eligibility. Changes to authority or status rules affect both management instructions and RPC resolution.
- Keep extension account roles aligned. A payer path needs the system program, while the authority and table remain the core roles.
- Bound declared collection counts before allocation when decoding address or vote-state data. The wire count and the available payload must remain consistent.
- Keep compute-budget limits consistent with the runtime rules. A new resource control must remain transaction-wide and must use the same unit scale in callers and encoded data. Keep the v1 (SIMD-0385) guidance aligned with
solana.TransactionConfig, because compute-budget instructions have no effect in that transaction mode. - Keep BPF deployment stages ordered and packet-sized. Changes to buffer ownership or rent checks can invalidate existing deployment buffers.
- Keep vote instruction variants and vote-state data aligned with the account roles and authority model. Changes to BLS fields, commission buckets, or new state forms must preserve their wire data and may also require compact or tower-sync support.
- Keep token registry network selection aligned with the RPC endpoint. A correct mint query against the wrong registry program looks like a missing token.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A referenced lookup table is missing or its data is truncated | Message lookup resolution fails, so instruction account indexes cannot be trusted | Use the RPC resolver and handle its fetch or decode error before resolving instructions |
| A table is changed without the current authority or after it is frozen | The management transaction is rejected by the address lookup table program | Track the table authority and lifecycle state before choosing a management instruction |
| An extension declares more addresses than its payload contains | Instruction decoding fails instead of producing a partial or unsafe address list | Reject the count against the remaining bytes before allocating the address slice |
| Memo data is empty or not valid UTF-8 | Memo instruction validation fails | Validate the message before building the instruction |
| A compute-budget instruction is used in a v1 (SIMD-0385) transaction | The requested compute setting has no effect | Put the setting in solana.TransactionConfig |
| A compute limit or heap request is zero or above its supported bound | Compute-budget validation fails before transaction submission | Use the helper limits and choose values in the expected units |
| A deployment buffer has the wrong owner, is executable, is too small, or has an unexpected balance | The deployment plan cannot safely initialize or reuse the buffer | Inspect the returned error and use a fresh or correctly sized buffer |
| A vote instruction has missing accounts or an unsigned authority | Vote initialization, voting, or state change is rejected | Use the builder’s account roles and sign with the required authority |
| A vote-state update declares more lockouts than its payload contains | Vote-state decoding fails instead of allocating from an untrusted count | Validate the count against the remaining bytes before building the lockout list |
| A mint is queried against the wrong registry program or has no entry | The lookup returns no metadata or an RPC not-found error | Select the matching network or explicit registry program before querying |
Key files
| File | Why to read it |
|---|---|
| programs/…/resolve.go | Shows the end-to-end RPC fetch and versioned-message lookup resolution flow |
| programs/…/resolve_test.go | Shows no-op behavior, canonical key ordering, missing-table errors, argument checks, and not-found handling |
| programs/…/address-lookup.go | Defines decoded table state and single-table retrieval |
| programs/…/CreateLookupTable.go | Shows table address derivation and creation inputs |
| programs/…/ExtendLookupTable.go | Shows how an authority grows a table, when a payer is needed, and how address data is decoded safely |
| programs/…/extend_count_test.go | Shows the guard for oversized address counts in decoded input |
| programs/…/Create.go | Shows the transaction note and optional signer model |
| programs/…/instruction.go | Lists the resource and priority controls exposed by the helper |
| programs/…/loader.go | Shows the staged program deployment plan |
| programs/…/instructions.go | Shows the full vote instruction family |
| programs/…/types.go | Defines vote initialization variants, authorization data, commission buckets, and vote-state update concepts |
| programs/…/Vote.go | Shows signed vote submission and its sysvar inputs |
| programs/…/UpdateVoteState.go | Shows signed vote-tower state updates |
| programs/…/vote_state_update_count_test.go | Shows the guard for oversized lockout counts in decoded vote state |
| programs/…/instruction.go | Shows token metadata registration and its account roles |
| programs/…/rpc.go | Shows per-mint and full-registry metadata queries |
| programs/…/program.go | Shows network-based and explicit registry program selection |