This agent is designed to interact with a Coinflip game on the blockchain. It allows users to:
- Place bets on heads or tails
- Check game results
- View round information
- Get random bet suggestions
- Check their balance
The agent uses Gelato for gasless transactions, making the gaming experience seamless for users.
- Node.js 23+
- pnpm
- A wallet with some testnet ETH
- Gelato Relay API key (get it from Gelato)
- Clone and checkout the correct branch:
git clone https://github.com/gelatodigital/coinflip-ai-agent-eliza
cd eliza
git checkout update-gelato-plugin
- Set up your environment variables:
cp .env.example .env
- Configure the following required variables in your
.env
:
EVM_PRIVATE_KEY=your_wallet_private_key
EVM_PROVIDER_URL=your_rpc_url
GELATO_RELAY_API_KEY=your_gelato_api_key
- Install dependencies and build:
pnpm install
pnpm run build
- Start the agent:
pnpm run start
- In a new terminal, start the client interface:
pnpm run start:client
- Open your browser and navigate to the URL shown in the terminal (usually http://localhost:3000)
The agent responds to the following commands:
bet 0.01 heads
- Place a bet of 0.01 ETH on headsbet 0.01 tails
- Place a bet of 0.01 ETH on tailspick for me
- Get a random bet suggestionbalance
- Check your current balanceshow round
- View current round informationdid i win
- Check if you won your last betcheck result 123
- Check results for round number 123
- All transactions are gasless thanks to Gelato integration
- The game is running on the Sepolia testnet
- Minimum bet is 0.01 ETH
- Maximum bet is 0.05 ETH
- Each round has a time limit for betting
The game uses Gelato's Web3 Functions and VRF (Verifiable Random Function) for automation and randomness:
- Event Detection & Bet Processing - Web3 function that monitors events and processes bets
- VRF Round Resolution - Task that provides verifiable randomness for round resolution
If you encounter issues:
- Ensure your wallet has enough testnet ETH
- Verify your environment variables are correctly set
- Make sure you're on the correct branch (
update-gelato-plugin
) - Try cleaning the project and rebuilding:
pnpm clean
pnpm install
pnpm build
For additional help: