An AI-powered assistant that helps you interact with the Stellar blockchain using natural language. Built with the Agno framework and Stellar SDK, it allows you to query account information, check balances, view transactions, and explore the Stellar network without needing to know technical API details.
Available in two interfaces:
- CLI Mode: Terminal-based interactive agent
- Web UI: Beautiful Streamlit web interface with chat interface
- Natural Language Queries: Ask questions about the Stellar blockchain in plain language
- Comprehensive Account Information: Balances, transactions, payments, operations, effects, offers, and trades
- Transaction Details: Look up specific transactions by hash
- Network Statistics: Current network status, fees, and ledger information
- DEX Integration: View active offers and trade history
- AI-Powered: Uses LLMs to understand your questions and format responses clearly
- Agentic Memory: Maintains context across conversations
- Multi-Model Support: Choose between OpenAI (GPT-4o, GPT-4o-mini) or Google (Gemini 2.0, Gemini 1.5)
This project uses uv for dependency management.
# Clone the repository
git clone <repository-url>
cd onchain_analyst
# Install dependencies
uv syncCreate a .env file in the project root:
# Stellar Horizon API endpoint
STELLAR_HORIZON_URL=https://horizon.stellar.org # For mainnet
# STELLAR_HORIZON_URL=https://horizon-testnet.stellar.org # For testnet
# LLM API keys
# For Google Gemini:
GOOGLE_API_KEY=your_key_here
# For OpenAI:
OPENAI_API_KEY=your_key_hereNote for Streamlit Web UI: You can provide API keys directly in the web interface sidebar, no .env file required!
Launch the beautiful web interface with chat functionality:
uv run streamlit run app_streamlit.pyThis will open a web browser with:
- ๐ฌ Interactive chat interface with message history
- โ๏ธ Model configuration sidebar - choose between OpenAI or Google models
- ๐ API Key input - paste your key directly in the UI (no .env needed)
- ๐ Rich markdown responses with formatted data
- ๐๏ธ Clear conversation button to start fresh
Run the command-line interface:
uv run agent.pyAsk questions in natural language:
You: What is the balance of account GAHK7EEG2WWHVKDNT4CEQFZGKF2LGDSW2IVM4S5DP42RBW3K6BTODB4A?
You: How many transactions has account GXXX... made?
You: Show me the last 10 payments for that account
You: Does the account have any active offers on the DEX?
You: What trades has this account completed?
You: Search for the USDC asset
You: What are the current network statistics?
You: Tell me about the most recent ledger
Exit with /quit or /q.
Retrieves complete account information including:
- Account ID and sequence number
- All asset balances (XLM and custom assets)
- Thresholds and flags
- Number of signers
Gets transaction history for an account. Use this to count transactions!
- Transaction hashes
- Fees charged
- Operation counts
- Success/failure status
Fetches payment-specific operations:
- Regular payments
- Account creation operations
- Account merge operations
Lists all operations performed by an account.
Shows state changes (effects) from operations:
- Balance changes (credits/debits)
- Trustline additions/removals
- Account creation effects
Gets active orders on the Stellar DEX:
- Selling/buying assets
- Amounts and prices
- Offer IDs
Retrieves completed trade history:
- Trade pairs
- Amounts exchanged
- Prices
- Trade timestamps
Queries specific asset by code and issuer:
- Total supply
- Number of holders
- Asset flags
Searches for assets by code (e.g., "USDC", "BTC"):
- Multiple issuer results
- Statistics for each
- Authorization flags
Gets detailed information about a specific transaction by hash:
- Ledger number
- Fee charged
- Operation count
- Memo and signatures
Retrieves information about ledgers:
- Current or specific ledger by sequence
- Transaction and operation counts
- Network fees and reserves
- Protocol version
Gets current network statistics:
- Latest ledger info
- Fee statistics (min, mode, p50, p95, p99)
- Network capacity usage
- Base reserve
The application consists of:
-
Agent System (agent.py): Core interactive agent using Agno framework with SQLite-backed memory for context retention.
-
Tools Layer (tools/): 12 specialized tools for querying the Stellar blockchain organized by category:
- Account tools (7): Complete account analysis
- Asset tools (2): Asset search and information
- Transaction tools (1): Transaction lookup
- Network tools (2): Ledger and network statistics
-
Configuration:
config/agent_config.py: Agent role and detailed instructionsconfig/model_config.py: LLM model selection
All tools use the Stellar SDK to communicate with the Horizon API.
- Python >= 3.13
- Dependencies managed by
uv(seepyproject.toml) - API Key from OpenAI or Google (for LLM access)
The web interface (app_streamlit.py) provides:
- Clean, responsive chat interface
- Real-time streaming responses
- Message history preservation
- Markdown formatting for structured data
- Provider Selection: Choose between OpenAI or Google
- Model Selection:
- OpenAI: GPT-4o, GPT-4o-mini, GPT-4-turbo, GPT-3.5-turbo
- Google: Gemini 2.0 Flash, Gemini 1.5 Pro, Gemini 1.5 Flash
- API Key Input: Secure password field for your API key
- Clear Conversation: Reset chat history anytime