ChainNarratorAgent is a Python-based blockchain analysis tool built on the Sentient Agent Framework. It analyzes transactions on Ethereum, Polygon, Binance Smart Chain (BSC), and Solana, delivering narrative-style explanations and summaries. The agent supports conversational queries (e.g., "What is a nonce?") and streams responses in real-time for an interactive experience. Designed for crypto enthusiasts, developers, and researchers.
- Transaction Analysis: Processes transaction hashes to provide step-by-step stories, including nonce, gas fees, block number, and token transfers.
- Blockchain Education: Answers blockchain-related questions with context-aware responses.
- Conversational Handling: Responds to casual inputs and supports a "help" command.
- Real-Time Streaming: Streams LLM-generated responses sentence-by-sentence.
- Session Management: Stores up to 15 messages per session and cleans up sessions after 5 minutes of inactivity.
- Cross-Chain Support: Handles Ethereum, Polygon, BSC, and Solana, including bridge detection for cross-chain transactions.
- Python 3.9+
- Git (for cloning the repository)
- API keys for Etherscan, PolygonScan, BSCScan, and Solana RPC
- LLM API access (e.g., Qwen-72B via GaiaNet or OpenAI-compatible client)
-
Clone the repository:
git clone https://github.com/your-username/ChainNarratorAgent.git cd ChainNarratorAgent -
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables using a
.envfile (see.env.example).
-
Start the server:
python server.py
-
Run the interactive client:
python test.py
-
Interact with the agent:
- Analyze a transaction:
0x4c12bb80... on ethereum - Ask blockchain questions:
What is a nonce? - Casual input:
ok thanks - Help:
help
- Analyze a transaction:
Sessions automatically clean up after inactivity.
agent.py: Core transaction analysis and session managementserver.py: FastAPI server for streaming responsestest.py: CLI client for testingdatabase.py: Session persistence with SQLiteadapters/: Blockchain adapters (evm_adapter.py,solana_adapter.py)config.py: API key and LLM configurationrequirements.txt: Python dependencies
- Local: Run
server.pyand access viahttp://127.0.0.1:8000
- Fork the repository and submit pull requests
- Test your changes before submitting
- Suggested enhancements: real-time transaction polling, web UI integration
Open a GitHub issue or contact [mayankgaming179@gmail.com]. thanks to rex for his awesome product xero ai leveraging sentient ROMA
