A comprehensive, production-ready tool for analyzing Solana Program Derived Addresses (PDAs), tracking transaction patterns, and understanding program behavior on the Solana blockchain. Features real-time analysis, pattern recognition, and beautiful visualization of PDA derivation patterns.
- π Advanced PDA Analysis: Derive seeds and analyze PDA patterns for any Solana program
- π REST API Server: Full-featured HTTP API for real-time PDA analysis (see API_EXAMPLES.md)
- π Real-World Examples: Pre-loaded with examples from major protocols (SPL Token, Metaplex, Serum, Raydium)
- π― Pattern Recognition: Automatically detect and classify common PDA seed patterns
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π SOLANA PDA ANALYZER - COMPREHENSIVE ANALYSIS REPORT
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Analyzing Program Derived Addresses from Live Solana Programs
π Reverse Engineering Seed Patterns and Derivation Logic
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π DETAILED ANALYSIS RESULTS
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1. β
USDC Associated Token Account
π·οΈ PDA Address: Gh9ZwEmd...hQKkx
π§ Program: SPL Associated Token (ATokenGP...nL)
π Description: Stores USDC tokens for wallet 9WzDXwBbmkg8...
π― Pattern: WALLET_TOKEN_MINT (98% confidence)
β±οΈ Analysis Time: 12ms
π± Seed Breakdown:
1. π Pubkey (32 bytes): Wallet owner address
2. π Pubkey (32 bytes): SPL Token Program ID
3. π Pubkey (32 bytes): USDC mint address
π PATTERN ANALYSIS & STATISTICS
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Pattern Distribution:
1. WALLET_TOKEN_MINT [ββββββββββββββββββββ] 45.0% (9 PDAs)
2. STRING_PROGRAM_MINT [ββββββββββββββββββββ] 20.0% (4 PDAs)
3. STRING_AUTHORITY [βββββββββββββββββββββ] 15.0% (3 PDAs)
4. PUBKEY_U64 [ββββββββββββββββββββ] 10.0% (2 PDAs)
5. STRING_SINGLETON [ββββββββββββββββββββ] 10.0% (2 PDAs)
π EXECUTIVE SUMMARY
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π― Analysis Overview:
β’ Total PDAs Analyzed: 20
β’ Unique Patterns Detected: 8
β’ Overall Success Rate: 95.0%
β’ Total Processing Time: 234ms
β’ Average Time per PDA: 11.7ms
- Rust 1.70+
- PostgreSQL 12+
- Docker (optional)
-
Clone the repository
git clone https://github.com/your-username/solana-pda-analyzer.git cd solana-pda-analyzer -
Set up the database
# Create PostgreSQL database createdb solana_pda_analyzer # Copy environment file cp .env.example .env # Edit .env with your database credentials nano .env
-
Build the project
make build # or manually: cargo build --release -
Initialize the database
make db-init # or manually: ./target/release/pda-analyzer database init -
Run the tests
make test-all
-
Start the API server
make run # or manually: ./target/release/pda-analyzer serve -
Test the API
# Health check curl http://localhost:8080/health # Analyze a PDA curl -X POST http://localhost:8080/api/v1/analyze/pda \ -H "Content-Type: application/json" \ -d '{"address": "SysvarRent111111111111111111111111111111111", "program_id": "11111111111111111111111111111112"}'
-
Access the API documentation
Open your browser to
http://localhost:8080/docs
# Start with Docker Compose
docker-compose up -d
# Run tests in Docker
docker-compose exec app make test-all
# View logs
docker-compose logs -f app# Analyze a specific PDA
./target/release/pda-analyzer analyze \
--address "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr" \
--program-id "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
# Batch analyze multiple PDAs
./target/release/pda-analyzer batch-analyze \
--input pdas.json \
--output results.json# Run all example analyses
./examples/run_examples.sh
# Run specific category
./examples/run_examples.sh spl-token
./examples/run_examples.sh metaplex
./examples/run_examples.sh real-world# Initialize database with schema
./target/release/pda-analyzer database init
# Check database status and metrics
./target/release/pda-analyzer database status
# Reset database (caution!)
./target/release/pda-analyzer database reset
# Run pending migrations
./target/release/pda-analyzer database migrate# Fetch recent transactions for a program
./target/release/pda-analyzer fetch \
--program-id "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" \
--limit 1000
# Analyze transaction patterns
./target/release/pda-analyzer analyze-transactions \
--program-id "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"# Show comprehensive statistics
./target/release/pda-analyzer stats
# Generate detailed analysis report
./target/release/pda-analyzer report \
--output html \
--file analysis_report.html# Analyze a single PDA
curl -X POST http://localhost:8080/api/v1/analyze/pda \
-H "Content-Type: application/json" \
-d '{
"address": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
"program_id": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
}'
# Batch analyze multiple PDAs
curl -X POST http://localhost:8080/api/v1/analyze/pda/batch \
-H "Content-Type: application/json" \
-d '{
"pdas": [
{"address": "PDA1...", "program_id": "PROG1..."},
{"address": "PDA2...", "program_id": "PROG2..."}
]
}'# Get all analyzed programs
curl http://localhost:8080/api/v1/programs
# Get program details and statistics
curl http://localhost:8080/api/v1/programs/{program_id}
# Get PDA patterns for a program
curl http://localhost:8080/api/v1/programs/{program_id}/patterns# Get database metrics
curl http://localhost:8080/api/v1/analytics/database
# Get pattern distribution
curl http://localhost:8080/api/v1/analytics/patterns
# Get performance metrics
curl http://localhost:8080/api/v1/analytics/performanceThe tool includes comprehensive examples from major Solana protocols:
- Associated Token Accounts: Most common PDA pattern on Solana
- Mint Authorities: Program-controlled token minting
- Vault Token Accounts: DeFi protocol escrow patterns
- NFT Metadata: Standard NFT information storage
- Master Editions: NFT printing and edition control
- Collection Metadata: NFT collection organization
- Auction House: NFT marketplace structures
- Serum DEX: Market authorities and trading structures
- Raydium AMM: Liquidity pool management
- Marinade Finance: Liquid staking protocol state
- Solana Name Service: Domain name resolution
- Governance: DAO proposal and voting systems
Each example includes:
- β Real PDA addresses from mainnet/testnet
- π Expected seed patterns with detailed breakdowns
- π Comprehensive descriptions of functionality
- π§ͺ Automated tests for validation
Create a .env file (copy from .env.example) and update as required
# Run all tests
make test-all
# Run specific test categories
make test-unit # Unit tests only
make test-integration # Integration tests only
make test-api # API endpoint tests
make test-performance # Performance benchmarks
# Run tests with coverage
make test-coverage
# Run example validation
make test-examples# Run benchmark tests
cargo bench
# Load test the API
./tests/load_test.py --concurrent 50 --requests 1000
# Profile memory usage
./tests/memory_profile.shAll API responses follow this format:
{
"success": true,
"data": {
"pda_info": {
"address": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
"program_id": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
"seeds": [
{
"type": "Pubkey",
"value": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"description": "Wallet owner address"
}
],
"pattern": "WALLET_TOKEN_MINT",
"confidence": 0.98,
"analysis_time_ms": 12
}
},
"error": null,
"timestamp": "2024-01-01T00:00:00Z",
"request_id": "req_123456789"
}POST /api/v1/analyze/pda- Analyze a single PDAPOST /api/v1/analyze/pda/batch- Batch analyze multiple PDAsGET /api/v1/pdas- List analyzed PDAs with paginationGET /api/v1/pdas/{address}- Get detailed PDA information
GET /api/v1/programs- List all programsGET /api/v1/programs/{id}- Get program detailsGET /api/v1/programs/{id}/stats- Get program statisticsGET /api/v1/programs/{id}/patterns- Get program PDA patterns
GET /api/v1/transactions- List transactions with filtersGET /api/v1/transactions/{signature}- Get transaction detailsPOST /api/v1/transactions/analyze- Analyze transaction for PDAs
GET /api/v1/analytics/database- Database metrics and statisticsGET /api/v1/analytics/patterns- Pattern distribution and trendsGET /api/v1/analytics/performance- Performance metrics and timing
We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Run the test suite:
make test-all - Commit your changes:
git commit -m "Add amazing feature" - Push to the branch:
git push origin feature/amazing-feature - Submit a pull request
# Install development dependencies
make dev-setup
# Run development server with hot reload
make dev
# Run linting and formatting
make lint
make fmt
# Generate documentation
make docsThis project is licensed under the MIT License - see the LICENSE file for details.
- π Bug Reports: GitHub Issues
- π‘ Feature Requests: GitHub Discussions
- π Documentation: Project Wiki
- π¬ Community: Telegram Channel