> ## Documentation Index
> Fetch the complete documentation index at: https://docs.phantom.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Solana Versioned Transactions

> Understand how Phantom supports Solana versioned transactions and Address Lookup Tables for larger transactions.

Phantom supports [Versioned Transactions](https://docs.solana.com/developing/versioned-transactions) and [Legacy Transactions](../solana/sending-a-transaction). Versioned Transactions and Address Lookup Tables (LUTs) were introduced by Solana in an effort to improve the developer and end-user experience. The proposed changes are as follows:

* Introduce a program which manages on-chain address lookup tables
* Add a new transaction format which can make use of the above on-chain address lookup tables

Why do we need the above?

Legacy transactions have a major issue: Maximum allowed size of 1232 bytes, and hence the number of accounts that can fit in an atomic transaction: 35 addresses.

<img src="https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/developer-powertools/images/legacy-transaction.avif?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=b24196de9dde25f1940842731e6863b7" alt="Legacy Transaction Avi" width="768" height="387" data-path="developer-powertools/images/legacy-transaction.avif" />

This is problematic as developers are limited with this threshold and are unable to include >35 signature-free account / program addresses in a single transaction. This is where Address LUTs come into the picture.

## Address LUTs

The idea behind Address LUTs is to store account addresses in array-like data structures on-chain. Once accounts are stored in this table, the address of the table can be referenced in a transaction message using 1-byte u8 indices.

<img src="https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/developer-powertools/images/address-lookup-tables.avif?fit=max&auto=format&n=fkWrmnMWhjoXSGZ9&q=85&s=ab524750ca18193b409fee569127d613" alt="Address Lookup Tables Avi" width="768" height="560" data-path="developer-powertools/images/address-lookup-tables.avif" />

This opens up space as addresses need not be stored inside transaction messages, but only be referenced. This allows 2^8=256 accounts to be included in 1 tx, as accounts are referenced using u8 indices.

## RPC changes

Transaction responses will require a new version field: `maxSupportedTransactionVersion` to indicate to clients which transaction structure needs to be followed for deserialisation.

The following methods need to be updated to avoid errors:

* `getTransaction`
* `getBlock`

The following parameter needs to be added to the requests:

`maxSupportedTransactionVersion: 0`

If `maxSupportedTransactionVersion` is not explicitly added to the request, the transaction version will fallback to `legacy`. Any block that contains a versioned transaction will return with an error by the client in the case of a legacy transaction.

You can set this via JSON formatted requests to the RPC endpoint like below:

```bash theme={null}
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d \
'{"jsonrpc": "2.0", "id":1, "method": "getBlock", "params": [430, {
  "encoding":"json",
  "maxSupportedTransactionVersion":0,
  "transactionDetails":"full",
  "rewards":false
}]}'
```

You can also do the same using the [@solana/web3.js](https://github.com/solana-foundation/solana-web3.js) library.

```javascript theme={null}
// connect to the `devnet` cluster and get the current `slot`
const connection = new web3.Connection(web3.clusterApiUrl("devnet"));
const slot = await connection.getSlot();

// get the latest block (allowing for v0 transactions)
const block = await connection.getBlock(slot, {
  maxSupportedTransactionVersion: 0,
});

// get a specific transaction (allowing for v0 transactions)
const getTx = await connection.getTransaction(
  "3jpoANiFeVGisWRY5UP648xRXs3iQasCHABPWRWnoEjeA93nc79WrnGgpgazjq4K9m8g2NJoyKoWBV1Kx5VmtwHQ",
  {
    maxSupportedTransactionVersion: 0,
  },
);
```

For details on how to build and send Versioned Transactions and LUTs, see [Send a versioned transaction](../solana/sending-a-transaction-1).

## Further reading

* [How to create a versioned transaction - Solana Docs](https://beta.docs.solana.com/developing/versioned-transactions#how-create-a-versioned-transaction)
* [How to create an address lookup table - Solana Docs](https://beta.docs.solana.com/developing/lookup-tables#how-to-create-an-address-lookup-table)
* [Versioned Transactions - Anvit Hashnode](https://anvit.hashnode.dev/versioned-transactions)
