@thesight/profiler
v0.1.1
Published
Sight CLI — profile any Solana transaction. Shows CPI tree, per-program compute-unit attribution, full cost-model breakdown (signature, write-locks, data bytes, programs execution, loaded accounts), and decoded Anchor errors. Installs a `sight` binary.
Maintainers
Readme
@thesight/profiler
The sight CLI — profile any Solana transaction from a signature or
a simulation, get the full picture of where every compute unit went
and what the transaction actually cost.
Part of Sight, the OpenTelemetry observability layer for Solana. The CLI is standalone — you don't need a Sight account, a DSN, or an ingest endpoint to use it. Point it at any RPC and a signature you care about.
Install
npm i -g @thesight/profiler
# or run without installing:
npx @thesight/profiler profile <signature>What it shows
$ sight profile 5kdJgZ…DpQsRA
Using mainnet.helius-rpc.com (from $HELIUS_RPC_URL).
✔ Profiled — 181,584 CU total (178,420 execution)
Cost Model
Sight-computed breakdown — simulate() alone only returns "Programs execution"
██░░░░░░░░░░░░░░░░░░░░░░░░░ 720 CU 0.4% Signature
██░░░░░░░░░░░░░░░░░░░░░░░░░ 2,400 CU 1.3% Write locks
░░░░░░░░░░░░░░░░░░░░░░░░░░░ 12 CU 0.0% Data bytes
█████████████████████████░░ 178,420 CU 98.3% Programs execution
░░░░░░░░░░░░░░░░░░░░░░░░░░░ — CU Loaded accounts size (use --full)
───────────────────────────
181,584 CU Total (excl. loaded-accounts)
Sight — CU Profile
5kdJgZ…DpQsRA
Slot 326,184,592
███████████████████████████ 89.2% of budget
178,420 / 200,000 CU
█ 178,420 CU 100.0% jupiter_v6::route
█ 92,140 CU 51.6% whirlpool::swap
▌ 4,645 CU 2.6% token_program::TransferChecked
▌ 4,645 CU 2.6% token_program::TransferChecked
█ 61,890 CU 34.7% orca_v2::swap
▌ 4,645 CU 2.6% token_program::TransferChecked
▌ 4,645 CU 2.6% token_program::TransferChecked
▏ 300 CU 0.2% compute_budget::SetComputeUnitLimitCommands
sight profile <signature>
Profile a confirmed transaction. Fetches it via getTransaction, parses
the on-chain logs into a CPI tree, and renders the flamegraph plus the
cost-model breakdown.
sight profile 5kdJgZ…DpQsRA # happy path
sight profile <sig> --full # include loaded-accounts cost (extra RPC)
sight profile <sig> --no-idl # skip on-chain IDL lookup
sight profile <sig> --json # machine-readable output
sight profile <sig> --rpc https://your-rpc.io # override RPC endpointsight simulate
Pipe a base64-encoded transaction to simulate it without sending and profile the result. Default target cluster is devnet.
cat tx.b64 | sight simulate
cat tx.b64 | sight simulate --rpc https://api.mainnet-beta.solana.comRPC configuration
The CLI picks up an RPC endpoint from (in order):
--rpc <url>flag$HELIUS_RPC_URLenv var$RPC_URL$SOLANA_RPC_URL- Public mainnet (rate-limited — you'll hit 429s quickly)
export HELIUS_RPC_URL=https://mainnet.helius-rpc.com/?api-key=<your-key>
sight profile <sig>What's the cost model?
Solana's cost model prices a transaction in five components, but the
simulateTransaction RPC only returns unitsConsumed (the
programs-execution cost). Sight computes the other four client-side
from the transaction structure so you see the full picture before
submission:
| Component | Source |
|---|---|
| signature_cost | 720 CU × signature count |
| write_lock_cost | 300 CU × writable accounts (incl. ALT writables) |
| data_bytes_cost | floor(total ix data bytes / 140) |
| programs_execution_cost | RPC-reported unitsConsumed |
| loaded_accounts_data_size_cost | 8 CU × ceil(loaded bytes / 32 KB) — opt-in via --full |
The --full flag adds one getMultipleAccounts round-trip to measure
loaded-accounts size; everything else is derivable from the raw tx.
Related packages
@thesight/sdk— production OTel SDK that auto-attachessolana.cost.*span attributes on every transaction.@thesight/core— the shared log parser, IDL resolver, and cost-model engine powering both the CLI and the SDK.
License
MIT
