Given this a mock versioned message

   addressTableLookups: [...],
   compiledInstructions: [...]

I try with versioned transaction without ATL this code below ran successfully.

   const messageV0 = new MessageV0(message);
   console.log('decompiled', TransactionMessage.decompile(messageV0));

But when the transaction does have ATL includes in addressTableLookups the decompile throw an error

index.js:12623 Uncaught (in promise) Error: Failed to get account keys because address table lookups were not resolved
    at MessageV0.getAccountKeys (index.js:12623:13)
    at TransactionMessage.decompile (index.js:13492:33)

I think because the decompile the second argument in decompile method but how to convert addressTableLookups in MessageV0 object to the ATL when decompiling

  • Transaction without ATL mean the addressTableLookups is empty
    – Long
    Commented Apr 30 at 10:11

1 Answer 1


This is because the data in the referenced address table lookups are required to decompile a message. The message only contains the index within the lookup, so you need to fetch the lookup table from on chain to resolve that to the actual addresses.

decompile takes a second argument for this: https://solana-labs.github.io/solana-web3.js/types/DecompileArgs.html

You can provide an arugment with one of these two shapes:

  accountKeysFromLookups: {
    readonly: PublicKey[],
    writable: PublicKey[], // you need to populate these with the addresses in your lookup tables

// or

  addressLookupTableAccounts: AddressLookupTableAccount[];

AddressLookupTableAccount is a class in web3js: https://solana-labs.github.io/solana-web3.js/classes/AddressLookupTableAccount.html

One way to fetch it is with connection.getAddressLookupTable(): https://solana-labs.github.io/solana-web3.js/classes/Connection.html#getAddressLookupTable

Note that the input message (the first argument to decompile) has an addressLookupTables that you can use to find all the address lookup tables that you need to fetch.

Note that in the new version of web3js (currently in tech preview) there is a function decodeTransactionMessage that will fetch and resolve the address lookup tables for you: https://github.com/solana-labs/solana-web3.js/blob/3ae70f0f8ecac462847af6d2170945c118d4f0d6/packages/library/src/decode-transaction-message.ts#L45

  • Thanks for your answer
    – Long
    Commented Apr 30 at 13:29
  • Here is my code. But the connection always return null. I used QuickNode RPC.. Am I wrong at somethingng?
    – Long
    Commented May 1 at 4:31
  • The account that I received from compile version transaction is look like this 1111111111111111111G9KJrgUXSBpnzqR3MH
    – Long
    Commented May 1 at 4:39
  • You don't need to do any of that. The addressLookupTables returns an array of objects with the shape: {accountKey: PublicKey; readonlyIndexes: number[]; writableIndexes: number[];}. You just need to look up the accountKey.
    – Callum M
    Commented May 1 at 8:30

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.