Back to Eliza

Solana Plugin

packages/docs/plugin-registry/defi/solana.md

2.0.14.7 KB
Original Source

The Solana plugin enables Eliza agents to interact with the Solana blockchain — managing SOL and SPL tokens, executing swaps via Jupiter, minting NFTs, and interacting with Solana DeFi protocols.

Package: @elizaos/plugin-solana (community)

Overview

The Solana plugin provides the agent with a Solana keypair wallet and a set of on-chain actions for the most common Solana operations, including Jupiter-based token swaps, NFT management, and SPL token transfers.

Installation

bash
eliza plugins install @elizaos/plugin-solana

Auto-Enable

The plugin auto-enables when HELIUS_API_KEY is set (this is the envKey in plugins.json).

Configuration

Environment VariableRequiredDescription
SOLANA_PRIVATE_KEYNoBase58-encoded private key for the agent's wallet
WALLET_PRIVATE_KEYNoAlias for SOLANA_PRIVATE_KEY
SOL_ADDRESSYesSolana wallet address
SOLANA_PUBLIC_KEYNoSolana public key
WALLET_PUBLIC_KEYNoAlias for public key
SOLANA_RPC_URLNoRPC endpoint (default: https://api.mainnet-beta.solana.com)
HELIUS_API_KEYYesHelius API key for enhanced RPC and webhooks (also the primary auto-enable trigger)
BIRDEYE_API_KEYYesBirdeye API key for token price and market data
SLIPPAGEYesDefault slippage tolerance for swaps
WALLET_SECRET_SALTNoSalt for wallet key derivation
WALLET_SECRET_KEYNoSecret key for wallet derivation
json
{
  "settings": {
    "secrets": {
      "SOLANA_PRIVATE_KEY": "your-base58-private-key",
      "HELIUS_API_KEY": "your-helius-key",
      "BIRDEYE_API_KEY": "your-birdeye-key"
    }
  }
}

Supported Networks

NetworkRPC URL
Mainnet Betahttps://api.mainnet-beta.solana.com
Devnethttps://api.devnet.solana.com
Testnethttps://api.testnet.solana.com
Helius (enhanced)https://mainnet.helius-rpc.com/?api-key=...

Actions

ActionDescription
TRANSFER_SOLSend SOL to an address or .sol domain
TRANSFER_SPL_TOKENSend SPL tokens to an address
SWAP_TOKENSSwap tokens via Jupiter aggregator
GET_BALANCECheck SOL and SPL token balances
MINT_NFTMint a new NFT using Metaplex
SEND_TRANSACTIONSend a raw Solana transaction
GET_TRANSACTIONLook up a transaction by signature
STAKE_SOLStake SOL with a validator
CREATE_TOKENCreate a new SPL token mint

Providers

ProviderDescription
solanaWalletBalanceCurrent SOL and SPL token balances
solanaWalletAddressThe agent's public key
solanaNFTsNFTs held in the agent's wallet

Jupiter Swaps

Token swaps route through Jupiter, Solana's leading DEX aggregator. Jupiter finds the best price across all Solana DEXes including Raydium, Orca, Whirlpool, and others.

User: "Swap 100 USDC for SOL"
       ↓
Plugin fetches Jupiter quote
       ↓
Best route selected automatically
       ↓
Transaction built and signed
       ↓
Transaction submitted and confirmed
       ↓
Agent reports result

SPL Token Support

The plugin works with any SPL token. Common tokens:

TokenMint Address
USDCEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
USDTEs9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
SOL (wrapped)So11111111111111111111111111111111111111112
JTOjtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL

NFT Support

The plugin uses Metaplex for NFT operations:

User: "Mint an NFT with the image at https://example.com/art.png"
       ↓
Plugin uploads metadata to Arweave/IPFS
       ↓
Metaplex mints the NFT to the agent's wallet
       ↓
Agent reports mint address and transaction signature

Security Considerations

  • The private key grants full control of the agent's Solana wallet. Store it securely using the built-in @elizaos/core secrets runtime.
  • Use a dedicated agent wallet with limited funds.
  • Test on Devnet before deploying to mainnet.

Devnet Configuration

json
{
  "settings": {
    "secrets": {
      "SOLANA_PRIVATE_KEY": "your-base58-private-key",
      "SOLANA_RPC_URL": "https://api.devnet.solana.com"
    }
  }
}

Airdrop devnet SOL for testing:

bash
solana airdrop 2 YOUR_WALLET_ADDRESS --url devnet