Agent skill

Solana Tx Building

by agiprolabs in agiprolabs/claude-trading-skills

Solana transaction construction including instruction building, account resolution, compute budget, priority fees, and versioned transactions

MITAuto-check passed

Install Solana Tx Building

skills CLI
$ npx skills add agiprolabs/claude-trading-skills --skill solana-tx-building -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install agiprolabs/claude-trading-skills solana-tx-building --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/agiprolabs/claude-trading-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/solana-tx-building .claude/skills/solana-tx-building && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
solana-tx-building
GitHub stars
410
Token cost
~3.1k tokens
SKILL.md length
970 words
Files
5 (incl. scripts, references)
Skills in repo
68
Repo updated
First seen
Licence
MIT

At a glance

Solana transaction construction including instruction building, account resolution, compute budget, priority fees, and versioned transactions

  • Works in 4 steps: SOL Transfer → SPL Token Transfer → Create Associated Token Account (ATA) → …
  • SKILL.md covers Transaction Anatomy, Legacy vs Versioned Transactions, Compute Budget and Common Transaction Patterns, plus 6 more sections
  • Runs Python scripts from its folder

What it does

Solana Tx Building is an agent skill from agiprolabs/claude-trading-skills. Solana transaction construction including instruction building, account resolution, compute budget, priority fees, and versioned transactions

Its SKILL.md is about 3.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including scripts and reference files (for example `references/common_instructions.md`, `references/transaction_anatomy.md` and `scripts/build_transfer.py`).

It works with Solana. The repository describes itself as: 68 trading, DeFi, and quantitative finance Agent Skills. Works with Claude Code, Cursor, Codex, Gemini CLI, and 30+ other tools. The licence is MIT.

Example prompts

  • “/solana-tx-building”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. SOL Transfer
  2. SPL Token Transfer
  3. Create Associated Token Account (ATA)
  4. Jupiter Swap

What it can do on your machine

Read from SKILL.md and the folder at commit 981e1d7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Solana Tx Building loads about 3.1k tokens when it runs, and up to ~6.8k if it reads all its reference files. Until then it costs about 40 tokens; SKILL.md has 970 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~40
When it runs · the whole SKILL.md, loaded when a task matches
~3.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from agiprolabs/claude-trading-skills at commit 981e1d7, republished under its MIT licence (© agiprolabs). 970 words, ~3,084 tokens.

Download SKILL.mdSave it as .claude/skills/solana-tx-building/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
solana-tx-building
description
Solana transaction construction including instruction building, account resolution, compute budget, priority fees, and versioned transactions

Solana Transaction Building

This skill covers how to construct, simulate, and inspect Solana transactions programmatically. It addresses the full anatomy of a Solana transaction — from raw instruction encoding to versioned transaction formats, compute budget management, priority fees, and address lookup tables.

Safety: This skill is for transaction construction and analysis only. Scripts in this skill NEVER sign or submit real transactions. Always simulate before sending. Never auto-sign.

Transaction Anatomy

A Solana transaction consists of:

  1. Signatures: One or more Ed25519 signatures (64 bytes each)
  2. Message: The serializable payload containing:
    • Header: Counts of required signers, read-only signers, read-only non-signers
    • Account keys: Array of all pubkeys referenced by instructions
    • Recent blockhash: 32-byte hash for replay protection (expires ~60-90 seconds)
    • Instructions: Array of program calls
Transaction Size Limit

The hard limit is 1232 bytes for the entire serialized transaction. This constrains how many instructions and accounts you can include. Strategies to stay within the limit:

  • Use versioned transactions with Address Lookup Tables (ALTs)
  • Minimize the number of accounts per instruction
  • Combine related operations into single instructions where supported
  • Split complex operations across multiple transactions
Instruction Format

Each instruction contains three fields:

Instruction {
    program_id_index: u8,      // Index into the account keys array
    accounts: [u8],            // Indices into account keys array
    data: [u8],                // Opaque byte array interpreted by the program
}
Account Meta

Every account referenced in an instruction has metadata:

AccountMeta {
    pubkey: Pubkey,            // 32-byte public key
    is_signer: bool,           // Must sign the transaction
    is_writable: bool,         // Will be written to by this instruction
}

The four combinations determine the account's role:

is_signeris_writableRole
truetrueFee payer, token owner performing transfer
truefalseMultisig co-signer, read-only authority
falsetrueDestination account, PDA being written
falsefalseProgram ID, sysvar, clock

Legacy vs Versioned Transactions

Legacy Transactions

The original format. All accounts must be listed in the account keys array. With the 1232-byte limit, you can fit roughly 20-35 accounts depending on instruction data size.

Versioned Transactions (v0)

Introduced to support Address Lookup Tables (ALTs). A v0 transaction includes:

  • A version prefix byte (0x80 for v0)
  • The same message structure as legacy
  • An additional address_table_lookups array

ALTs let you reference accounts by a compact index into an on-chain table rather than including the full 32-byte pubkey. This dramatically increases the number of accounts a transaction can reference.

AddressTableLookup {
    account_key: Pubkey,           // The ALT account address
    writable_indexes: [u8],        // Indices for writable accounts
    readonly_indexes: [u8],        // Indices for read-only accounts
}

When to use v0: Any transaction referencing more than ~20 accounts, Jupiter swaps with multi-hop routes, complex DeFi interactions.

Compute Budget

Every transaction has a compute budget that determines how many compute units (CUs) it can consume and what priority fee to pay.

Compute Budget Instructions

Two key instructions from the Compute Budget Program (ComputeBudget111111111111111111111111111111):

1. Set Compute Unit Limit

Instruction data: [0x02, <units as u32 LE>]

Sets the maximum CUs this transaction can consume. Default is 200,000 per instruction (max 1,400,000 per transaction). Setting this lower than needed causes the transaction to fail. Setting it higher wastes budget but does not cost more (you only pay for requested, not consumed).

2. Set Compute Unit Price

Instruction data: [0x03, <micro_lamports as u64 LE>]

Sets the price per CU in micro-lamports. This is the priority fee mechanism. The total priority fee is:

priority_fee = compute_unit_limit * compute_unit_price / 1_000_000
Priority Fee Estimation

To estimate an appropriate priority fee:

  1. Call getRecentPrioritizationFees RPC method with the accounts your transaction touches
  2. Look at the median or 75th percentile fee from recent slots
  3. During congestion, fees spike — monitor and adjust dynamically
python
import httpx

def get_priority_fees(rpc_url: str, accounts: list[str]) -> list[dict]:
    """Fetch recent prioritization fees for given accounts."""
    resp = httpx.post(rpc_url, json={
        "jsonrpc": "2.0",
        "id": 1,
        "method": "getRecentPrioritizationFees",
        "params": [accounts]
    })
    return resp.json()["result"]

Common Transaction Patterns

1. SOL Transfer

The simplest transaction: a System Program transfer.

python
# System Program transfer instruction data layout:
# [2, 0, 0, 0]  (u32 LE = instruction index 2 = Transfer)
# + amount as u64 LE (lamports)
import struct

def build_sol_transfer_data(lamports: int) -> bytes:
    """Build instruction data for a SOL transfer."""
    return struct.pack("<I", 2) + struct.pack("<Q", lamports)

Accounts required:

  1. Sender (signer, writable)
  2. Recipient (writable)
2. SPL Token Transfer

Transferring SPL tokens requires the Token Program.

python
# Token Program transfer instruction:
# [3]  (instruction index 3 = Transfer)
# + amount as u64 LE
def build_token_transfer_data(amount: int) -> bytes:
    """Build instruction data for an SPL token transfer."""
    return bytes([3]) + struct.pack("<Q", amount)

Accounts required:

  1. Source token account (writable)
  2. Destination token account (writable)
  3. Owner/delegate (signer)
3. Create Associated Token Account (ATA)

Before transferring tokens, the recipient must have an Associated Token Account.

python
# ATA Program: instruction index 0 = Create
# No instruction data needed (empty bytes)
ATA_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"

Accounts required (in order):

  1. Payer (signer, writable) — pays rent
  2. Associated token account (writable) — the ATA to create
  3. Wallet address — owner of the new ATA
  4. Token mint
  5. System Program
  6. Token Program
Show full SKILL.md (369 more words)Show less
4. Jupiter Swap

Jupiter provides a /swap-instructions endpoint that returns pre-built instructions. See the jupiter-api skill for full details.

General flow:

  1. Get a quote from /quote
  2. Get swap instructions from /swap-instructions
  3. Build transaction with setup instructions + swap instruction + cleanup instructions
  4. Add compute budget instructions
  5. Simulate, then sign and send

Simulation

Always simulate before sending. Use the simulateTransaction RPC method:

python
def simulate_transaction(rpc_url: str, tx_base64: str) -> dict:
    """Simulate a transaction without submitting it.

    Args:
        rpc_url: Solana RPC endpoint URL.
        tx_base64: Base64-encoded serialized transaction.

    Returns:
        Simulation result with logs and compute units consumed.
    """
    resp = httpx.post(rpc_url, json={
        "jsonrpc": "2.0",
        "id": 1,
        "method": "simulateTransaction",
        "params": [
            tx_base64,
            {"encoding": "base64", "replaceRecentBlockhash": True}
        ]
    })
    result = resp.json()["result"]
    if result["value"]["err"]:
        print(f"Simulation failed: {result['value']['err']}")
        for log in result["value"].get("logs", []):
            print(f"  {log}")
    else:
        cu = result["value"].get("unitsConsumed", 0)
        print(f"Simulation OK — {cu} compute units consumed")
    return result

The replaceRecentBlockhash: True flag lets you simulate even if your blockhash has expired, which is useful for testing transaction construction without timing pressure.

Error Handling

Common transaction errors and their causes:

ErrorCauseFix
BlockhashNotFoundBlockhash expired (~60-90s)Fetch new blockhash and rebuild
InsufficientFundsNot enough SOL for fees + transferCheck balance before building
AccountNotFoundToken account doesn't existCreate ATA first
ProgramFailedToCompleteExceeded compute budgetIncrease compute unit limit
TransactionTooLargeOver 1232 bytesUse ALTs or split into multiple txs
InvalidAccountDataWrong account passed to instructionVerify account derivation
SignatureVerificationFailedMissing or wrong signerCheck all is_signer accounts signed
Retry Strategy
python
import time

def send_with_retry(
    rpc_url: str,
    build_fn,
    max_retries: int = 3,
    base_delay: float = 0.5
) -> dict:
    """Build and send a transaction with blockhash refresh on expiry.

    Args:
        rpc_url: Solana RPC endpoint.
        build_fn: Callable that takes a blockhash and returns a signed tx.
        max_retries: Maximum retry attempts.
        base_delay: Base delay between retries in seconds.

    Returns:
        Send result from RPC.
    """
    for attempt in range(max_retries):
        blockhash = get_latest_blockhash(rpc_url)
        tx = build_fn(blockhash)
        result = send_transaction(rpc_url, tx)
        if "error" not in result:
            return result
        err = result["error"]
        if "BlockhashNotFound" in str(err):
            time.sleep(base_delay * (attempt + 1))
            continue
        raise RuntimeError(f"Transaction failed: {err}")
    raise RuntimeError("Max retries exceeded")

Transaction Decoding

To decode an existing transaction from the chain:

python
def decode_transaction(rpc_url: str, signature: str) -> dict:
    """Fetch and return a parsed transaction.

    Args:
        rpc_url: Solana RPC endpoint.
        signature: Transaction signature (base58).

    Returns:
        Parsed transaction data.
    """
    resp = httpx.post(rpc_url, json={
        "jsonrpc": "2.0",
        "id": 1,
        "method": "getTransaction",
        "params": [
            signature,
            {"encoding": "jsonParsed", "maxSupportedTransactionVersion": 0}
        ]
    })
    return resp.json()["result"]

Integration with Other Skills

  • solana-rpc: Provides the RPC connection layer for submitting and querying transactions
  • jupiter-api: Supplies swap instructions that this skill assembles into transactions
  • dex-execution: Orchestrates the full execution flow using transactions built by this skill
  • mev-analysis: Evaluates MEV risk of constructed transactions before submission
  • helius-api: Enhanced transaction parsing and webhook-based confirmation tracking

Safety Checklist

Before submitting any transaction to mainnet:

  1. Simulate first — always call simulateTransaction before sendTransaction
  2. Verify accounts — confirm all account addresses are correct (especially for token transfers)
  3. Check balances — ensure sufficient SOL for fees and any transfers
  4. Review compute budget — set appropriate CU limit based on simulation
  5. Confirm priority fee — check current network fees, do not overpay
  6. Never auto-sign — require explicit user confirmation before signing
  7. Use devnet for testing — build and test on devnet before mainnet
  8. Log everything — record transaction signatures, simulation results, and errors

Files

References
  • references/transaction_anatomy.md — Message format, versioned transactions, compute budget, blockhash management
  • references/common_instructions.md — Instruction layouts for System, Token, ATA, Compute Budget, Memo, and Jupiter programs
Scripts
  • scripts/build_transfer.py — Build and simulate a SOL transfer transaction (demo mode, never signs)
  • scripts/decode_transaction.py — Fetch and decode on-chain transactions with program identification

© agiprolabs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (scripts, references) in skills/solana-tx-building of agiprolabs/claude-trading-skills.

  • SKILL.md
  • references/common_instructions.md
  • references/transaction_anatomy.md
  • scripts/build_transfer.py
  • scripts/decode_transaction.py

Open the folder on GitHubat commit 981e1d7

Compare with similar skills

Solana Tx Building next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Solana Tx Building compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Solana Tx Building this skillagiprolabs/claude-trading-skills410—~3.1kAutomated safety check: PassMIT
Solana Devsolana-foundation/solana-dev-skill573—~3.8kAutomated safety check: PassMIT
Meme Coin Security Auditawarexone/Agentic-Bug-Hunter5.3k1 repos~2.4kAutomated safety check: PassMIT
Swapper Depositswapperfinance/swapper-toolkit852—~1.8kAutomated safety check: PassMIT
PNP Prediction Markets on Solanainternet-court/internet-court-skill6.6k—~7.5kAutomated safety check: NotesMIT
Minara Crypto Trading and WalletMinara-AI/minara-skills362—~5.7kAutomated safety check: PassNone

Similar skills

  • Solana Dev

    solana-foundation/solana-dev-skill

    A skill your agent uses when user asks to "build a Solana dapp", "write an Anchor program", "create a token", "debug Solana errors", "set up wallet connection", "test my Solana program", "fuzz my…

    573 GitHub stars~3.8k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • Meme Coin Security Audit

    awarexone/Agentic-Bug-Hunter

    Screens EVM and Solana meme coins for rug pull signs such as hidden mint, honeypot logic and fee tricks, starting with fast kill signals before any code review.

    5.3k GitHub starsUsed in 1 repo~2.4k tokens
    SecurityAuto-check passed
  • Swapper Deposit

    swapperfinance/swapper-toolkit

    Deposit and bridge funds into a wallet or protocol using Swapper Finance.

    852 GitHub stars~1.8k tokensUpdated 6 mo ago
    Business, Finance & HRAuto-check passed
  • PNP Prediction Markets on Solana

    internet-court/internet-court-skill

    Creates, trades and settles permissionless prediction markets on Solana with any SPL token as collateral, including social-media and custom-oracle markets.

    6.6k GitHub stars~7.5k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check: notes
  • Minara Crypto Trading and Wallet

    Minara-AI/minara-skills

    Drives the Minara CLI for crypto swaps, perps, limit orders, wallet transfers, deposits and withdrawals, plus AI market analysis.

    362 GitHub stars~5.7k tokensUpdated 24 days ago
    Business, Finance & HRAuto-check passed
  • Manifest

    Bonasa-Tech/manifest

    A skill your agent uses when building, debugging, or integrating with the Manifest DEX on Solana, especially for TypeScript SDK usage, transaction construction with ManifestClient, market state…

    158 GitHub stars~478 tokensUpdated yesterday
    DevelopmentAuto-check passed

More from agiprolabs/claude-trading-skills

All 68 skills in this repo
  • Backtrader

    agiprolabs/claude-trading-skills

    Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers, and custom indicators

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Birdeye API

    agiprolabs/claude-trading-skills

    Solana token market data via Birdeye — prices, OHLCV, trades, token metadata, security checks, and trader activity

    410 GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Coingecko API

    agiprolabs/claude-trading-skills

    Broad crypto market data from CoinGecko covering 13,000+ tokens.

    410 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Cointegration Analysis

    agiprolabs/claude-trading-skills

    Cointegration testing for pairs trading using Engle-Granger, Johansen, and rolling stability analysis

    410 GitHub stars~2.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Copy Trading

    agiprolabs/claude-trading-skills

    Wallet evaluation, monitoring, and copy-trade strategy design for Solana DEX trading

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Correlation Analysis

    agiprolabs/claude-trading-skills

    Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail dependence, and regime-dependent correlation

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Solana Tx Building

What does Solana Tx Building do?

Solana transaction construction including instruction building, account resolution, compute budget, priority fees, and versioned transactions. Solana Tx Building is an agent skill from agiprolabs/claude-trading-skills.

How do I install Solana Tx Building in Claude Code?

Run `npx skills add agiprolabs/claude-trading-skills --skill solana-tx-building -a claude-code`. Or copy the skill folder (skills/solana-tx-building in agiprolabs/claude-trading-skills) into .claude/skills/solana-tx-building in your project. Claude Code loads it when a task matches its description.

How do I install Solana Tx Building in Codex?

Run `npx skills add agiprolabs/claude-trading-skills --skill solana-tx-building -a codex`. Or copy the skill folder (skills/solana-tx-building in agiprolabs/claude-trading-skills) into .agents/skills/solana-tx-building in your project. Codex loads it when a task matches its description.

Can I use Solana Tx Building in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add agiprolabs/claude-trading-skills --skill solana-tx-building -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/solana-tx-building, .gemini/skills/solana-tx-building, .github/skills/solana-tx-building and .opencode/skills/solana-tx-building in your project.

What does Solana Tx Building need to run?

Going by SKILL.md and its folder, Solana Tx Building needs Python for the scripts in its folder. Our summary lists: Python 3.

Does Solana Tx Building access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Solana Tx Building safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Solana Tx Building use?

Solana Tx Building is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Solana Tx Building use?

About 3.1k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.7k tokens, read only when the agent opens those files.

What are the alternatives to Solana Tx Building?

Skills that share tags, products or a category with Solana Tx Building: Solana Dev (solana-foundation/solana-dev-skill, 573 stars), Meme Coin Security Audit (awarexone/Agentic-Bug-Hunter, 5.3k stars), Swapper Deposit (swapperfinance/swapper-toolkit, 852 stars) and PNP Prediction Markets on Solana (internet-court/internet-court-skill, 6.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Solana Tx Building?

agiprolabs (a GitHub user) maintains it in agiprolabs/claude-trading-skills, which has 410 GitHub stars. The repository holds 68 skills in this directory. The repository was last updated on September 3, 2026.

Source: agiprolabs/claude-trading-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.