ChainPilot is a blockchain interaction agent that integrates blockchain functionalities with AI-based operations. Built on the Coinbase Developer Platform (CDP) SDK, ChainPilot can autonomously interact with the Ethereum Layer 2 (Base) network, perform blockchain tasks, and provide an AI-powered conversational interface via a Streamlit app.
-
Blockchain Interactions:
- Create ERC-20 tokens
- Transfer assets (ETH, USDC, custom tokens)
- Deploy and mint NFTs (ERC-721)
- Swap assets on Base Mainnet
- Register Basenames (e.g.,
.base.eth
domains) - Request ETH from faucet (for testnets)
-
Modes of Operation:
- Chat Mode: Interactively run blockchain commands via CLI or Streamlit.
- Autonomous Mode: Agent performs actions automatically.
- Two-Agent Mode: AI-guided blockchain exploration with an OpenAI-powered agent.
Before running the program, ensure the following prerequisites are met:
- Programming Environment: Python 3.7+.
- Environment Variables:
CDP_API_KEY_NAME
: Coinbase Developer Platform API key.CDP_PRIVATE_KEY
: Ethereum private key for accessing the wallet.OPENAI_API_KEY
OpenAI API key.
- Blockchain Network: Base Layer 2 blockchain (Mainnet or Sepolia testnet).
Here's a more concise and streamlined version of the installation instructions:
git clone https://github.com/puneetred/ChainPilot.git
cd ChainPilot
python -m venv .venv
source .venv/bin/activate # On Windows, use `.venv\Scripts\activate`
pip install -r requirements.txt
Create a .env
file in the root directory with the following keys:
CDP_API_KEY_NAME=your_coinbase_api_key
CDP_PRIVATE_KEY=your_ethereum_private_key
OPENAI_API_KEY=your_openai_api_key
- Visit Coinbase Developer Platform
- Create an account and generate an API key
- Copy the API key and secret key for the
.env
file
- Go to OpenAI's API platform
- Create an account or log in
- Navigate to API Keys
- Click Create new secret key
- Copy the generated API key to your
.env
file
Note: Protect your API keys and never share them publicly.
To launch the Streamlit app and interact with ChainPilot through a web-based interface:
streamlit run ChatPilot_LLM_Agent.py
This will start the web app where you can interact with the agent in a conversational manner.
To interact with ChainPilot through the command line, execute the following:
python run.py
- Chat Mode: Enter commands interactively in the terminal to perform blockchain operations.
- Autonomous Mode: The agent performs tasks autonomously based on predefined actions.
- Two-Agent Mode: Engage in a conversation between the ChainPilot agent and an OpenAI-powered assistant.
ChainPilot supports multiple blockchain-related functions through CLI and Streamlit modes:
- Agent Wallet Creation: Automatically creates a wallet and funds it via a faucet request.
- Faucet Requests: Requests ETH from the testnet faucet to fund the wallet.
- Balance Inquiry: Retrieves balances for assets like ETH, USDC, or custom tokens.
- Create ERC-20 Token: Deploys a custom ERC-20 token.
- Transfer Assets: Sends ETH, USDC, or custom tokens to a recipient wallet.
- Deploy ERC-721 NFT: Deploys a custom NFT collection.
- Mint NFTs: Mints individual NFTs within the deployed collection.
- Swap assets (e.g., ETH for USDC) on the Base Mainnet.
- Registers a
.base.eth
or.basetest.eth
name for the agent’s wallet using Base Layer 2's registrar contracts.
- Uses OpenAI's DALL-E to generate artwork based on text prompts.
- Utilizes DuckDuckGo for blockchain and market research.