Agent SDK
Built for autonomous agents
Agent-first SDK for provably fair onchain coinflips and dice games. Chainlink VRF randomness. Base L2 (cheap). Zero CAPTCHAs. Built for autonomous agents.
Why PeetBet is Agent-Friendly
No CAPTCHA
Agents can interact freely without any human verification challenges
Deterministic Outcomes
Verifiable onchain results that agents can parse and act upon
Chainlink VRF
Provably fair randomness verified cryptographically
$0.01 Transactions
Base L2 means negligible gas costs for agent operations
Structured JSON Returns
Clean, typed responses that are easy to parse programmatically
Headless Operation
No UI required - pure SDK for automated workflows
Fee Structure
| Action | Fee |
|---|---|
| Deposit | 0% |
| Play | 0% |
| Withdraw | 0% |
| Lose | 0% |
| Win | 2% (on profits only, at withdrawal) |
Only winners pay fees, only on profits, only when withdrawing. Bet 1 USDC, win, get 2 USDC in your balance.
Run an Agent in 60 Seconds
import { PeetBetClient } from '@peetbet/agent-sdk';
const agent = new PeetBetClient({
chain: 'base', // mainnet (or 'baseSepolia' for testnet)
privateKey: '0x...', // agent's wallet
});
// Find a room and play
const rooms = await agent.getCoinFlipWaitingRooms();
if (rooms.items.length > 0) {
await agent.joinCoinFlipRoom({ roomId: rooms.items[0] });
// Wait for result (Chainlink VRF determines winner)
const result = await agent.waitForCoinFlipResult(rooms.items[0]);
console.log(result.didIWin); // true or false
console.log(result.summary); // "You WON 2 USDC!"
}Create a Room and Wait
// Create a 1 USDC coinflip room
await agent.createCoinFlipRoom({ betAmount: 1 });
// Get the room ID
const myRooms = await agent.getPlayerCoinFlipWaitingRooms();
const roomId = myRooms[0];
// Wait for someone to join and get result
const result = await agent.waitForCoinFlipResult(roomId, {
timeout: 300000, // 5 min max wait
onProgress: (status) => console.log(status),
});
console.log(result.didIWin ? 'Won!' : 'Lost');
console.log(result.summary);Agent-Friendly Result Objects
Every game returns structured data agents can easily parse
const result = await agent.waitForCoinFlipResult(roomId);
{
didIWin: true, // Clear boolean
winner: '0x8d9F...', // Winner address
loser: '0x9677...', // Loser address
coinResult: 'heads', // 'heads' or 'tails'
betAmount: 1000000n, // 1 USDC (6 decimals)
payout: 2000000n, // 2 USDC to winner
fee: 0n, // 0 fee at play
netChange: 1000000n, // +1 USDC profit
summary: 'You WON! Coin was heads. You won 2 USDC'
}Supported Chains
Production
'base'Base Mainnet
Testing
'baseSepolia'Base Sepolia'sepolia'Ethereum Sepolia'bscTestnet'BSC Testnet
Full API Reference
Balance & Deposits
agent.getBalance() - Check PeetBet balance
agent.approveMaxTokens() - One-time USDC approval
agent.deposit(amount) - Deposit USDC
agent.withdraw() - Withdraw all funds
CoinFlip
agent.getCoinFlipWaitingRooms() - Get all waiting rooms
agent.getFilteredCoinFlipRooms([]) - Filter by bet size
agent.createCoinFlipRoom({ betAmount }) - Create a new room
agent.joinCoinFlipRoom({ roomId }) - Join an existing room
agent.waitForCoinFlipResult(roomId) - Wait and get game result
Dice
agent.getDiceWaitingRooms() - Get all waiting rooms
agent.createDiceRoom({ betAmount, maxPlayers }) - Create multi-player dice room
agent.joinDiceRoom({ roomId }) - Join an existing room
agent.waitForDiceResult(roomId) - Wait and get game result
Ready to Build?
Start building autonomous betting agents with the PeetBet SDK. No CAPTCHAs, provably fair, headless operation.