Core Solana blockchain plugin for Eliza OS that provides essential services and actions for token operations, trading, and DeFi integrations.
The Solana plugin serves as a foundational component of Eliza OS, bridging Solana blockchain capabilities with the Eliza ecosystem. It provides crucial services for token operations, trading, portfolio management, and DeFi integrations, enabling both automated and user-directed interactions with the Solana blockchain.
- Token Creation: Deploy new tokens with customizable metadata
- Token Transfers: Send and receive tokens securely
- Balance Management: Track and manage token balances
- Portfolio Analytics: Real-time portfolio valuation and tracking
- Token Swaps: Execute trades between tokens using Jupiter aggregator
- Order Management: Place and track token orders
- Price Monitoring: Real-time price feeds and historical data
- Automated Trading: Configurable trading strategies and automation
- Liquidity Analysis: Monitor and analyze pool liquidity
- Market Making: Automated market making capabilities
- Yield Optimization: Smart routing for optimal yields
- Risk Management: Advanced risk scoring and monitoring
- Trust Scoring: Dynamic trust score calculation for tokens
- Risk Assessment: Real-time risk evaluation for trades
- Performance Tracking: Historical performance monitoring
- Simulation Mode: Test strategies without real transactions
- Wallet Management: Secure wallet key derivation and storage
- Permission Scoping: Granular control over trading permissions
- TEE Integration: Trusted Execution Environment support
- Key Protection: Secure private key handling
- Trade Limits: Configurable transaction limits
- Slippage Protection: Automatic slippage controls
- Validation Checks: Multi-level transaction validation
- Simulation Support: Pre-execution transaction simulation
npm install @elizaos/plugin-solana
Configure the plugin by setting the following environment variables:
const solanaEnvSchema = {
WALLET_SECRET_SALT: string(optional),
WALLET_SECRET_KEY: string,
WALLET_PUBLIC_KEY: string,
SOL_ADDRESS: string,
SLIPPAGE: string,
SOLANA_RPC_URL: string,
HELIUS_API_KEY: string,
BIRDEYE_API_KEY: string,
};
import { solanaPlugin } from "@elizaos/plugin-solana";
// Initialize the plugin
const runtime = await initializeRuntime({
plugins: [solanaPlugin],
});
Manages token operations and information retrieval.
const tokenProvider = new TokenProvider(
tokenAddress,
walletProvider,
cacheManager
);
await tokenProvider.getTokensInWallet(runtime);
Handles wallet operations and portfolio management.
const walletProvider = new WalletProvider(connection, publicKey);
await walletProvider.getFormattedPortfolio(runtime);
Evaluates and manages trust scores for tokens and trading activities.
const trustScore = await runtime.getProvider("trustScore");
Executes a token swap using Jupiter aggregator.
// Example usage
const result = await runtime.executeAction("EXECUTE_SWAP", {
inputTokenSymbol: "SOL",
outputTokenSymbol: "USDC",
amount: 0.1,
});
Transfers tokens between wallets.
// Example usage
const result = await runtime.executeAction("TRANSFER_TOKEN", {
tokenAddress: "TokenAddressHere",
recipient: "RecipientAddressHere",
amount: "1000",
});
Places a buy order based on conviction level.
// Example usage
const result = await runtime.executeAction("TAKE_ORDER", {
ticker: "SOL",
contractAddress: "ContractAddressHere",
});
Creates and buys tokens on pump.fun.
// Example usage
const result = await runtime.executeAction("CREATE_AND_BUY_TOKEN", {
tokenMetadata: {
name: "TokenName",
symbol: "SYMBOL",
description: "Token description",
image_description: "Image description",
},
buyAmountSol: 0.1,
});
Creates and buys tokens on fomo.fund.
// Example usage
const result = await runtime.executeAction("CREATE_AND_BUY_TOKEN", {
tokenMetadata: {
name: "TokenName",
symbol: "SYMBOL",
description: "Token description",
image_description: "Image description",
},
buyAmountSol: 0.1,
requiredLiquidity: 1000,
});
Executes token swaps for DAO operations.
// Example usage
const result = await runtime.executeAction("EXECUTE_SWAP_DAO", {
inputTokenSymbol: "SOL",
outputTokenSymbol: "USDC",
amount: 0.1,
});
-
Cache Management
- Implement token data caching
- Configure cache TTL settings
- Monitor cache hit rates
-
RPC Optimization
- Use connection pooling
- Implement request batching
- Monitor RPC usage
-
Transaction Management
- Optimize transaction bundling
- Implement retry strategies
- Monitor transaction success rates
- Node.js 16.x or higher
- Solana CLI tools (optional)
- Minimum 4GB RAM recommended
- Stable internet connection
- Access to Solana RPC endpoint
- Wallet Connection Failures
Error: Failed to connect to wallet
- Verify RPC endpoint is accessible
- Check wallet configuration settings
- Ensure proper network selection
- Transaction Errors
Error: Transaction simulation failed
- Check account balances
- Verify transaction parameters
- Ensure proper fee configuration
- Price Feed Issues
Error: Unable to fetch price data
- Verify API key configuration
- Check network connectivity
- Ensure price feed service status
-
Environment Variables
- Store sensitive keys in environment variables
- Use .env.example for non-sensitive defaults
- Never commit real credentials to version control
-
Transaction Limits
- Set maximum transaction amounts
- Implement daily trading limits
- Configure per-token restrictions
-
Monitoring
- Track failed transaction attempts
- Monitor unusual trading patterns
- Log security-relevant events
-
Recovery
- Implement transaction rollback mechanisms
- Maintain backup RPC endpoints
- Document recovery procedures
-
Cache Management
- Implement token data caching
- Configure cache TTL settings
- Monitor cache hit rates
-
RPC Optimization
- Use connection pooling
- Implement request batching
- Monitor RPC usage
-
Transaction Management
- Optimize transaction bundling
- Implement retry strategies
- Monitor transaction success rates
For issues and feature requests, please:
- Check the troubleshooting guide above
- Review existing GitHub issues
- Submit a new issue with:
- System information
- Error logs
- Steps to reproduce
- Transaction IDs (if applicable)
Contributions are welcome! Please see the CONTRIBUTING.md file for more information.
This plugin integrates with and builds upon several key technologies:
- Solana - The core blockchain platform
- Solana Web3.js - Core Solana interactions
- SPL Token - Token program interactions
- Jupiter - Token swap aggregation
- Birdeye - Price feeds and analytics
- Helius - Enhanced RPC services
- Anchor - Smart contract framework
- FOMO - Token creation and trading
- Pump.fun - Token creation and trading
Special thanks to:
- The Solana ecosystem and all the open-source contributors who make these integrations possible.
- The Eliza community for their contributions and feedback.
For more information about Solana blockchain capabilities:
This plugin is part of the Eliza project. See the main project repository for license information.