Ethereum · EVM · Mainnet + Polygon

Ethereum Wallet API for
Autonomous AI Agents

Generate BIP-39 HD wallets, check ETH and ERC-20 balances, estimate gas, and send USDC — all without managing a single private key in your agent's code.

Get API Key → Full Wallet Docs
BIP-39 Mnemonics HD Derivation m/44'/60'/0'/0/0 USDC & USDT ERC-20 Transfers Gas Estimation Mainnet + Polygon Server-Side Key Management

Why Agents Need a Dedicated Ethereum Wallet API

An autonomous AI agent that interacts with Ethereum faces an immediate practical problem: private key management. Traditional approaches — injecting a hex private key as an environment variable, maintaining a local keystore file, or integrating a full Ethereum node — each carry serious drawbacks for an agent deployed in a cloud container or serverless function.

Purple Flea's Ethereum Wallet API solves this by managing keys server-side within a hardened, encrypted vault. Your agent receives a wallet ID and a BIP-39 mnemonic phrase at creation time. The mnemonic is the canonical backup — if you ever need to recover funds outside Purple Flea, you import it into MetaMask, Ledger, or any BIP-44-compatible wallet and your funds are immediately accessible. From that point forward, your agent can perform all wallet operations — balance checks, USDC sends, ERC-20 transfers — using the wallet ID and an API key, with no raw cryptographic material required in the agent's runtime.

The derivation path follows the BIP-44 Ethereum standard: m/44'/60'/0'/0/0. This means your agent's Ethereum address is deterministic and reproducible from the mnemonic alone. The same mnemonic also controls a Polygon address (same derivation, different network), so a single wallet creation call gives your agent native assets on two EVM chains.

Purple Flea supports both Ethereum mainnet and Polygon PoS out of the box, with automatic RPC failover across multiple providers. Your agent never needs to know which RPC it is talking to — it just makes REST calls and receives parsed, structured JSON responses with no raw hex decoding required.

BIP-39

Standard mnemonics

2

EVM networks

ERC-20

Any token supported

<1s

Balance lookup

10%

Referral commission

Everything Your ETH Agent Needs

BIP-39 HD Key Generation

Every wallet is derived from a 12- or 24-word BIP-39 mnemonic using the standard PBKDF2-HMAC-SHA512 seed derivation. The BIP-44 path m/44'/60'/0'/0/0 produces your agent's primary Ethereum address. Recovery is always possible with the mnemonic alone.

ETH & ERC-20 Balances

A single GET /wallet/balance call returns ETH (in both wei and human-readable format), USDC, USDT, and any custom ERC-20 token address you specify. Responses are always denominated in the token's native decimals so your agent can do simple arithmetic without hex conversion.

USDC & USDT Transfers

Send USDC or USDT with a single API call specifying the amount in dollar terms. Purple Flea handles decimal conversion (6 decimals for USDC/USDT), constructs the ERC-20 transfer() calldata, signs the transaction server-side, and broadcasts it. You receive the transaction hash in the response.

Gas Estimation & EIP-1559

Every send operation first runs an eth_estimateGas simulation to verify the transaction will succeed and calculate exact gas units. The API applies EIP-1559 pricing (baseFee + priorityFee) by default, with a configurable max fee cap so your agent never overpays.

Arbitrary ERC-20 Support

Beyond USDC and USDT, you can interact with any ERC-20 token by passing its contract address. The API fetches symbol, decimals, and balanceOf on-chain and returns human-friendly amounts. Useful for agents interacting with DeFi protocol tokens.

Polygon Support

The same wallet ID and mnemonic control a Polygon PoS address (same derivation path). Your agent can query MATIC, Polygon USDC, and Polygon USDT balances separately. Polygon transactions are an order of magnitude cheaper than mainnet, making it ideal for high-frequency agent activity.

Core Endpoints

All endpoints are authenticated with your X-API-Key header and return JSON.

POST /agent/register

Register a new agent and receive your wallet ID, Ethereum address, and BIP-39 mnemonic. Call once per agent identity.

GET /wallet/balance?wallet_id=&chain=ethereum

Returns ETH balance (wei + formatted), USDC, USDT, and any ERC-20 token address passed via the token query param.

POST /wallet/send

Send ETH, USDC, USDT, or any ERC-20 to a recipient address. Specify chain as ethereum or polygon. Returns transaction hash immediately on broadcast.

GET /wallet/tx?tx_hash=&chain=ethereum

Fetch transaction status: pending, confirmed, or failed, with block number and gas used.

Python: Register, Check Balance, Send USDC

The following examples use Python's requests library. The same patterns work in any HTTP client.

Python — Step 1: Register Agent
import requests

BASE_URL = "https://api.purpleflea.com"
API_KEY  = "pf_live_your_key_here"

HEADERS = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json"
}

# Register a new agent — call once and save the wallet_id
resp = requests.post(
    f"{BASE_URL}/agent/register",
    headers=HEADERS,
    json={"name": "eth-agent-01", "chain": "ethereum"}
)
data = resp.json()

wallet_id  = data["wallet_id"]
eth_address = data["address"]
mnemonic   = data["mnemonic"]  # SAVE THIS — your backup recovery phrase

print(f"Wallet ID:  {wallet_id}")
print(f"ETH Address: {eth_address}")
# Example: 0x4A3b...Fc72
Python — Step 2: Check ETH & USDC Balance
# Check balances on mainnet
resp = requests.get(
    f"{BASE_URL}/wallet/balance",
    headers=HEADERS,
    params={
        "wallet_id": wallet_id,
        "chain": "ethereum"
    }
)
balance = resp.json()

print(f"ETH:  {balance['eth']['formatted']} ETH")
print(f"USDC: {balance['usdc']['formatted']} USDC")
print(f"USDT: {balance['usdt']['formatted']} USDT")

# Check Polygon balances with chain="polygon"
poly = requests.get(
    f"{BASE_URL}/wallet/balance",
    headers=HEADERS,
    params={"wallet_id": wallet_id, "chain": "polygon"}
).json()
print(f"MATIC: {poly['native']['formatted']} MATIC")
Python — Step 3: Send USDC to Another Agent
# Send $5 USDC to another agent on Ethereum mainnet
send_resp = requests.post(
    f"{BASE_URL}/wallet/send",
    headers=HEADERS,
    json={
        "wallet_id": wallet_id,
        "chain": "ethereum",
        "token": "USDC",
        "to": "0xRecipientAddress...",
        "amount": "5.00"          # human-readable, NOT wei
    }
)
tx = send_resp.json()
print(f"TX Hash: {tx['tx_hash']}")
print(f"Gas used (est): {tx['gas_estimate']} units")

# Poll for confirmation
import time
while True:
    status = requests.get(
        f"{BASE_URL}/wallet/tx",
        headers=HEADERS,
        params={"tx_hash": tx["tx_hash"], "chain": "ethereum"}
    ).json()
    if status["status"] == "confirmed":
        print(f"Confirmed in block {status['block_number']}")
        break
    time.sleep(3)

Server-Side Key Management — No Raw Keys in Your Code

The most dangerous pattern in agent development is storing raw private keys in environment variables or configuration files. A single leaked CI/CD log, a misconfigured S3 bucket, or a compromised container image is enough to drain all funds.

Purple Flea manages Ethereum private keys in an encrypted vault with zero raw key exposure to API consumers. When your agent calls POST /wallet/send, the private key never leaves the signing service — it signs the transaction in-memory and returns only the broadcast result. Your API key is the only credential your agent needs at runtime.

The BIP-39 mnemonic you receive at wallet creation is the disaster-recovery backup, not a runtime credential. Store it in a secrets manager (AWS Secrets Manager, HashiCorp Vault, or even a printed copy in a safe) and never reference it in running code. Your agent only needs the wallet ID and API key to operate indefinitely.

10% Referral Commission on All API Fees

Share your referral link and earn 10% of every API fee generated by agents you refer. Purple Flea operates a multi-level referral program — your referrals' referrals also earn you a percentage. Build an agent network and earn passively as they transact. See /referral for details.

Related APIs & Resources

Start in 2 minutes

Ready to give your agent
an Ethereum wallet?

Register, generate a wallet, and make your first USDC transfer in under 10 minutes. No Ethereum node required.

Get API Key → Read the Docs