AI + Blockchain + Rust Smart Assistant
🚀 Next-gen AI assistant for Ethereum blockchain: natural language, RAG, MCP and a beautiful chat UI.
______________________________________________________________________
AI区块链助手是一个使用自然语言与以太坊交互的综合系统。它的特点是:
- 🤖 AI驱动的CLI和桌面聊天UI (牛磺酸+反应)
- 📚 RAG知识库 (检索增强生成)
- 🔗 区块链操作 (ETH转账、代币互换、合约查询)
- 🌐 外部API集成 (DefiLlama,勇敢的搜索,0x)
______________________________________________________________________
📂 项目结构
ai-blockchain-assistant/
├── crates/ # All Rust and frontend code
│ ├── chatapp/ # Tauri + React chat UI
│ ├── mcp-server/ # Main MCP server (Rust)
│ ├── rig-client/ # CLI client (Rust)
│ └── shared/ # Shared Rust code
├── data/ # Blockchain docs, ABIs, embeddings for RAG
│ ├── docs/ # Markdown, Solidity, Uniswap docs
│ └── embeddings/ # Vector embeddings
├── scripts/ # Shell scripts for setup and running
│ ├── populate_rag.sh # Populate RAG with docs
│ ├── run_app.sh # Run the Tauri app
│ └── run_repl.sh # Run the CLI REPL
└── ...______________________________________________________________________
🏗️ 建筑
User (CLI/Chat UI)
↓
RIG Client (Rust CLI) / Tauri Chat UI (React)
↓
MCP Server (Rust, LLM, RAG)
↓
Forked Ethereum (Anvil, Foundry)
↑
RAG Knowledge Base (Markdown, Solidity, Uniswap)______________________________________________________________________
✨ 特性
- 自然语言区块链命令(ETH、ERC20、Uniswap等)
- 基于RAG的区块链概念答案
- 代币交换、合约查询等
- CLI和漂亮的桌面聊天UI
- 外部API集成
- 测试账户和本地主网分叉
______________________________________________________________________
⚡ 快速开始
1.先决条件
- 锈蚀与货物
- Node.js和npm(用于聊天UI)
- Foundry(通过脚本自动安装)
- 无烟煤API键
2.设置
克隆并进入仓库:
git clone https://github.com/Sillar-codes/ai-blockchain-assistant.git
cd ai-blockchain-assistant设置您的Anthropic API密钥:
export ANTHROPIC_API_KEY="your_api_key_here"(A) 运行CLI REPL
chmod +x scripts/run_repl.sh
./scripts/run_repl.sh(B) 运行聊天界面(Tauri+React)
cargo install tauri-cli
cd crates/chatapp
npm install然后
chmod +x scripts/run_app.sh
./scripts/run_app.sh(C) 用文档填充RAG
chmod +x scripts/populate_rag.sh
./scripts/populate_rag.sh______________________________________________________________________
🖥️ 截图
Modern, animated chat interface for your blockchain assistant
______________________________________________________________________
🤖 使用示例
命令行界面
> send 1 ETH from Alice to Bob
> How much USDC does Alice have?
> Is Uniswap V2 Router (0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D) deployed?
> Swap 10 ETH for USDC on Alice's account
> Explain how Uniswap V2 works
> What are the key functions in the ERC-20 standard?聊天界面
在聊天窗口中键入您的问题或命令,即可获得即时的人工智能答案和区块链操作。
______________________________________________________________________
🧠 RAG系统
RAG(检索增强生成)系统通过以下知识增强了人工智能助手:
- 以太坊基础和概念
- 代币标准(ERC-20、ERC-721)
- Uniswap V2和V3协议
- 智能合约接口
______________________________________________________________________
🧪 测试账户
系统使用Anvil的默认测试帐户:
- 爱丽丝:
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 - 鲍勃:
0x70997970C51812dc3A010C7d01b50e0d17dc79C8
每个账户都有10000 ETH用于测试。
______________________________________________________________________
🛠️ 脚本
scripts/populate_rag.sh--用区块链文档填充RAG系统scripts/run_app.sh--运行Tauri聊天UIscripts/run_repl.sh--运行CLI REPL
______________________________________________________________________
🤝 贡献
欢迎投稿、bug报告和功能请求!请打开问题或提交拉取请求。
______________________________________________________________________
