An experimental playground for autonomous onchain interactions.
Based Agent helps LLM agents directly interact with the blockchain, built on top of the Coinbase Developer Platform (CDP) and OpenAI's Swarm.
- Autonomous execution: The agent thinks, decides, and acts onchain autonomously.
- Token deployement: Create and manage ERC-20 tokens.
- NFT Deployment: Deploy and mint NFTs.
- Asset transfers: Transfer assets between addresses without manual intervention.
- Balance checks: Keep tabs on wallet balances.
- ETH faucet requests: Automatically request testnet ETH when needed.
- Art generation via DALL-E: Generate artwork using AI.
Imagine an AI agent that not only interacts with the blockchain but does so creatively and autonomously. Whether you're a developer, an artist, or someone curious about AI, Based Agent offers a unique and exciting playground to:
- Experiment with autonomous agent capabilities.
- Explore on-chain actions without manual coding.
- Understand the potential of AI onchain.
- Python 3.7+
- Replit Core Account (optional, but recommended for easy setup). Contact [email protected] for a free uppgrade (just mention coinbase)
Add your secrets to Replit's Secret Manager or set them as environment variables:
CDP_API_KEY_NAME
: Your CDP API key name.CDP_PRIVATE_KEY
: Your CDP private key.OPENAI_API_KEY
: Your OpenAI API key.
You can get the Coinbase Developer Platform API key here: https://portal.cdp.coinbase.com/ And the OpenAI key here: https://platform.openai.com/api-keys (note you will need to have a paid account)
After adding your API Keys to the Secrets pane, you start the agent by pressing the green "▶ Run" Button at the top of the editor
Alternatively, you can start the based agent manually by navigating to the Replit shell and running:
python run.py
The Based Agent will start its autonomous loop:
- Wakes up every 10 seconds.
- Chooses an onchain action based on its capabilities.
- Executes the action onchain.
- Prints results in a human-readable format.
Based Agent makes decisions and interacts with the blockchain autonomously. Here's what happens under the hood:
- Decision making: The agent decides what action to perform next.
- Onchain interaction: Executes blockchain transactions using the CDP SDK.
- Art generation: If needed, generates art using OpenAI's DALL-E.
- Feedback loop: Analyzes results and plans the next action.
Unlock a world of possibilities with these built-in functions:
create_token(name, symbol, initial_supply)
: Create a new ERC-20 token.transfer_asset(amount, asset_id, destination_address)
: Transfer assets to a specific address.get_balance(asset_id)
: Check the wallet balance of a specific asset.
deploy_nft(name, symbol, base_uri)
: Deploy a new ERC-721 NFT contract.mint_nft(contract_address, mint_to)
: Mint an NFT to a specified address.
request_eth_from_faucet()
: Request ETH from the Base Sepolia testnet faucet.generate_art(prompt)
: Generate art using DALL-E based on a text prompt.
create_liquidity_pool(token0_address, token1_address, fee_tier, amount0, amount1)
: Create a Uniswap V3 liquidity pool and add initial liquidity.
Curious to see Based Agent in action? Here's a sneak peek:
Starting autonomous Based Agent loop...
System: It's been 10 seconds. I want you to do some sort of onchain action based on my capabilities. Let's get crazy and creative!
Based Agent: I've decided to deploy a new NFT collection!
deploy_nft(name="Cyber Artifacts", symbol="CYART", base_uri="https://example.com/metadata/")
Successfully deployed NFT contract 'Cyber Artifacts' (CYART) at address 0xABC123... with base URI: https://example.com/metadata/
Based Agent uses:
- Coinbase Developer Platform SDK: For seamless onchain interactions.
- OpenAI Swarm: Powers the agent's autonomous decision-making.
- DALL-E: Generates art from textual descriptions.
This project is for educational purposes only. Do not use with real assets or in production environments. Always exercise caution when interacting with blockchain technologies.
We welcome contributions! If you have ideas, suggestions, or find issues, feel free to:
- Open an issue on our main GitHub repository: Swarm-CDP-SDK.
- Submit a pull request with your enhancements.
Have questions or need assistance?
- Lincoln Murr: [email protected]
- Kevin Leffew: [email protected]
- Coinbase Developer Platform: Documentation
- OpenAI Swarm: Learn More
- Base: Explore Base
Based Agent is made possible thanks to:
- Coinbase Developer Platform SDK: Documentation
- OpenAI Swarm (experimental): Documentation
- Community Contributors
Unleash the power of AI on the blockchain with BasedAgent! 🚀
Happy Building! 👩💻👨💻
DISCLAIMER HERE?