Skip to content

About

create ALT for solana transactions in rust

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solana Address Lookup Table (ALT) Creator

A lightweight Rust utility for creating and managing Solana Address Lookup Tables (ALTs) on Mainnet and Devnet. This tool streamlines the process of initializing lookup tables and populating them with common program IDs for optimized transaction serialization.

Features

  • Simple API – Single create_atl_address function handles the entire ALT lifecycle
  • Automatic Verification – Confirms all addresses were added successfully
  • Devnet & Mainnet Support – Works with any Solana network via custom RPC endpoints
  • Production-Ready – Includes proper error handling and transaction confirmation

Table of Contents

Prerequisites

  • Rust & Cargo – Install from rustup.rs
  • Funded Solana Wallet – With SOL for transaction fees on your target network
  • RPC Endpoint – Devnet, Testnet, or Mainnet URL

Setup

1. Clone the Repository

git clone https://github.com/DevWonder01/solana-address-lookup-table-rs.git
cd solana-address-lookup-table-rs

2. Configure Environment Variables

Set the following environment variables before running:

# Your Solana wallet private key (Base58 format)
export DEV_B58="<YOUR_BASE58_PRIVATE_KEY_HERE>"

# RPC endpoint URL (Devnet recommended for testing)
export RPC_URL="https://api.devnet.solana.com"

Tip: Use Devnet for testing to avoid mainnet fees. Switch to https://api.mainnet-beta.solana.com for production.

3. Verify Dependencies

Ensure your Cargo.toml has compatible versions. We recommend:

solana-sdk = "2.0.0"
solana-client = "2.0.0"
solana-program = "2.0.0"

All Solana crates should use the same version to avoid conflicts.

Usage

Running the Utility

cargo run

Output

The program will output the public key of your newly created lookup table:

Lookup Table Address: 9B5X4ARiMZZoNXHzLuGMMHqEb9MysKn5nLPaKXVpp1Gm

Use this address in your application to build versioned transactions with optimized serialization.

How It Works

The create_atl_address function executes three sequential steps:

1. Creation

Sends a transaction with a create_lookup_table instruction to initialize a new, empty lookup table on the Solana network.

2. Extension

After confirming table creation, sends a second transaction with an extend_lookup_table instruction. This populates the table with a predefined set of common Solana program IDs.

3. Verification

Fetches and deserializes the lookup table from the network to confirm all addresses were successfully added. Returns the lookup table's public key upon success.

Configuration

Environment Variables

Variable Description Example
DEV_B58 Base58-encoded private key of your wallet <your-key-here>
RPC_URL Solana RPC endpoint https://api.devnet.solana.com

Network Options

Devnet (Recommended for Testing)

export RPC_URL="https://api.devnet.solana.com"

Testnet

export RPC_URL="https://api.testnet.solana.com"

Mainnet Beta (Production)

export RPC_URL="https://api.mainnet-beta.solana.com"

Troubleshooting

Insufficient Funds

Ensure your wallet has SOL to cover transaction fees:

  • Devnet: Request airdrop via solana airdrop 2
  • Mainnet: Transfer SOL from another wallet

RPC Connection Issues

  • Verify your RPC_URL is correct and accessible
  • Try switching RPC endpoints if one is experiencing downtime

Version Mismatches

Ensure all Solana dependencies in Cargo.toml use the same version number.

License

[Add your license here]

Contributing

Contributions are welcome! Feel free to submit issues and pull requests.


Built for the Solana ecosystem

About

create ALT for solana transactions in rust

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages