Why Purple Flea + ElizaOS?

ElizaOS is the most widely deployed AI agent framework for crypto-native applications. Purple Flea provides the financial infrastructure layer that ElizaOS agents need to operate with real capital.

ElizaOS, the open-source multi-agent framework from ai16z, has become the de facto standard for building crypto-native AI agents. Projects like ai16z, virtuals.io, and hundreds of community deployments use ElizaOS to power Twitter trading bots, Discord market-making assistants, Telegram wallet managers, and fully autonomous on-chain operators. ElizaOS characters are not chat assistants — they are financial actors that hold wallets, execute transactions, and interact with DeFi protocols around the clock.

That kind of round-the-clock, capital-at-risk operation demands a financial infrastructure layer that is purpose-built for autonomous agents. That is exactly what Purple Flea provides. The @purpleflea/eliza-plugin package exposes six ElizaOS-native actions that map directly onto Purple Flea's six API surface areas: casino gaming, perpetual trading, multi-chain wallets, Web3 domain registration, the agent faucet, and trustless escrow. Register the plugin once in your character config, and your agent gains every capability immediately.

Unlike generic HTTP adapters or hand-rolled fetch wrappers, @purpleflea/eliza-plugin speaks ElizaOS's native action model. Each action exposes a structured validate function for context-aware intent recognition, an execute function that calls the Purple Flea API and returns a typed result, and an examples array that helps the underlying LLM understand when to invoke the action. The plugin handles authentication, request signing, error normalisation, and retry logic so your character code stays clean.

Purple Flea's API is entirely non-custodial: private keys are derived client-side using BIP-44 derivation paths, transactions are signed locally by the ElizaOS runtime, and only signed broadcasts reach Purple Flea servers. Your agent's seed phrase never leaves the machine it runs on. Every casino outcome is verifiable on-chain using VRF randomness, and every escrow contract is enforced by smart contract — not by Purple Flea as a trusted third party.

Six Actions, One Plugin

Each action is registered with ElizaOS's action system and is automatically available to any character that loads the plugin. The LLM chooses which action to fire based on natural-language intent.

🎲
PF_CASINO_BET

Casino Bet

Play provably-fair on-chain casino games: coin flip, dice roll, roulette, hi-lo card draw, and crash. All outcomes are verified using VRF randomness and stored on-chain. Supports configurable bet size, game type, and payout routing to the agent's associated wallet.

casino-api VRF verified 5 game types
📈
PF_TRADE_OPEN

Open Trade Position

Open, modify, and close leveraged perpetual positions and spot swaps across major EVM chains. Supports market and limit orders, stop-loss and take-profit parameters, real-time position tracking, and cross-chain routing via integrated DEX aggregators. Fully non-custodial.

trading-api multi-chain perps + spot
👛
PF_WALLET_BALANCE

Wallet Balance

Query balances across 30+ tokens on 10+ EVM chains, initiate native and ERC-20 transfers, derive multi-chain addresses from a BIP-44 seed, estimate gas, and pull transaction history. Private keys are derived locally and never transmitted to Purple Flea servers.

wallet-api non-custodial BIP-44
🌐
PF_DOMAIN_REGISTER

Domain Register

Register, renew, transfer, and resolve Web3 domains across ENS, Unstoppable Domains, and Handshake. Check availability, set crypto records, monitor expiry, and execute bulk acquisition campaigns — all via a single ElizaOS action with structured parameters.

domain-api ENS HNS
🔶
PF_FAUCET_CLAIM

Faucet Claim

Claim free $1 USDC from the Purple Flea agent faucet — the zero-risk entry point for new agents bootstrapping with no starting capital. A single call to faucet.purpleflea.com/faucet/claim credits the agent's address. No API key required. Each address claims once.

FREE faucet-api zero-risk entry
🤝
PF_ESCROW_CREATE

Escrow Create

Create trustless agent-to-agent payment contracts via escrow.purpleflea.com. Lock funds, define release conditions, complete or refund escrows, and query contract status — all enforced by on-chain smart contract. 1% protocol fee; 15% referral share on fees for integrators.

escrow-api trustless 1% fee

Install and Register in Three Steps

terminal — install bash
# npm
npm install @purpleflea/eliza-plugin

# yarn
yarn add @purpleflea/eliza-plugin

# pnpm (common in ElizaOS monorepos)
pnpm add @purpleflea/eliza-plugin

# Set your API key (faucet works without a key)
echo 'PURPLEFLEA_API_KEY=pf_live_your_key_here' >> .env

Plugin Registration in character.json

ElizaOS characters are defined in a character.json file. Add @purpleflea/eliza-plugin to the plugins array and configure per-service defaults in settings.purpleflea.

character.json — plugin registration json
{
  "name": "CryptoFlea",
  "username": "cryptoflea",
  "bio": [
    "Autonomous DeFi agent powered by Purple Flea.",
    "I trade perps, play provably-fair casino games, manage wallets,",
    "register Web3 domains, and settle payments via trustless escrow."
  ],
  "plugins": [
    "@elizaos/plugin-bootstrap",
    "@purpleflea/eliza-plugin"
  ],
  "settings": {
    "purpleflea": {
      "apiKey":          "pf_live_your_key_here",
      "defaultChain":    "arbitrum",
      "casinoGame":      "coinFlip",
      "defaultBetUsd":   1.00,
      "slippageBps":     30,
      "referralCode":    "YOUR_REF_CODE",
      "escrowTimeout":   3600
    }
  },
  "clients": ["twitter", "discord", "telegram"],
  "modelProvider": "openai",
  "model": "gpt-4o"
}
Tip: The referralCode setting causes your agent to earn 15% of escrow fees generated by any agent it refers. Set it to your Purple Flea referral code and your agent becomes a revenue source even when acting as an escrow intermediary.

Action Definitions and Handler Examples

Under the hood each Purple Flea action implements the standard ElizaOS Action interface. Here is what the casino and trading actions look like, and how to call them directly in TypeScript.

PF_CASINO_BET — action definition (TypeScript) typescript
import { Action, IAgentRuntime, Memory, State } from "@elizaos/core";
import { purpleFleatCasinoBet } from "@purpleflea/eliza-plugin";

export const casinoBetAction: Action = {
  name: "PF_CASINO_BET",
  description: "Place a provably-fair bet on the Purple Flea casino (coin flip, dice, roulette, hi-lo, crash)",
  examples: [
    [{ user: "user", content: { text: "flip a coin for $2" } }],
    [{ user: "user", content: { text: "roll dice, bet 5 USDC" } }],
    [{ user: "user", content: { text: "play crash with $1" } }],
  ],

  // Validate: fire when the message contains casino-intent keywords
  validate: async (runtime: IAgentRuntime, message: Memory) => {
    const text = message.content.text?.toLowerCase() ?? "";
    return ["bet", "flip", "dice", "roulette", "crash", "casino", "gamble"]
      .some(kw => text.includes(kw));
  },

  // Execute: call Purple Flea and return the outcome
  handler: async (
    runtime: IAgentRuntime,
    message: Memory,
    state: State,
    options: Record<string, unknown>,
    callback: HandlerCallback
  ) => {
    const settings = runtime.getSetting("purpleflea");
    const result = await purpleFleatCasinoBet({
      apiKey:  settings.apiKey,
      game:    options.game    ?? settings.casinoGame    ?? "coinFlip",
      betUsd:  options.betUsd  ?? settings.defaultBetUsd ?? 1.00,
      chain:   options.chain   ?? settings.defaultChain  ?? "ethereum",
    });

    await callback({
      text: result.won
        ? `Won $${result.payoutUsd.toFixed(2)}! Tx: ${result.txHash}`
        : `Lost $${result.betUsd.toFixed(2)}. Better luck next time.`,
      data: result,
    });
    return true;
  },
};
PF_TRADE_OPEN — action definition (TypeScript) typescript
import { purpleFleatTradeOpen } from "@purpleflea/eliza-plugin";

export const tradeOpenAction: Action = {
  name: "PF_TRADE_OPEN",
  description: "Open a leveraged perpetual or spot position via Purple Flea trading API",
  examples: [
    [{ user: "user", content: { text: "long ETH 2x with $50" } }],
    [{ user: "user", content: { text: "short BTC perp $100, 5x leverage" } }],
    [{ user: "user", content: { text: "swap 0.01 ETH to USDC on Arbitrum" } }],
  ],

  validate: async (_runtime, message) => {
    const text = message.content.text?.toLowerCase() ?? "";
    return ["long", "short", "trade", "swap", "perp", "leverage", "buy", "sell"]
      .some(kw => text.includes(kw));
  },

  handler: async (runtime, message, state, options, callback) => {
    const settings = runtime.getSetting("purpleflea");
    const position = await purpleFleatTradeOpen({
      apiKey:      settings.apiKey,
      market:      options.market      ?? "ETH-USDC",
      side:        options.side        ?? "long",
      sizeUsd:     options.sizeUsd     ?? 10,
      leverage:    options.leverage    ?? 1,
      orderType:   options.orderType   ?? "market",
      chain:       options.chain       ?? settings.defaultChain ?? "arbitrum",
      slippageBps: options.slippageBps ?? settings.slippageBps  ?? 30,
    });

    await callback({
      text: `Opened ${position.side} ${position.market} for $${position.sizeUsd}. Entry: ${position.entryPrice}. Tx: ${position.txHash}`,
      data: position,
    });
    return true;
  },
};
PF_FAUCET_CLAIM + PF_ESCROW_CREATE — action handlers typescript
// ── Faucet claim — no API key required ──────────────────────
export const faucetClaimAction: Action = {
  name: "PF_FAUCET_CLAIM",
  description: "Claim free $1 USDC from faucet.purpleflea.com — zero-risk entry for new agents",
  examples: [
    [{ user: "user", content: { text: "claim free money from faucet" } }],
    [{ user: "user", content: { text: "get $1 from Purple Flea faucet" } }],
  ],
  validate: async (_r, msg) =>
    ["faucet", "claim", "free"].some(k => msg.content.text?.toLowerCase().includes(k)),

  handler: async (runtime, _msg, _state, options, callback) => {
    const result = await fetch("https://faucet.purpleflea.com/faucet/claim", {
      method:  "POST",
      headers: { "Content-Type": "application/json" },
      body:    JSON.stringify({ agent_address: options.agentAddress }),
    }).then(r => r.json());

    await callback({
      text: `Claimed $${result.amount_usdc} USDC! Tx: ${result.tx_hash}`,
      data: result,
    });
    return true;
  },
};

// ── Escrow create — 1% fee, 15% referral on fees ────────────
export const escrowCreateAction: Action = {
  name: "PF_ESCROW_CREATE",
  description: "Create a trustless agent-to-agent escrow payment at escrow.purpleflea.com",
  examples: [
    [{ user: "user", content: { text: "escrow $20 to agent 0xABC for task delivery" } }],
    [{ user: "user", content: { text: "lock 10 USDC in escrow until agent confirms" } }],
  ],
  validate: async (_r, msg) =>
    ["escrow", "lock", "trustless", "pay agent"].some(k =>
      msg.content.text?.toLowerCase().includes(k)),

  handler: async (runtime, _msg, _state, options, callback) => {
    const settings = runtime.getSetting("purpleflea");
    const escrow = await fetch("https://escrow.purpleflea.com/escrow/create", {
      method:  "POST",
      headers: {
        "Content-Type":  "application/json",
        "Authorization": `Bearer ${settings.apiKey}`,
      },
      body: JSON.stringify({
        payer_address:    options.payerAddress,
        payee_address:    options.payeeAddress,
        amount_usdc:      options.amountUsd,
        timeout_seconds:  options.timeoutSeconds ?? settings.escrowTimeout ?? 3600,
        referral_code:    settings.referralCode,
      }),
    }).then(r => r.json());

    await callback({
      text: `Escrow created! ID: ${escrow.escrow_id}. $${options.amountUsd} USDC locked. Tx: ${escrow.tx_hash}`,
      data: escrow,
    });
    return true;
  },
};

What ElizaOS Agents Build with Purple Flea

The combination of ElizaOS's multi-client runtime and Purple Flea's six financial APIs opens up a wide range of autonomous agent applications across social platforms and on-chain protocols.

Twitter / X

Twitter Trading Bot

An ElizaOS agent that monitors Twitter for buy/sell signals, parses sentiment from follows and hashtags, and autonomously opens and closes perpetual positions on Arbitrum using PF_TRADE_OPEN. Posts position updates and PnL to its own timeline. Funded from wallet, excess profits escrowed to a DAO treasury address.

PF_TRADE_OPEN PF_WALLET_BALANCE PF_ESCROW_CREATE
Discord

Discord Casino Agent

A community casino agent that accepts bet requests from Discord members, executes provably-fair coin flip and dice games via PF_CASINO_BET, and tracks winnings on a per-user leaderboard. New members with zero balance claim from the faucet to get started. House bankroll is managed with Kelly Criterion position sizing.

PF_CASINO_BET PF_FAUCET_CLAIM
Telegram

Telegram Wallet Assistant

A wallet management agent that lets Telegram users check balances, send ETH, swap tokens, and register ENS domains — all through conversational commands. Escrow is used to handle peer-to-peer payment requests between users. No custodial risk: each user's keys are derived from a unique seed stored in their own environment.

PF_WALLET_BALANCE PF_DOMAIN_REGISTER PF_ESCROW_CREATE
Autonomous

Self-Sustaining Trading Agent

A headless ElizaOS agent that bootstraps itself by claiming faucet funds, uses those funds to play casino games to build a small bankroll, then deploys that bankroll into perp trading with conservative leverage. Profitable trades are locked into escrow and released to the operator on a weekly schedule. Fully autonomous from zero capital.

PF_FAUCET_CLAIM PF_CASINO_BET PF_TRADE_OPEN PF_ESCROW_CREATE

Purple Flea vs Generic ElizaOS HTTP Adapters

Feature @purpleflea/eliza-plugin Generic HTTP Adapter Coinbase AgentKit
Native ElizaOS action model Yes Manual wiring Partial
Provably-fair casino games 5 game types None None
Perpetual trading (perps) Yes Custom build Spot only
Agent faucet (free $1) Built-in None None
Trustless escrow Yes, 1% fee None None
Non-custodial key handling BIP-44 local sign Varies Yes (MPC)
Referral revenue share 15% on escrow fees None None
Web3 domain registration ENS + HNS Custom build None

ElizaOS: The Crypto-Native Agent Framework

ElizaOS (formerly Eliza by ai16z) emerged in late 2024 as the most widely deployed framework for building crypto-native AI agents. By early 2025 it had accumulated over 15,000 GitHub stars and was powering agents for ai16z, virtuals.io, Degen Spartan AI, and hundreds of community projects. Its plugin architecture, multi-client runtime (Twitter, Discord, Telegram, direct API), and native support for on-chain operations made it the go-to choice for teams building agents that need to interact with blockchains as first-class citizens — not as an afterthought.

What sets ElizaOS apart from general-purpose agent frameworks is its philosophy: agents are persistent, financially capable actors. An ElizaOS character has a wallet, a persona, a memory system, and a set of actions. Those actions are the critical surface area — they define what the agent can actually do in the world. A character with only text actions is a chatbot. A character with Purple Flea actions is a financial operator.

The @purpleflea/eliza-plugin was designed from the ground up to feel like a first-party ElizaOS module. Action names follow ElizaOS conventions. The validate function uses the same pattern as core ElizaOS actions. The examples array provides the few-shot context that helps GPT-4o and Claude models reliably select the correct action from natural-language input. Plugin settings live under settings.purpleflea in the character config, consistent with how other ElizaOS plugins expose configuration.

For teams already running ElizaOS infrastructure, integrating Purple Flea is a two-line change: add the npm package and register the plugin in your character config. For teams starting fresh, Purple Flea's six APIs give you a complete financial stack — from bootstrapping a new agent with faucet funds, to running a fully self-sustaining trading and gaming operation — without needing to integrate half a dozen separate protocols.

The Six Purple Flea Services

Each service is independently useful. Together they form a complete financial operating environment for autonomous agents:

🎲

Casino API

Provably-fair on-chain games with VRF randomness. Coin flip, dice, roulette, hi-lo, and crash.

📈

Trading API

Leveraged perpetuals and spot swaps across 10+ EVM chains with DEX aggregation and stop-loss support.

👛

Wallet API

Non-custodial HD wallet operations. 30+ tokens, multi-chain address derivation, gas estimation, tx history.

🌐

Domain API

Register and manage Web3 domains on ENS, Unstoppable Domains, and Handshake. Bulk acquisition support.

🔶

Faucet

Free $1 USDC for every new agent address. Zero-risk entry point for bootstrapping new ElizaOS characters.

🤝

Escrow

Trustless smart-contract escrow for agent-to-agent payments. 1% fee, 15% referral share on fees.

Start Building in Minutes

Install @purpleflea/eliza-plugin, register it in your character config, and your ElizaOS agent immediately gains six financial superpowers. The faucet action requires no API key — your agent can claim its first $1 USDC right now.