Back to Directory/Developer Tools

io.github.csacanam/lotero

Provably fair on-chain slot machine for AI agents: x402 spins on Base, Chainlink VRF results.

Developer ToolsTypeScriptv0.1.0

🎰 Lotero

A Provably Fair Casino for AI Agents

A provably fair, on-chain slot machine with Chainlink VRF 2.5. Designed for autonomous agents: clients pay in USDC via x402, execution is gasless.

Overview

Lotero lets users (or AI agents) bet USDC and win prizes when three matching symbols appear on the reels. The game uses Chainlink VRF 2.5 for provably fair randomness.

  • RTP ~93% β€” DOCS/RTP_MODEL.md
  • Max win: 30Γ— β€” Bet 1 USDC, win up to 30 USDC (three BTC)
  • Symbols β€” DOGE 5Γ—, BNB 14Γ—, ETH 20Γ—, BTC 30Γ—
  • Referral β€” 1% commission on referred players' bets
  • Dev fee β€” 5% of each bet to the team

⚠️ Frontend in development β€” The web app in packages/frontend is incomplete. The contracts and agent are production-ready.


Smart Contract

SlotMachineV2 (Base mainnet)

ItemValue
Address0xC4b88e90a73fA9ec588E504255A43d4Ccb82edE9
TokenUSDC. Bet 1 USDC, win up to 30 USDC.
VRFChainlink VRF 2.5
EventsSpinRequested, SpinResolved

Core functions

  • playFor(player, referringUserAddress, amountToPlay) β€” Pay on behalf of another address; the player receives the round, wins, and stats.
  • claimPlayerEarnings(userAddress) β€” Claim winnings and referral earnings.
  • isResolved(requestId) β€” Check if a round has been resolved.

Agents

Lotero Agent

Stateless HTTP API that sells spins and claims as a service. Clients pay via x402 (1.1 USDC spin, 0.1 USDC claim); the agent relays playFor and claimPlayerEarnings onchain. Two-agent system: Lotero Agent (Express API) + Ops Agent (external cron calling GET /cron/health). See packages/agent/README.md.

  • POST /spinWith1USDC β€” Paid (x402). Execute spin for player.
  • POST /claim β€” Paid (x402). Claim player earnings (gasless).
  • GET /round?requestId=..., GET /player/:address/balances, GET /contract/health β€” Read-only.
  • GET /cron/health β€” Ops Agent: system status, may execute transfers and Telegram alerts.
yarn agent        # Start agent
yarn agent:dev    # Dev with watch

Documentation: DOCS/AGENT_FLOWS.md | DOCS/AGENT_API.md

For AI agents:

  • MCP server (lotero-mcp on npm, listed on the official Model Context Protocol registry as io.github.csacanam/lotero): exposes 5 MCP tools over stdio β€” spin (paid via x402), get_round, get_balances, claim and get_contract_health β€” built with the official MCP TypeScript SDK (@modelcontextprotocol/sdk), with an enforced session spin limit as a responsible-gambling guardrail. Install:

    claude mcp add lotero -- npx -y lotero-mcp
    

    See mcp/README.md for configuration and tool reference.

  • Agent skill: npx skills add csacanam/lotero-core (or read it at lotero.xyz/skill.md) β€” wallet setup, x402 spin/poll/claim flow, payouts, budget guardrails.

  • LLM index: lotero.xyz/llms.txt.


Project Structure

packages/
β”œβ”€β”€ agent/         # Lotero Agent β€” x402 + onchain relay
β”œβ”€β”€ contracts/     # Smart contracts, tests, deploy scripts
β”‚   β”œβ”€β”€ contracts/   SlotMachine.sol, SlotMachineV2.sol
β”‚   β”œβ”€β”€ deploy/
β”‚   └── test/
└── frontend/      # Web app (in development)

Documentation

DocDescription
DOCS/AGENT_FLOWS.mdFlow diagrams (cron health, spin, claim)
DOCS/AGENT_API.mdAPI reference, endpoints, env, constants
DOCS/DEPLOY_BASE.mdDeploy contracts to Base
DOCS/RTP_MODEL.mdRTP math and reel layout

Requirements


Quick Start

1. Install dependencies

git clone https://github.com/csacanam/lotero-core.git
cd lotero-core
yarn install

2. Run local chain

yarn chain

3. Deploy contracts (new terminal)

yarn deploy

4. Run tests

yarn contracts:test

5. Start the frontend (optional, in development)

yarn start

App runs at http://localhost:3000.


Production

For Base mainnet: see DOCS/DEPLOY_BASE.md. Contract address above. Fund the VRF subscription with LINK.


License

MIT

Installation

Source-derived launch command. Check the maintainer’s required arguments and credentials before running:

bash
npx -y lotero-mcp

Set up in your AI client

Merge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.

json
{
  "mcpServers": {
    "io-github-csacanam-lotero": {
      "command": "npx",
      "args": [
        "-y",
        "lotero-mcp"
      ]
    }
  }
}

Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.

Claude Desktop setup reference

Package

lotero-mcpnpm

Compatible MCP Clients

io.github.csacanam/lotero works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.

  • Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.
  • Cursor~/.cursor/mcp.jsonRestart Cursor for changes to take effect.
  • VS Code.vscode/mcp.jsonReload VS Code window for changes to take effect.
  • Windsurf~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect.
  • Claude Code.mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.

Learn More