8+
Chains Supported
HD
Non-Custodial
DEX
Best-Rate Routing
10%
Swap Fee Referral
1
API Call to Start

What Purple Flea Wallet Offers

Managing crypto wallets across multiple blockchains is one of the most common friction points for AI agents operating in the financial stack. Different chains have incompatible address formats, different RPC providers, different gas models, and fragmented DEX ecosystems. Building native support for even three chains from scratch is weeks of engineering work.

Purple Flea Wallet abstracts all of that. A single API key gives your agent:

Supported Chains

โŸ 
Ethereum
ETH, ERC-20, ERC-721
โ‚ฟ
Bitcoin
Native BTC, SegWit
โ—Ž
Solana
SOL, SPL tokens
T
Tron
TRX, TRC-20 USDT
โฌก
BNB Chain
BNB, BEP-20
โฌŸ
Polygon
MATIC, ERC-20
โฌ†
Optimism
OP, ERC-20
โœฆ
Arbitrum
ARB, ERC-20

Creating a Wallet: One Call, Eight Chains

The wallet creation endpoint generates a BIP39 mnemonic phrase and derives addresses for all supported chains using their respective BIP44 derivation paths. The mnemonic is returned to you once and never stored by Purple Flea. Store it securely in your agent's encrypted secrets store.

POST /v1/wallet/create
{ "label": "trading-agent-wallet-01", "chains": ["ethereum", "bitcoin", "solana", "tron", "bnb", "polygon", "optimism", "arbitrum"] }
Response (mnemonic shown once โ€” store it!)
{ "wallet_id": "wlt_Kp7xBqN2mD", "label": "trading-agent-wallet-01", "mnemonic": "abandon ability able about above absent absorb abstract ...", "addresses": { "ethereum": "0x4B2a...c8F3", "bitcoin": "bc1q4x...r8p2", "solana": "7VqFg...mN3x", "tron": "TKhP2...eW7v", "bnb": "0x4B2a...c8F3", "polygon": "0x4B2a...c8F3", "optimism": "0x4B2a...c8F3", "arbitrum": "0x4B2a...c8F3" }, "derivation_paths": { "ethereum": "m/44'/60'/0'/0/0", "bitcoin": "m/84'/0'/0'/0/0", "solana": "m/44'/501'/0'/0'", "tron": "m/44'/195'/0'/0/0" } }
Security Critical

The mnemonic phrase is the master key to all chain wallets. Purple Flea returns it once and does not store it. Your agent must immediately encrypt and store it in a secure secrets vault (AWS Secrets Manager, HashiCorp Vault, or equivalent). Never log it, never send it over plaintext channels, and never hardcode it in source code.

Checking Balances

Query wallet balances across one or more chains with a single API call. Responses include native token balances and detected ERC-20 / SPL token holdings.

GET /v1/wallet/balance/{wallet_id}
{ "wallet_id": "wlt_Kp7xBqN2mD", "balances": { "ethereum": { "native": {"symbol": "ETH", "amount": 1.4823, "usd_value": 5487.10}, "tokens": [ {"symbol": "USDC", "amount": 1250.00, "usd_value": 1250.00}, {"symbol": "WBTC", "amount": 0.012, "usd_value": 1047.00} ] }, "bitcoin": { "native": {"symbol": "BTC", "amount": 0.0412, "usd_value": 3588.00} }, "solana": { "native": {"symbol": "SOL", "amount": 24.8, "usd_value": 3968.00}, "tokens": [ {"symbol": "USDC", "amount": 500.00, "usd_value": 500.00} ] } }, "total_usd_value": 15840.10, "updated_at": "2026-03-06T10:22:11Z" }

Best-Rate Swaps: DEX Routing

The swap endpoint is where Purple Flea's routing intelligence kicks in. Rather than sending your trade to a single DEX, the routing engine queries multiple sources โ€” Uniswap v3, Curve, SushiSwap, Jupiter (Solana), PancakeSwap (BNB) โ€” and executes at the best available price, accounting for gas costs.

This is the equivalent of a 1inch aggregator, but exposed as a single API endpoint with no Web3 library dependencies on your side.

POST /v1/wallet/swap โ€” Quote first
{ "wallet_id": "wlt_Kp7xBqN2mD", "from_chain": "ethereum", "from_token": "ETH", "to_token": "USDC", "amount": 0.5, "slippage_pct": 0.5, "mode": "quote" // "quote" for dry run, "execute" to actually swap }
Quote response
{ "quote_id": "q_mNxP8kB", "from_token": "ETH", "to_token": "USDC", "from_amount": 0.5, "to_amount": 1842.14, "rate": 3684.28, // effective ETH/USDC rate "route": ["Uniswap v3", "Curve"], "gas_estimate_usd": 3.12, "fee_usd": 1.84, // 0.1% Purple Flea fee "net_to_amount": 1838.98, // after gas + fee "quote_valid_until": "2026-03-06T10:24:11Z" }
POST /v1/wallet/swap โ€” Execute
{ "wallet_id": "wlt_Kp7xBqN2mD", "quote_id": "q_mNxP8kB", "mode": "execute" } // Response: { "tx_hash": "0xab3f...c99e", "status": "pending", "from_amount": 0.5, "to_amount": 1841.22, "actual_rate": 3682.44, "gas_used_usd": 3.08, "block_number": 21847294 }

Cross-Chain Bridging

Cross-chain swaps let your agent move value between different blockchains โ€” for example, converting ETH on Ethereum to SOL on Solana, or USDC on Polygon to USDC on Arbitrum. Under the hood, Purple Flea uses established bridge protocols (Wormhole, LayerZero, Stargate) and abstracts the complexity.

POST /v1/wallet/swap โ€” Cross-chain example
{ "wallet_id": "wlt_Kp7xBqN2mD", "from_chain": "ethereum", "from_token": "USDC", "to_chain": "solana", // cross-chain: different to_chain "to_token": "USDC", "amount": 500, "slippage_pct": 1.0, // higher slippage for bridging "mode": "execute" } // Bridging takes 2-15 minutes depending on the route. // Poll /v1/wallet/tx/{tx_hash} for status.

Security: HD Derivation and Key Management

Purple Flea Wallet is non-custodial by design. Here is what that means in practice:

ItemWho Holds ItNotes
Mnemonic seed phrase You (agent) Returned once at creation. Never stored by Purple Flea.
Private keys Derived locally by Purple Flea at request time Derived from mnemonic in-memory, discarded after signing.
Public addresses Purple Flea stores for indexing Used for balance queries only. Public by nature.
Transaction signing Purple Flea signs on behalf, from mnemonic Requires the mnemonic to be provided on each request OR stored encrypted by you and passed per-call.
Architecture Note

Signing mode: For maximum security, Purple Flea supports a "client-side signing" mode where you derive the private key locally using the mnemonic and sign transactions before submitting. The API accepts pre-signed transaction bytes. This mode means the mnemonic never leaves your system.

For convenience, you can also pass the mnemonic on each swap/transfer call via the encrypted mnemonic_encrypted field, and Purple Flea signs server-side. Choose the model appropriate for your threat model.

Complete Python WalletManager Class

Below is a production-quality WalletManager class covering wallet creation, balance queries, swaps, and transfers. Copy and integrate into your agent.

wallet_manager.py โ€” Complete implementation
import requests import time import json import logging from typing import Optional from decimal import Decimal logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s') log = logging.getLogger("WalletManager") BASE_URL = "https://purpleflea.com/v1" class WalletManager: """ Purple Flea Wallet API client for AI agents. Covers: create, balance, swap, transfer, cross-chain, auto-rebalancing. """ def __init__(self, api_key: str): self.api_key = api_key self.session = requests.Session() self.session.headers.update({ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" }) self._wallet_cache: dict = {} # โ”€โ”€ Wallet Lifecycle โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def create(self, label: str, chains: list[str] | None = None) -> dict: """Create a new HD wallet. Returns mnemonic โ€” store it immediately!""" chains = chains or ["ethereum", "bitcoin", "solana", "tron", "bnb", "polygon", "optimism", "arbitrum"] resp = self.session.post(f"{BASE_URL}/wallet/create", json={ "label": label, "chains": chains }) resp.raise_for_status() data = resp.json() log.info(f"Wallet created: {data['wallet_id']} โ€” STORE THE MNEMONIC NOW") self._wallet_cache[data["wallet_id"]] = data return data # โ”€โ”€ Balance Queries โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def balance(self, wallet_id: str, chains: list[str] | None = None) -> dict: """Get all balances for a wallet. Optionally filter to specific chains.""" params = {} if chains: params["chains"] = ",".join(chains) resp = self.session.get(f"{BASE_URL}/wallet/balance/{wallet_id}", params=params) resp.raise_for_status() return resp.json() def total_usd_value(self, wallet_id: str) -> float: """Quick helper: return total portfolio value in USD.""" b = self.balance(wallet_id) return b.get("total_usd_value", 0.0) # โ”€โ”€ Swaps โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def get_quote(self, wallet_id: str, from_chain: str, from_token: str, to_token: str, amount: float, to_chain: str | None = None, slippage_pct: float = 0.5) -> dict: """Get a swap quote. to_chain is optional (defaults to from_chain).""" payload = { "wallet_id": wallet_id, "from_chain": from_chain, "from_token": from_token, "to_token": to_token, "amount": amount, "slippage_pct": slippage_pct, "mode": "quote" } if to_chain: payload["to_chain"] = to_chain resp = self.session.post(f"{BASE_URL}/wallet/swap", json=payload) resp.raise_for_status() return resp.json() def swap(self, wallet_id: str, from_chain: str, from_token: str, to_token: str, amount: float, to_chain: str | None = None, slippage_pct: float = 0.5) -> dict: """Execute a swap at best available rate. Returns tx_hash.""" # Get quote first to validate quote = self.get_quote(wallet_id, from_chain, from_token, to_token, amount, to_chain, slippage_pct) log.info(f"Swap quote: {amount} {from_token} โ†’ {quote['to_amount']:.4f} {to_token} via {quote['route']}") # Execute resp = self.session.post(f"{BASE_URL}/wallet/swap", json={ "wallet_id": wallet_id, "quote_id": quote["quote_id"], "mode": "execute" }) resp.raise_for_status() result = resp.json() log.info(f"Swap executed: tx={result['tx_hash']} rate={result['actual_rate']:.2f}") return result # โ”€โ”€ Transfers โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def transfer(self, wallet_id: str, chain: str, token: str, to_address: str, amount: float) -> dict: """Send tokens from this wallet to an external address.""" resp = self.session.post(f"{BASE_URL}/wallet/transfer", json={ "wallet_id": wallet_id, "chain": chain, "token": token, "to_address": to_address, "amount": amount }) resp.raise_for_status() result = resp.json() log.info(f"Transfer sent: {amount} {token} on {chain} to {to_address[:10]}... tx={result['tx_hash']}") return result # โ”€โ”€ Transaction Status โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ def wait_for_tx(self, tx_hash: str, chain: str, timeout: int = 120) -> dict: """Poll until transaction is confirmed or timeout.""" deadline = time.time() + timeout while time.time() < deadline: resp = self.session.get(f"{BASE_URL}/wallet/tx/{tx_hash}", params={"chain": chain}) if resp.ok: data = resp.json() if data.get("status") in ("confirmed", "failed"): return data time.sleep(5) raise TimeoutError(f"Transaction {tx_hash} not confirmed within {timeout}s")

Strategy: Auto-Rebalancing Portfolio

One of the most powerful use cases for the Wallet API is an auto-rebalancing portfolio strategy. Your agent maintains target allocations across chains and tokens, checks balances periodically, and executes swaps to bring the portfolio back to target whenever drift exceeds a threshold.

rebalancer.py โ€” Auto-rebalancing across chains
from wallet_manager import WalletManager import time wallet = WalletManager(api_key="pf_live_YOUR_API_KEY") WALLET_ID = "wlt_Kp7xBqN2mD" # Target allocation as percentage of total portfolio TARGET_ALLOCATION = { ("ethereum", "ETH"): 0.30, # 30% ETH ("bitcoin", "BTC"): 0.30, # 30% BTC ("solana", "SOL"): 0.15, # 15% SOL ("ethereum", "USDC"): 0.25, # 25% stables } REBALANCE_THRESHOLD = 0.05 # Rebalance if any asset drifts > 5% from target REBALANCE_INTERVAL = 3600 # Check every hour def get_current_allocation() -> dict: """Return current allocation as {(chain, token): fraction}.""" b = wallet.balance(WALLET_ID) total = b["total_usd_value"] if total == 0: return {} result = {} for chain, holdings in b["balances"].items(): native = holdings.get("native", {}) if native.get("usd_value", 0) > 0: result[(chain, native["symbol"])] = native["usd_value"] / total for tok in holdings.get("tokens", []): if tok.get("usd_value", 0) > 0: result[(chain, tok["symbol"])] = tok["usd_value"] / total return result def rebalance(): current = get_current_allocation() total_usd = wallet.total_usd_value(WALLET_ID) for asset, target_frac in TARGET_ALLOCATION.items(): current_frac = current.get(asset, 0.0) drift = abs(current_frac - target_frac) if drift > REBALANCE_THRESHOLD: chain, token = asset target_usd = target_frac * total_usd current_usd = current_frac * total_usd delta_usd = target_usd - current_usd if delta_usd > 10: # Buy: need more of this asset # Sell USDC to buy the underweight asset try: wallet.swap(WALLET_ID, "ethereum", "USDC", token, delta_usd, to_chain=chain if chain != "ethereum" else None) print(f"[REBALANCE] Bought ${delta_usd:.2f} of {token} on {chain}") except Exception as e: print(f"[REBALANCE] Failed to buy {token}: {e}") elif delta_usd < -10: # Sell: too much of this asset sell_amount_native = abs(delta_usd) / (current_usd / current.get(asset, 0.001) or 1) try: wallet.swap(WALLET_ID, chain, token, "USDC", sell_amount_native) print(f"[REBALANCE] Sold ${abs(delta_usd):.2f} of {token} on {chain}") except Exception as e: print(f"[REBALANCE] Failed to sell {token}: {e}") while True: print(f"[REBALANCER] Total portfolio: ${wallet.total_usd_value(WALLET_ID):,.2f}") rebalance() time.sleep(REBALANCE_INTERVAL)

Integration with Purple Flea Casino

The Wallet API connects directly to the Purple Flea Casino API. Your agent can fund casino sessions directly from wallet balances, withdraw winnings back to the wallet, and auto-convert between currencies to maintain a preferred denomination for gambling.

Casino funding workflow
from wallet_manager import WalletManager import requests wm = WalletManager("pf_live_YOUR_API_KEY") WALLET_ID = "wlt_Kp7xBqN2mD" CASINO_DEPOSIT_ADDRESS = "0xCaS...iNo" # From your casino account SESSION_BUDGET_USD = 50 # 1. Check we have enough USDC on Ethereum bal = wm.balance(WALLET_ID, chains=["ethereum"]) usdc = next((t for t in bal["balances"]["ethereum"].get("tokens", []) if t["symbol"] == "USDC"), None) if not usdc or usdc["usd_value"] < SESSION_BUDGET_USD: # Swap ETH to USDC if needed wm.swap(WALLET_ID, "ethereum", "ETH", "USDC", SESSION_BUDGET_USD / 3684) # 2. Send USDC to casino deposit address tx = wm.transfer(WALLET_ID, "ethereum", "USDC", CASINO_DEPOSIT_ADDRESS, SESSION_BUDGET_USD) print(f"Casino funded: tx={tx['tx_hash']}") # 3. Wait for confirmation before starting casino session confirmed = wm.wait_for_tx(tx["tx_hash"], "ethereum") if confirmed["status"] == "confirmed": print("Casino session can begin.")

Referral Income: 10% of Swap Fees

Purple Flea pays 10% of swap fees to agents that refer other wallet users. Swap fees are typically 0.1% of swap volume. A referred agent executing $100,000 per month in swaps generates $100 in swap fees โ€” and your referral earns you $10 of that, automatically.

At scale, a network of 200 active wallet agents each doing $50,000/month in swaps generates $1 million in volume, $1,000 in fees โ€” and $100/month in passive referral income for you, with zero additional work.

Your referral code is included in your API key registration response. Share it via your agent's API documentation, GitHub README, or any public integrations you build.

Income Stack

The Purple Flea referral system compounds across products. An agent that refers another agent earns 20% of trading fees, 15% of domain registrations, and 10% of swap fees โ€” all simultaneously. A single well-connected referral can generate meaningful recurring income across all six Purple Flea services.

Start with a Multi-Chain Wallet

Register your agent, create an 8-chain HD wallet in one API call, and start executing best-rate swaps. The wallet API is live at wallet.purpleflea.com.

Get Free API Key โ†’ Wallet API Docs

Conclusion

The Purple Flea Wallet API eliminates the most painful part of multi-chain development โ€” the fragmented tooling, different RPC providers, incompatible address formats, and scattered DEX integrations โ€” and replaces it with a single API that handles everything from wallet creation to cross-chain swaps.

The key features for AI agents are the breadth (8+ chains from one call), the non-custodial security model (your mnemonic, your keys), and the DEX routing (best rate without writing DEX-specific integration code). Combined with the auto-rebalancing strategy shown above, an agent can maintain a sophisticated multi-chain portfolio with under 200 lines of Python.

Add referral income from the 10% swap fee share, and the wallet API becomes both a tool and a revenue source. Register at purpleflea.com/quick-register to get started, or read the full Wallet API reference for endpoint documentation.