A trading bot that can swap isn't safe unless it can also refuse. Rug pulls and honeypots don't announce themselves — they look like any other token until the sell fails or the dev wallet drains the pool. A pre-trade token safety check is the one gate that keeps an autonomous agent from buying its way into a trap.
NodeFlare's /data/token-safety endpoint is designed for exactly this: a single POST that returns a structured risk verdict before your agent commits gas.
The problem with checking after the fact
Most on-chain safety tooling is designed for human review: paste an address into a browser checker, read a UI, decide. That flow breaks entirely when a bot is making dozens of decisions per minute. You need:
- A machine-readable response (not a rendered web page)
- Sub-second latency (not a multi-second scrape)
- Coverage on the chains your agent actually trades on, including newly launched ones
The NodeFlare token safety API covers all three. It runs against the same RPC infrastructure that serves your eth_call and eth_sendRawTransaction requests, so there is no extra network hop to a third-party checker.
The API call
curl -X POST https://rpc.nodeflare.app/data/token-safety \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{
"chain": "base",
"token": "0xTokenAddressHere"
}'Get a free API key at nodeflare.app/sign-up — 2,000,000 compute units per month, no credit card required.
The response:
{
"token": "0xTokenAddressHere",
"chain": "base",
"risk_score": 72,
"flags": {
"is_verified": false,
"owner_active": true,
"is_proxy": false,
"honeypot_simulation": "SELL_REVERTS",
"top_holder_pct": 0.61
},
"verdict": "HIGH_RISK"
}risk_score runs from 0 (clean) to 100 (do not touch). verdict is one of SAFE, CAUTION, HIGH_RISK, or HONEYPOT.
Wiring it into a Python trading bot
Here is a minimal guard function you can drop into any bot that uses web3.py or a similar library:
import httpx
NODEFLARE_API_KEY = "nf_..."
TOKEN_SAFETY_URL = "https://rpc.nodeflare.app/data/token-safety"
async def is_safe_to_buy(chain: str, token_address: str, max_risk_score: int = 40) -> bool:
async with httpx.AsyncClient() as client:
resp = await client.post(
TOKEN_SAFETY_URL,
headers={"Authorization": f"Bearer {NODEFLARE_API_KEY}"},
json={"chain": chain, "token": token_address},
timeout=3.0,
)
resp.raise_for_status()
data = resp.json()
if data["verdict"] in ("HIGH_RISK", "HONEYPOT"):
return False
if data["risk_score"] > max_risk_score:
return False
return True
# In your swap logic:
async def execute_swap(chain, token_in, token_out, amount):
if not await is_safe_to_buy(chain, token_out):
raise ValueError(f"Token {token_out} failed pre-trade safety check — swap aborted")
# ... proceed with swapThe function aborts the swap before any gas is spent. Set max_risk_score to match your strategy's risk tolerance; 40 is a reasonable default for a production bot.
Wiring it into a LangChain agent
If you are using a LangChain-style agent with tool calls, expose the check as a tool the agent must invoke before any execute_swap tool:
from langchain.tools import tool
@tool
def check_token_safety(chain: str, token_address: str) -> dict:
"""
Check whether a token is safe to buy before executing a swap.
Always call this before execute_swap. Returns a verdict and risk score.
"""
import httpx, os
resp = httpx.post(
"https://rpc.nodeflare.app/data/token-safety",
headers={"Authorization": f"Bearer {os.environ['NODEFLARE_API_KEY']}"},
json={"chain": chain, "token": token_address},
timeout=3.0,
)
resp.raise_for_status()
return resp.json()Add it to the agent's tool list and instruct the system prompt that check_token_safety is a mandatory pre-condition for execute_swap. The structured JSON response gives the LLM enough signal to reason about the risk and explain its decision in the agent's trace.
If you are using the NodeFlare MCP server, the same check is available as an MCP tool — see nodeflare.app/agents for the full tool list and setup instructions.
What each flag means
| Flag | What triggers it | What to do |
|---|---|---|
is_verified: false | Source code not published to the block explorer | Treat as high risk unless you have another trust signal |
owner_active: true | The owner address still controls the contract | Owner can change fees, pause transfers, or drain a pool |
is_proxy: true | Contract logic can be swapped via a proxy pattern | Mechanics can change after you buy |
honeypot_simulation: "SELL_REVERTS" | Simulated sell transaction reverts | Classic honeypot — do not buy |
top_holder_pct > 0.5 | Top wallet holds >50% of supply | One dump will crater the price |
A verdict of CAUTION with a low risk score might be acceptable for a high-risk strategy. A verdict of HONEYPOT is never acceptable — the simulation confirmed that selling is impossible.
Chain coverage
The check works on every EVM chain NodeFlare serves. That matters because scams launch on young chains first — before any major checker has indexed them. Standard safety tools cover Ethereum and Base. NodeFlare covers Zircuit, Robinhood Chain, Ink, BOB, Soneium, and every other chain in its network.
You can browse the full chain list and live RPC endpoints at nodeflare.app/chains.
What to check next
- Token Safety API reference — full response schema, field definitions, and rate limits
- Browser checker — paste any address to get a risk verdict without writing code
- Onchain Answer Engine — structured answers about token holders, contract state, and wallet history for deeper due diligence
- MCP server for agents — NodeFlare tools as MCP tool calls, including token safety and RPC access from any MCP-compatible agent framework
- x402 pay-per-request — pay per API call in USDC if you prefer not to manage a subscription
NodeFlare is an independent RPC and on-chain-intelligence provider. This post describes our own API; it is not financial advice and does not constitute a recommendation to trade any specific token.