Launching Tokens on Celo using Gaia AI Agent Framework
Prerequisites
- Node (v20 or higher)
- A wallet with some test tokens (more on this later)
Create a Wallet and get your Gaia API Keys
- Visit the Gaia Homepage and click
Launch App
. - Click
Connect
, then install the MetaMask extension. - Once installed, create your wallet and securely store your recovery keys.
- Finally, navigate to Gaia API Keys to generate your API keys.
Create you Celo Private Key
- Install the [Celo CLI](npm install -g @celo/celocli)
- Make sure you're working on Alfajores network
celocli config:set --node https://alfajores-forno.celo-testnet.org/
- Create an account and store it well formatted in an .env file
celocli account:new | sed -E 's/: (.+)/="\1"/g' | grep '=' > .env`
source .env
- Copy the account address to your clipboard
echo $accountAddress | pbcopy
- Head to the faucet to get some money and paste your account address there
open https://faucet.celo.org
- Verify you got money successfully
celocli account:balance $accountAddress
- Register your account
celocli account:register --from $accountAddress -k $privateKey
If you open your .env
file, you will find your Celo private key
Clone the Celo Meme Token Generator
- Clone this repository
git clone https://github.com/harishkotra/celo-token-agent
cd celo-token-agent
- Install dependencies
npm install
- Create a .env file:
PRIVATE_KEY=your_celo_private_key
GAIA_API_KEY=your_gaia_api_keys
- Compile the contract
npx hardhat compile
- Deploy your token
node deploy.js
The script will
- Generate a token name
- Check your balance
- Deploy the contract
- Provide you with the contract address and transaction details
Understanding the Code
The project uses three main components
- Token Generation
(tokenGenerator.js)
- Generates creative token names
- Uses AI with a fallback to random generation
- Configures initial token supply
- Contract Deployment
(tokenDeployer.sol)
- Uses viem to interact with Celo
- Handles gas estimation and transaction monitoring
- Provides deployment status updates
- Smart Contract
(tokenDeployer.js)
- Standard ERC20 implementation
- Built with OpenZeppelin for security
- Deployable to Celo's Alfajores testnet
Example response
Generated fallback token: { name: 'Mega Gem', symbol: 'MG' }
Reading artifacts from: /Users/blag/Documents/GitHub/celo-token-agent/artifacts/contracts/MemeToken.sol/MemeToken.json
Deploying from account: 0x5A96d23F76440C099F22327D1324786f6abe459A
Account balance:
A-CELO: 1.08303052 A-CELO
Sending deployment transaction...
Transaction sent! Hash: 0x035457c46ef5118db065b0a2ccc6bae1ce62f1c8ef688bbaf2d2596a6dd0fbd8
Deployment confirmed in block: 38170881
Token deployed successfully!
{
name: 'Mega Gem',
symbol: 'MG',
address: '0x5e473F7650ABD9B6A5b28b2B0B64ebBd1ef01D94',
transactionHash: '0x035457c46ef5118db065b0a2ccc6bae1ce62f1c8ef688bbaf2d2596a6dd0fbd8',
explorer: 'https://alfajores.celoscan.io/address/0x5e473F7650ABD9B6A5b28b2B0B64ebBd1ef01D94'
}
Support
Join the Celo Discord server. Reach out in the #general-dev channel with your questions and feedback.