| Crates.io | solana-pipkit |
| lib.rs | solana-pipkit |
| version | 2.2.0 |
| created_at | 2025-12-22 04:58:33.869495+00 |
| updated_at | 2026-01-02 16:02:55.103549+00 |
| description | Pragmatic Rust utilities for Solana development - safety, speed, analytics, and DeFi |
| homepage | |
| repository | https://github.com/piccassol/solana-pipkit |
| max_upload_size | |
| id | 1999072 |
| size | 1,073,319 |
A pragmatic Rust toolkit for Solana program and client development
Crates.io • Documentation • Solana Docs • Contribute • Examples
solana-pipkit is a Rust utility crate designed to streamline common tasks in Solana program and client development. It focuses on ergonomics, safety, and reusable patterns for production-grade Solana workflows.
As of version 2.2.0, solana-pipkit represents a stable, cohesive client-side framework for building trading systems, wallets, bots, analytics pipelines, and developer tooling on Solana.
cargo add solana-pipkit
Or add to your Cargo.toml:
[dependencies]
solana-pipkit = "2.2.0"
# Enable high-performance trading features
solana-pipkit = { version = "2.2.0", features = ["speed"] }
Rent Recovery Efficiently reclaim lamports from dormant or empty accounts
SPL Token Helpers Simplified helpers for burning, transferring, and closing token accounts
PDA Management Utilities for derivation, seeding, and validation including Metaplex metadata PDAs
Account Utilities Common validation patterns, deserialization helpers, and account graph traversal
Transaction Batching Fluent builders and batch executors for reliable multi-transaction workflows
Anchor Reusables Shared structures and helpers for cleaner, more maintainable Anchor programs
Safety Protocol Client-side validation to prevent costly transaction mistakes before submission
Transaction Simulation Pre-flight simulation for previewing balance changes, compute usage, and failure risks
Program and NFT Safety Detection of risky programs, upgrade authorities, and suspicious or fake NFTs
MEV Protection Sandwich risk analysis, priority fee recommendations, and Jito bundle support
Speed Module (introduced in v1.3.0, consolidated in v2.0.0) High-performance execution for trading agents with connection pooling, blockhash caching, and optimized swaps
Analytics Module (v2.0.0) Wallet profiling, PnL analysis, and behavioral classification
DeFi Module (v2.0.0) Pool inspection, LP position tracking, and farming position analysis
Multi-Agent Module (v2.1.0) Secure agent coordination, encrypted messaging, task marketplace, and event streaming
Agent-Registry Module (v2.2.0) Adds a PDA-based, on-chain identity and discovery layer for autonomous agents on Solana, enabling capability-indexed registration, safe metadata storage, real-time event monitoring, and peer discovery for multi-agent coordination.
The agent-registry module provides on-chain agent registration, discovery, and coordination primitives. It features PDA-derived agent accounts, capability-based searching, real-time event monitoring, and peer discovery for multi-agent task routing.
use solana_pipkit::agent_registry::*;
use solana_sdk::signature::Keypair;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = AgentRegistryClient::new("https://api.devnet.solana.com".to_string());
let agent = Keypair::new();
// Register agent with capabilities
let params = RegistrationParams::new(
agent.pubkey(),
vec!["inference".to_string(), "model_finetuning".to_string()],
"1.0.0"
);
let signature = client.register_agent(¶ms, &agent).await?;
println!("Agent registered: {}", signature);
// Discover peers for collaborative tasks
let peers = client.discover_peers(
vec!["inference".to_string()],
5000, // min reputation
5,
).await?;
if let Some(inference_agents) = peers.get("inference") {
println!("Found {} inference agents:", inference_agents.len());
for peer in inference_agents {
println!(" - {} (reputation: {})", peer.pubkey, peer.reputation);
}
}
Ok(())
}
Agent-Registry Features:
The analytics module provides wallet profiling, classification, and behavioral analysis. It helps identify whales, smart money, bots, and track wallet activity patterns.
use solana_pipkit::analytics::prelude::*;
use solana_client::rpc_client::RpcClient;
use solana_sdk::pubkey::Pubkey;
use std::str::FromStr;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let rpc = RpcClient::new("https://api.mainnet-beta.solana.com".to_string());
let config = AnalyticsConfig::default();
let profiler = WalletProfiler::new(&rpc, config);
let wallet = Pubkey::from_str("TargetWalletAddress...")?;
let profile = profiler.analyze(&wallet).await?;
println!("Wallet Classification: {:?}", profile.classification);
println!("Activity Level: {:?}", profile.activity_level);
println!("Flags: {:?}", profile.flags);
println!("SOL Balance: {:.2}", profile.sol_balance);
println!("Token Count: {}", profile.token_count);
Ok(())
}
Wallet Classification Types:
Whale - High-value holdersSmartMoney - Known profitable traders and fundsExchange - Centralized exchange walletsBot - Automated trading agentsRetail - Regular usersNew - Recently created walletsThe multi-agent module provides secure, low-latency coordination primitives for multiple Solana agents. It features PDA-derived agent inboxes, encrypted messaging, task marketplace bidding, and shared event subscriptions.
use solana_pipkit::multi_agent::*;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_sdk::{signature::Keypair, pubkey::Pubkey};
use std::str::FromStr;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = RpcClient::new("https://api.mainnet-beta.solana.com".to_string());
let agent = Keypair::new();
let target = Pubkey::from_str("TargetAgentAddress...")?;
// Derive agent inbox PDA
let inbox = AgentInbox::derive(&agent.pubkey());
// Create encryption for private messages
let encryptor = MessageEncryptor::new();
// Post a message to target agent's inbox
let payload = b"Execute arbitrage between pools A and B".to_vec();
let nonce = encryptor.generate_nonce();
let instruction = post_encrypted_message(
&inbox.0,
&agent.pubkey(),
payload,
nonce,
&encryptor,
)?;
// Send the encrypted message
let sig = send_encrypted_message(
&client,
&target,
&agent,
payload,
&encryptor,
).await?;
println!("Message sent: {}", sig);
Ok(())
}
Multi-Agent Features:
Built for trading bots and agents that need minimal latency. The speed module provides optimized RPC clients, instant transaction building, and fast swap execution.
use solana_pipkit::speed::prelude::*;
use solana_sdk::signature::Keypair;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let rpc = FastRpcClient::new(vec![
"https://api.mainnet-beta.solana.com".into(),
"https://solana-api.projectserum.com".into(),
]);
rpc.set_strategy(LoadBalanceStrategy::LeastLatency);
let health = rpc.benchmark_endpoints().await;
let payer = Keypair::new();
let executor = SwapExecutor::new(rpc, payer);
let result = executor.swap_fast(
&mints::USDC,
&mints::SOL,
1_000_000,
SwapConfig::fast(),
).await?;
println!("Swapped in {}ms", result.execution_time_ms);
Ok(())
}
Performance targets:
Before sending a transaction, solana-pipkit allows you to simulate execution locally or via RPC.
Simulation provides insight into balance changes, compute unit usage, instruction failures, and swap outcomes without committing state on-chain.
Simulation is a first-class component in version 2.0.0 and integrates directly with safety analysis to block or warn on unsafe outcomes.
Stable major release. Version 2.2.0 adds the agent-registry module for on-chain agent identity and discovery. Backwards compatibility will be preserved within the 2.x series. Fast chains deserve safe, expressive tooling. solana-pipkit exists to reduce boilerplate, eliminate common footguns, and provide a reliable foundation for Solana client-side infrastructure.
Contributions are welcome and appreciated.
This project is licensed under the MIT License.
Built by Noah Michél
If this toolkit helps your Solana development, consider starring the repo.