SOLANA x ANCHOR
Anchor Size
CLI that calculates Anchor account sizes without manual
space = 8 + ... math
Quick Install
Global install from local repository:
cargo install --path cli
Check CLI:
anchor-size --help
Quick Start
Run analysis for all programs:
anchor-size . --all
Features
- Automatic Anchor workspace detection
- Scans all
#[account]structs - Supports nested structs and complex types
- String / Vec / Option dynamic size handling
- Rent cost estimation in SOL (mainnet/devnet)
- JSON reports for CI/CD
Example Output
Detected Anchor workspace
Account: UserProfile
authority -> 32 bytes
stats -> 9 bytes
name -> 34 bytes
Exact size: 83 bytes
Recommended size: 96 bytes
Rent (mainnet): 0.001559 SOL
JSON for CI/CD
anchor-size . --all --json --out-dir reports
[
{
"name": "UserProfile",
"exact_size": 83,
"recommended_size": 96,
"rent_sol": 0.001559
}
]