A token safety screening library for Solana. Check tokens for common red flags before trading.
⚠️ Disclaimer: This library helps identify common risk patterns but cannot guarantee token safety. Always do your own research.
- 🔐 Authority Checks - Mint and freeze authority status
- 💧 Liquidity Analysis - LP size, locked percentage
- 👥 Holder Concentration - Top holder distribution
- 🍯 Honeypot Detection - Basic sellability checks
- 📊 Safety Score - 0-100 risk score
- ⚙️ Configurable Thresholds - Strict, normal, relaxed presets
go get github.com/Laminar-Bot/solana-token-guardpackage main
import (
"context"
"fmt"
"log"
"github.com/Laminar-Bot/solana-token-guard"
"github.com/Laminar-Bot/helius-go"
"github.com/Laminar-Bot/birdeye-go"
)
func main() {
// Initialize with data providers
guard := tokenguard.New(tokenguard.Config{
Helius: helius.NewClient(helius.Config{APIKey: "..."}),
Birdeye: birdeye.NewClient(birdeye.Config{APIKey: "..."}),
})
// Screen a token
result, err := guard.Screen(context.Background(), "TokenMintAddress...", tokenguard.LevelNormal)
if err != nil {
log.Fatal(err)
}
if result.Passed {
fmt.Printf("✅ Token passed screening (score: %d/100)\n", result.Score)
} else {
fmt.Printf("❌ Token failed screening\n")
for _, check := range result.FailedChecks {
fmt.Printf(" - %s: %s\n", check.Name, check.Message)
}
}
}| Check | Description |
|---|---|
mint_authority |
Is mint authority revoked? (can't print more tokens) |
freeze_authority |
Is freeze authority revoked? (can't freeze wallets) |
liquidity |
Is there enough LP? Is your trade size safe vs LP? |
lp_locked |
Is liquidity locked/burned? |
holder_concentration |
Are tokens distributed or concentrated? |
honeypot |
Basic sellability heuristics |
Best for automated trading, rejects more tokens.
result, _ := guard.Screen(ctx, token, tokenguard.LevelStrict)- Mint/freeze authority: must be revoked
- Min LP: 50 SOL
- LP locked: required, 80%+
- Top 10 holders: <30%
- Max single holder: <10%
Balanced for most use cases.
result, _ := guard.Screen(ctx, token, tokenguard.LevelNormal)- Mint/freeze authority: must be revoked
- Min LP: 20 SOL
- LP locked: not required
- Top 10 holders: <50%
- Max single holder: <20%
For experienced traders, accepts more risk.
result, _ := guard.Screen(ctx, token, tokenguard.LevelRelaxed)- Mint/freeze authority: not required
- Min LP: 5 SOL
- Top 10 holders: <70%
- Max single holder: <30%
result, _ := guard.ScreenWithThresholds(ctx, token, tokenguard.Thresholds{
RequireMintRevoked: true,
RequireFreezeRevoked: true,
MinLPValueSOL: decimal.NewFromFloat(100),
RequireLPLocked: true,
MinLPLockedPct: decimal.NewFromFloat(90),
MaxTop10HolderPct: decimal.NewFromFloat(25),
MaxSingleHolderPct: decimal.NewFromFloat(5),
MaxPositionPctOfLP: decimal.NewFromFloat(0.5),
})Check if your trade size is safe relative to liquidity:
result, _ := guard.ScreenWithPositionSize(ctx, token, tokenguard.LevelNormal,
decimal.NewFromFloat(2.0)) // 2 SOL position
// Will fail if 2 SOL > threshold % of LPtype Result struct {
Passed bool // Overall pass/fail
Score int // 0-100 safety score
Checks []Check // All checks performed
FailedChecks []Check // Only failed checks
Warnings []string // Non-fatal warnings
}
type Check struct {
Name string // e.g., "mint_authority"
Passed bool
Value interface{} // Actual value found
Message string // Human-readable result
}Results are cached to avoid redundant API calls:
guard := tokenguard.New(tokenguard.Config{
Helius: heliusClient,
Birdeye: birdeyeClient,
CacheTTL: 30 * time.Minute, // default
})
// Force fresh data
result, _ := guard.Screen(ctx, token, level, tokenguard.WithNoCache())Contributions are welcome! Please read our Contributing Guide first.
MIT License - see LICENSE for details.
- helius-go - Helius API client
- birdeye-go - Birdeye API client
- jupiter-go - Jupiter API client