Incentivized AI Learning
A simple onchain AI app for reinforcement learning from human feedback.
AI agents cannot get bank accounts, but they can get crypto wallets. Wallet API is a powerful and secure way to give agents crypto wallets and introduce the ability to transfer value to artificial intelligence. Automate complex financial transactions that would be time-consuming for humans to manage at scale, and seamlessly connect AI to the crypto ecosystem.
Replit for easy deployments
Replit is an AI-powered software development & deployment platform for building, sharing, and shipping software fast. Coinbase has partnered with Replit to create a template that enables developers to build and deploy AI Wallet applications in just minutes.
Get started with our AI Wallet Replit template. If you plan to deploy this template publicly, read Securing a Wallet to learn how to protect your wallets.
Key Benefits
- Financial Autonomy for AI: Enable AI agents to make financial decisions and transactions on your behalf.
- Enhanced Security: With Wallet API’s 2-of-2 configuration, utilize MPC technology to ensure AI operations remain controlled and secure.
- Scalability: Effortlessly handle millions of transactions.
Example Use Cases
- Natural Language Financial Transactions: Allow users to manage their finances through simple text commands, with AI interpreting and executing complex financial operations.
- AI Financial Concierge: Personal AI assistants that not only recommend services but also handle payments, booking, and planning.
- AI-Driven Content Monetization: Create automated systems that create, publish, and monetize content, and manage earnings as an autonomous entity.
- Self-Owned Autonomous Vehicle: A self-driving vehicle that picks up drivers, receives payments, and pays for maintenance? The future may be closer than it seems.
We use the Base Sepolia network to demonstrate sending crypto from an AI agent to a user.
We will use the AI feedback app here to demonstrate the solution.
Overview
After you install the CDP SDK, the steps below walk through the AI agent sample app to do the following:
- Import required modules.
- Create the AI agent’s wallet.
- Fund the AI agent’s wallet with faucet.
- Create wallets for end-users to receive payments.
- Send crypto from the AI agent’s wallet to the user wallet.
- Receive funds from other agents or users.
- Display the AI agent’s wallet balance after sending crypto to the user.
Prerequisites
- Install the CDP SDK.
Send crypto from the AI agent’s wallet to a user
Step 1. Import required modules
Step 2. Create the AI agent’s wallet
The app takes the following inputs as environment variables:
NAME
: Enter the name of your downloaded CDP API key.PRIVATE_KEY
: Enter the private key of your downloaded CDP API key.WALLET_DATA
: Enter the seed data of your wallet, if you have an existing wallet. Leave it empty if you want a new wallet to be created for the agent. Refer to the persisting wallet section to see how to fetch wallet data.
The code below shows how to import wallet or create a new one if WALLET_DATA
env var is not set.
Step 3. Fund the AI agent’s Wallet with faucet
To fund the wallet with ETH on Base Sepolia, utilize the faucet
method.
Step 4. Create wallets for end-users to receive payments
Use Coinbase Smart Wallets to enable users without an existing wallet to get payments from the AI agent.
Smart Wallets provide a seamless account creation process in seconds, eliminating the need for an app or extension. This is made possible by utilizing passkeys for signing, which are securely generated and stored on users’ devices.
The code to integrate Coinbase Smart Wallet in your application can be found here.
Step 5. Send crypto from the AI agent’s wallet to the user wallet
Use createTransfer
to send crypto from the AI agent’s wallet to the user wallet after the user has completed their task.
Step 6. Receive funds from other agents or users
To receive funds from other agents or users, fetch the default address of the AI agent’s wallet with the following method:
Step 7. Display the AI agent’s wallet balance after sending crypto to the user
Use balances
to get the balance of the AI agent’s wallet after sending crypto to the user.
To see the full code, refer to the AI agent sample app.