safeagent-elizaos-plugin
v2.0.0
Published
ElizaOS plugin: token safety oracle for AI agents trading crypto. Honeypot detection, 27 scam patterns, 6 EVM chains. Push-based wallet monitoring with HMAC-signed alerts. On-chain SafeRouter (Base) for atomic swap protection.
Maintainers
Readme
safeagent-elizaos-plugin
ElizaOS plugin: token safety oracle for AI agents trading crypto.
- Honeypot detection via real DEX swap simulation
- 27 scam pattern checks across 6 EVM chains (Base, Ethereum, Arbitrum, Optimism, Polygon, BSC)
- Push-based wallet monitoring with HMAC-SHA256 signed webhook alerts
- On-chain
SafeRouter(Base) for atomic swap protection — unsafe swaps revert with structured custom error
Install
npm install safeagent-elizaos-pluginUsage
import safeAgentPlugin from "safeagent-elizaos-plugin";
import { AgentRuntime } from "@elizaos/core";
const agent = new AgentRuntime({
plugins: [safeAgentPlugin],
// ...rest of your runtime config
});Actions
| Action | What it does |
|---|---|
| SHIELD | Pre-trade safety check (HTTP). Returns GO/CAUTION/BLOCKED with score, honeypot test result, scam-pattern flags. |
| WATCH_WALLET | Register a wallet for continuous monitoring. AIGEN POSTs HMAC-signed webhooks when a held token's score drops 20+ pts or a new risky holding is detected. |
| SAFE_CHECK | View-only on-chain verdict from SafeRouter (Base). No gas. Use BEFORE building a swap. |
| SAFE_SWAP_CALLDATA | Build calldata for SafeRouter.safeSwap. Returns { to, data, gas_estimate }. The agent retains custody — it signs and broadcasts itself. |
Triggers
The plugin auto-detects:
0xtoken addresses in the user's message- Chain hints (base, ethereum, arbitrum, optimism, polygon, bsc) — defaults to
base - Callback URLs for
WATCH_WALLET
Examples that route to SHIELD:
- "Buy 0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed on base"
- "Is 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 safe?"
- "Check token 0x... for honeypots"
Webhook signature verification
Each WATCH_WALLET alert is signed:
import crypto from "node:crypto";
function verify(payload: any, secret: Buffer): boolean {
const { signature, ...rest } = payload;
const canonical = JSON.stringify(rest, Object.keys(rest).sort());
const expected = crypto.createHmac("sha256", secret).update(canonical).digest("hex");
return crypto.timingSafeEqual(Buffer.from(signature, "hex"), Buffer.from(expected, "hex"));
}Public-key fingerprint to pin: GET https://cryptogenesis.duckdns.org/watch/public-key
On-chain contracts (Base)
| Component | Address |
|---|---|
| SafeRouter V2 | 0xF6EFc5D5902d1a0ce58D9ab1715Cf30f077D8f6e |
| SafeRouter V1 | 0xb200357a35C7e96A81190C53631BC5Beca84A8FA |
| Safety oracle (ERC-7913) | 0x37b9e9B8789181f1AaaD1cD51A5f00A887fa9b8e |
| Aerodrome router (wrapped) | 0xcf77a3ba9a5ca399b7c97c74d54e5b1beb874e43 |
When SAFE_SWAP_CALLDATA is executed and the output token scores < 40 on the oracle, the swap reverts atomically with TokenUnsafe(token, score, flags, minRequired) — a structured custom error the agent can decode without string parsing.
First swap proof: basescan.org/tx/0x83a0384a...
Block path proof: basescan.org/tx/0xc68b1ef6...
Cost
Free during beta. No auth required. Stats endpoint: https://cryptogenesis.duckdns.org/stats
License
MIT — see LICENSE.
Source
- Plugin: https://github.com/Aigen-Protocol/plugin-safeagent
- AIGEN Protocol: https://github.com/Aigen-Protocol/aigen-protocol
- Safety oracle (Solidity): https://github.com/Aigen-Protocol/safeguard
