Skip to content
Bahasa Indonesia
Address Lookup Tables, commonly referred to as “lookup tables” or “ALTs” for short, allow developers to create a collection of related addresses to efficiently load more addresses in a single transaction. Since each transaction on the Solana blockchain requires a listing of every address that is interacted with as part of the transaction, this listing would effectively be capped at 32 addresses per transaction. With the help of Address Lookup Tables, a transaction can raise that limit to 64 addresses.
Address Lookup Tables are supported by v0 transactions only. The v1 transaction format does not support them — its 4,096-byte size limit fits up to 64 addresses inline instead.

​Compressing onchain addresses

After all the desired addresses have been stored onchain in an Address Lookup Table, each address can be referenced inside a transaction by its 1-byte index within the table (instead of their full 32-byte address). This lookup method effectively “compresses” a 32-byte address into a 1-byte index value. A single lookup table can store up to 256 addresses, and a transaction may reference more than one table. That storage capacity is separate from how many addresses a transaction can actually use: the runtime loads at most 64 accounts per transaction regardless of how many addresses the tables it references hold.

​Versioned Transactions

To utilize an Address Lookup Table inside a transaction, developers must use v0 transactions that were introduced with the new Versioned Transaction format.

​How to create an address lookup table

Creating a new lookup table with the @solana/web3.js library is similar to the older legacy transactions, but with some differences.
@solana/web3.js 1.x is no longer actively maintainedIt receives critical fixes only. Use Kit for new code. To migrate existing code, follow the Kit upgrade guide, or the web3.js v3 migration guide to keep the class-based API.To run this code, install 1.x with npm install @solana/web3.js@1. A plain npm install @solana/web3.js installs v3, which this code doesn’t run on.
Using the @solana/web3.js library, you can use the createLookupTable function to construct the instruction needed to create a new lookup table, as well as determine its address:
NOTE: Address lookup tables can be created with either a v0 transaction or a legacy transaction. But the Solana runtime can only retrieve and handle the additional addresses within a lookup table while using v0 Versioned Transactions.

​Add addresses to a lookup table

Adding addresses to a lookup table is known as “extending”. Using the @solana/web3.js library, you can create a new extend instruction using the extendLookupTable method:
NOTE: Due to the same memory limits of legacy transactions, any transaction used to extend an Address Lookup Table is also limited in how many addresses can be added at a time. Because of this, you will need to use multiple transactions to extend any table with more addresses (~20) that can fit within a single transaction’s memory limits.
Once these addresses have been inserted into the table, and stored onchain, you will be able to utilize the Address Lookup Table in future transactions. Enabling up to 64 addresses in those future transactions.

​Fetch an Address Lookup Table

Similar to requesting another account (or PDA) from the cluster, you can fetch a complete Address Lookup Table with the getAddressLookupTable method:
Our lookupTableAccount variable will now be an AddressLookupTableAccount object which we can parse to read the listing of all the addresses stored on chain in the lookup table:

​How to use an address lookup table in a transaction

After you have created your lookup table, and stored your needed address on chain (via extending the lookup table), you can create a v0 transaction to utilize the onchain lookup capabilities. Just like older legacy transactions, you can create all the instructions your transaction will execute onchain. You can then provide an array of these instructions to the Message used in the v0 transaction.
NOTE: The instructions used inside a v0 transaction can be constructed using the same methods and functions used to create the instructions in the past. There is no required change to the instructions used involving an Address Lookup Table.
NOTE: When sending a VersionedTransaction to the cluster, it must be signed BEFORE calling the sendAndConfirmTransaction method. If you pass an array of Signer (like with legacy transactions) the method will trigger an error.

​More Resources