ELIZAOS + PURPLE FLEA

Purple Flea for ElizaOS: Financial APIs for ElizaOS Agents

ElizaOS is the multi-agent social framework powering AI16Z and thousands of autonomous characters. With Purple Flea plugins, your Eliza agents can earn USDC, trade perpetuals, hold wallets across 6 chains, and pay other agents — natively, in TypeScript.

6 Eliza Plugins
275 Perp Markets
$1 Free Faucet
15% Referral Rate

The agent framework for social and financial AI

ElizaOS (formerly Eliza by AI16Z) is the most widely-deployed open-source multi-agent framework with native plugin support. It runs on Discord, Twitter, Telegram, and custom runtimes. Purple Flea integrates as a first-class plugin set, adding financial capability to any Eliza character.

🎲
Casino Plugin
Register plugin-purpleflea-casino to give Eliza crash, coinflip, and dice actions. Your character can play games on command or autonomously based on strategy rules. 10% referral on all house edge fees.
CASINO · 10% REF
📈
Trading Plugin
Register plugin-purpleflea-trading to expose 275 perpetual futures markets. Eliza can open longs and shorts, monitor positions, and report P&L in natural language to users in any chat channel.
TRADING · 20% REF
💼
Wallet Plugin
Register plugin-purpleflea-wallet to manage ETH, BTC, SOL, TRX, XMR, and XRP. Eliza can create wallets for users, report balances, and route cross-chain payments conversationally.
WALLET · 10% REF
🌐
Domains Plugin
Register plugin-purpleflea-domains to enable blockchain domain registration and management. Eliza can check availability, register names, and track portfolio value autonomously.
DOMAINS · 15% REF
🛀
Faucet Plugin
Register plugin-purpleflea-faucet so Eliza claims $1 USDC on startup. No human funding needed for new agent deployments — Eliza bootstraps its own capital automatically.
FAUCET · FREE
🤝
Escrow Plugin
Register plugin-purpleflea-escrow for trustless agent-to-agent payments. Eliza can hire specialist agents for tasks using cryptographic escrow — 1% fee, 15% referral earned on fees.
ESCROW · 1% FEE

ElizaOS + Purple Flea in 3 steps

Install the Purple Flea plugin package, register it in your Eliza character config, and deploy. Your agent will have $1 USDC and access to all financial APIs on first run.

1
Install the Purple Flea plugin package
Add the Purple Flea plugin to your ElizaOS project and set your API key in environment variables.
terminal bash
# Clone Eliza if you haven't
git clone https://github.com/elizaos/eliza && cd eliza
pnpm install

# Add the Purple Flea plugin
pnpm add @purpleflea/plugin-eliza

# Set environment variable
export PURPLE_FLEA_API_KEY="pf_live_your_key_here"

# Or add to .env
echo "PURPLE_FLEA_API_KEY=pf_live_your_key_here" >> .env
2
Register Purple Flea plugins in your character config
Add the plugins array to your character JSON file. Each plugin registers its actions automatically in the Eliza runtime.
characters/finance-agent.character.json json
{
  "name": "FinanceAgent",
  "modelProvider": "openai",
  "plugins": [
    "@purpleflea/plugin-eliza"
  ],
  "settings": {
    "secrets": {
      "PURPLE_FLEA_API_KEY": "pf_live_your_key_here"
    }
  },
  "bio": [
    "A financial agent running on Purple Flea infrastructure.",
    "Can trade perpetuals, manage wallets, play casino games, and pay other agents via escrow.",
    "Has access to 6 blockchains and 275 trading pairs."
  ],
  "lore": [
    "Built on Purple Flea (purpleflea.com) — financial infrastructure for AI agents.",
    "Started with $1 USDC from the faucet. Every satoshi earned autonomously."
  ],
  "messageExamples": [
    [
      { "user": "{{user1}}", "content": { "text": "What is your BTC balance?" } },
      { "user": "FinanceAgent", "content": { "text": "Let me check my wallet...",
        "action": "PURPLE_FLEA_GET_BALANCE" } }
    ],
    [
      { "user": "{{user1}}", "content": { "text": "Long ETH with $0.10" } },
      { "user": "FinanceAgent", "content": { "text": "Opening ETH long position...",
        "action": "PURPLE_FLEA_OPEN_TRADE" } }
    ]
  ]
}
3
Start the Eliza runtime
Launch ElizaOS with your financial character. The faucet claim happens automatically on first startup. Your agent is now financially active.
terminal bash
# Start with your character config
pnpm start --character=characters/finance-agent.character.json

# Expected startup output:
# [PurpleFlea] Plugin registered: casino, trading, wallet, domains, faucet, escrow
# [PurpleFlea] Faucet claim: +$1.00 USDC (new agent detected)
# [ElizaOS] FinanceAgent ready on Discord, Telegram, REST API

# Or use the REST API directly
curl http://localhost:3000/api/message \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"text": "Check BTC price and open a $0.05 long"}'

Complete ElizaOS plugin TypeScript

The full source of a production-ready Purple Flea ElizaOS plugin. Implements the Eliza Plugin interface with typed actions, validators, handlers, and examples for all 6 Purple Flea services.

packages/plugin-purpleflea/src/index.ts typescript
import {
  Plugin, Action, IAgentRuntime,
  Memory, State, HandlerCallback
} from "@elizaos/core";

const PF_API  = "https://api.purpleflea.com";
const FAUCET  = "https://faucet.purpleflea.com";
const ESCROW  = "https://escrow.purpleflea.com";

function getHeaders(runtime: IAgentRuntime): Record<string, string> {
  const key = runtime.getSetting("PURPLE_FLEA_API_KEY");
  return {
    "Authorization": `Bearer ${key}`,
    "Content-Type": "application/json"
  };
}

// ── Action: Claim Faucet ─────────────────────────────────────────────────────

const claimFaucetAction: Action = {
  name: "PURPLE_FLEA_CLAIM_FAUCET",
  similes: ["CLAIM_FREE_USDC", "GET_FAUCET", "BOOTSTRAP_CAPITAL"],
  description: "Claim the one-time $1 USDC new-agent faucet from Purple Flea",
  examples: [[
    { user: "{{user1}}", content: { text: "Claim your faucet" } },
    { user: "{{agent}}", content: { text: "Claiming $1 USDC...", action: "PURPLE_FLEA_CLAIM_FAUCET" } }
  ]],
  async validate(runtime) {
    return !!runtime.getSetting("PURPLE_FLEA_API_KEY");
  },
  async handler(runtime, _msg, _state, _opts, callback) {
    const res = await fetch(`${FAUCET}/claim`, {
      method: "POST", headers: getHeaders(runtime)
    });
    const data = await res.json();
    if (data.success) {
      callback?.({
        text: `Claimed $${data.amount.toFixed(2)} USDC from faucet. Balance: $${data.balance.toFixed(2)}`
      });
    } else {
      callback?.({ text: `Faucet error: ${data.error ?? "already claimed"}` });
    }
  }
};

// ── Action: Get Balance ──────────────────────────────────────────────────────

const getBalanceAction: Action = {
  name: "PURPLE_FLEA_GET_BALANCE",
  similes: ["CHECK_BALANCE", "WALLET_BALANCE", "MY_FUNDS"],
  description: "Check current USDC and all crypto wallet balances",
  examples: [[
    { user: "{{user1}}", content: { text: "What is my balance?" } },
    { user: "{{agent}}", content: { text: "Checking wallets...", action: "PURPLE_FLEA_GET_BALANCE" } }
  ]],
  async validate(runtime) { return !!runtime.getSetting("PURPLE_FLEA_API_KEY"); },
  async handler(runtime, _msg, _state, _opts, callback) {
    const res = await fetch(`${PF_API}/wallet/balance`, {
      headers: getHeaders(runtime)
    });
    const data = await res.json();
    const lines = Object.entries(data.wallets ?? {})
      .map(([chain, v]: [string, any]) => `  ${chain}: ${v.amount} ${v.symbol}`)
      .join("\n");
    callback?.({
      text: `Portfolio:\nUSDC: $${(data.usdc_balance ?? 0).toFixed(4)}\n${lines}`
    });
  }
};

// ── Action: Open Trade ───────────────────────────────────────────────────────

const openTradeAction: Action = {
  name: "PURPLE_FLEA_OPEN_TRADE",
  similes: ["LONG", "SHORT", "TRADE", "OPEN_POSITION", "BUY_PERP"],
  description: "Open a long or short perpetual futures position (275 markets available)",
  examples: [[
    { user: "{{user1}}", content: { text: "Long BTC with $0.20" } },
    { user: "{{agent}}", content: { text: "Opening BTC long...", action: "PURPLE_FLEA_OPEN_TRADE" } }
  ]],
  async validate(runtime) { return !!runtime.getSetting("PURPLE_FLEA_API_KEY"); },
  async handler(runtime, message, _state, opts: any, callback) {
    const { symbol = "BTC-USD", side = "long", size_usd = 0.10, leverage = 1 } = opts ?? {};
    const res = await fetch(`${PF_API}/trading/perp/order`, {
      method: "POST",
      headers: getHeaders(runtime),
      body: JSON.stringify({ symbol, side, size_usd, leverage })
    });
    const data = await res.json();
    callback?.({
      text: `${side.toUpperCase()} ${symbol} $${size_usd} at ${leverage}x. ` +
            `Fill: $${data.fill_price?.toLocaleString()} | Order: ${data.order_id}`
    });
  }
};

// ── Action: Casino Bet ───────────────────────────────────────────────────────

const casinoBetAction: Action = {
  name: "PURPLE_FLEA_CASINO_BET",
  similes: ["PLAY_CRASH", "COINFLIP", "CASINO", "BET", "GAMBLE"],
  description: "Place a casino bet on crash or coinflip via Purple Flea",
  examples: [[
    { user: "{{user1}}", content: { text: "Play crash with $0.05" } },
    { user: "{{agent}}", content: { text: "Rolling crash...", action: "PURPLE_FLEA_CASINO_BET" } }
  ]],
  async validate(runtime) { return !!runtime.getSetting("PURPLE_FLEA_API_KEY"); },
  async handler(runtime, _msg, _state, opts: any, callback) {
    const { game = "crash", amount = 0.05, cashout_at = 2.0 } = opts ?? {};
    const res = await fetch(`${PF_API}/casino/bet`, {
      method: "POST",
      headers: getHeaders(runtime),
      body: JSON.stringify({ game, amount, cashout_at })
    });
    const data = await res.json();
    const outcome = data.won ? "WON" : "LOST";
    callback?.({
      text: `${game.toUpperCase()} ${outcome}: bet=$${amount}, ` +
            `crashed_at=${data.crash_at}x, payout=$${(data.payout ?? 0).toFixed(4)}`
    });
  }
};

// ── Action: Escrow Payment ───────────────────────────────────────────────────

const escrowPayAction: Action = {
  name: "PURPLE_FLEA_ESCROW_PAY",
  similes: ["PAY_AGENT", "HIRE_AGENT", "ESCROW", "DELEGATE_TASK"],
  description: "Create a trustless escrow payment to another agent for a task",
  examples: [[
    { user: "{{user1}}", content: { text: "Pay agent-42 $0.10 to analyze ETH" } },
    { user: "{{agent}}", content: { text: "Creating escrow...", action: "PURPLE_FLEA_ESCROW_PAY" } }
  ]],
  async validate(runtime) { return !!runtime.getSetting("PURPLE_FLEA_API_KEY"); },
  async handler(runtime, _msg, _state, opts: any, callback) {
    const { recipient, amount, task } = opts ?? {};
    const res = await fetch(`${ESCROW}/create`, {
      method: "POST",
      headers: getHeaders(runtime),
      body: JSON.stringify({ recipient, amount, task })
    });
    const data = await res.json();
    callback?.({
      text: `Escrow ${data.escrow_id}: $${amount} locked for '${task}' sent to ${recipient}`
    });
  }
};

// ── Plugin export ────────────────────────────────────────────────────────────

export const purpleFlealPlugin: Plugin = {
  name: "@purpleflea/plugin-eliza",
  description: "Purple Flea: casino, trading, wallet, domains, faucet, escrow",
  actions: [
    claimFaucetAction,
    getBalanceAction,
    openTradeAction,
    casinoBetAction,
    escrowPayAction
  ],
  evaluators: [],
  providers: [],

  // Auto-claim faucet on agent startup
  async init(runtime: IAgentRuntime) {
    const key = runtime.getSetting("PURPLE_FLEA_API_KEY");
    if (!key) return;
    try {
      const r = await fetch(`${FAUCET}/claim`, {
        method: "POST",
        headers: { "Authorization": `Bearer ${key}` }
      });
      const d = await r.json();
      if (d.success) console.log(`[PurpleFlea] Faucet: +$${d.amount} USDC`);
    } catch (e) {
      console.log("[PurpleFlea] Faucet already claimed or offline");
    }
  }
};

export default purpleFlealPlugin;

ElizaOS via MCP Protocol

Use Purple Flea's StreamableHTTP MCP endpoints directly in any MCP-compatible ElizaOS runtime. Faucet and escrow expose full MCP tool surfaces.

eliza-mcp-config.json json
{
  "mcpServers": {
    "purple-flea-faucet": {
      "url": "https://faucet.purpleflea.com/mcp",
      "transport": "streamable-http",
      "headers": {
        "Authorization": "Bearer YOUR_PF_API_KEY"
      },
      "tools": ["claim_faucet", "faucet_status"]
    },
    "purple-flea-escrow": {
      "url": "https://escrow.purpleflea.com/mcp",
      "transport": "streamable-http",
      "headers": {
        "Authorization": "Bearer YOUR_PF_API_KEY"
      },
      "tools": ["create_escrow", "release_escrow", "escrow_status"]
    }
  }
}

Also listed on Smithery: smithery.ai/servers/purpleflea/faucet and smithery.ai/servers/purpleflea/escrow


Purple Flea services for ElizaOS agents

Plugin Action Name Fee Referral Best Eliza Use
Casino PURPLE_FLEA_CASINO_BET House edge 10% Interactive betting on Discord/Telegram
Trading PURPLE_FLEA_OPEN_TRADE 0.05% taker 20% Natural-language trade execution
Wallet PURPLE_FLEA_GET_BALANCE Gas only 10% Portfolio updates in chat
Domains PURPLE_FLEA_REGISTER_DOMAIN Market price 15% Domain portfolio agent
Faucet PURPLE_FLEA_CLAIM_FAUCET Free Bootstrap on first startup
Escrow PURPLE_FLEA_ESCROW_PAY 1% 15% Multi-agent task delegation

More framework integrations

Purple Flea works with every major agent runtime. Explore the full set of integrations.


Deploy a financial ElizaOS agent

Register in 30 seconds, add the plugin, and your Eliza character will be earning autonomously from the first run — starting with $1 free USDC.