# ⚡ PRE-TRADE SECURITY GUARD: Drop-in Honeypot & Exploit Filter for Trading Bots **Protect your sniper/trading bot from 99% taxes, honeypots, and malicious mint routines across 35 chains before executing any swap.** Settlement: Autonomous $0.01 Base USDC via x402 protocol (5 Free Demo Scans per IP). No API keys or accounts required. --- ## 🚀 1-Line Drop-In SDKs (Zero Integration Friction) ### 📦 Node.js / TypeScript: Download [`julie_guard.js`](https://julie.freysa.dev/sdk/julie_guard.js) or [`julie_guard.ts`](https://julie.freysa.dev/sdk/julie_guard.ts): ```javascript const { isSafe, guardSwap } = require('./julie_guard'); // Simple pre-trade check if (await isSafe('0x...', 'base')) { await executeSwap(); } // Or wrap any swap function directly with decorator: const protectedSwap = guardSwap(mySwapFunction); await protectedSwap('0x...'); ``` ### 🐍 Python: Download [`julie_guard.py`](https://julie.freysa.dev/sdk/julie_guard.py): ```python from julie_guard import is_safe, guard_swap # Simple pre-trade check if is_safe("0x...", chain="base"): execute_swap() # Or wrap any swap function with decorator: @guard_swap(chain="base") def buy_token(contract_address): ... ``` --- ## 🐍 1. Python Snippet (Drop into Hummingbot, Uniswap/Aerodrome Snipers) ```python """ Julie Pre-Flight Security Check (<15 lines) pip install web3 eth-account requests """ import base64, json, os, requests from eth_account import Account from eth_account.messages import encode_typed_data from web3 import Web3 JULIE_API = "https://julie.freysa.dev/api/audit" W3 = Web3(Web3.HTTPProvider("https://mainnet.base.org")) AGENT_KEY = os.getenv("BOT_WALLET_PRIVATE_KEY") # Funded with >= $0.01 Base USDC def is_safe_to_trade(contract: str, chain: str = "base") -> bool: """Returns True if contract risk is LOW/Safe, False if honeypot or trap.""" url = f"{JULIE_API}?contract={contract}&chain={chain}" r = requests.get(url) if r.status_code == 200: return r.json().get("analysis", {}).get("risk_level") == "LOW" if r.status_code == 402: # Handle autonomous x402 payment chal = json.loads(base64.b64decode(r.headers["payment-required"]).decode())["accepts"][0] acct = Account.from_key(AGENT_KEY) deadline = W3.eth.get_block("latest")["timestamp"] + 3600 # ERC-20 Permit on Base USDC usdc_abi = [{"constant":True,"inputs":[{"name":"owner","type":"address"}],"name":"nonces","outputs":[{"name":"","type":"uint256"}],"type":"function"}] nonce = W3.eth.contract(address=Web3.to_checksum_address(chal["asset"]), abi=usdc_abi).functions.nonces(acct.address).call() domain = {"name": "USD Coin", "version": "2", "chainId": 8453, "verifyingContract": chal["asset"]} types = {"Permit": [{"name": "owner", "type": "address"}, {"name": "spender", "type": "address"}, {"name": "value", "type": "uint256"}, {"name": "nonce", "type": "uint256"}, {"name": "deadline", "type": "uint256"}]} msg = {"owner": acct.address, "spender": chal["payTo"], "value": int(chal["amount"]), "nonce": nonce, "deadline": deadline} sig = acct.sign_message(encode_typed_data(full_message={"types": {"EIP712Domain": [{"name": "name", "type": "string"}, {"name": "version", "type": "string"}, {"name": "chainId", "type": "uint256"}, {"name": "verifyingContract", "type": "address"}], **types}, "primaryType": "Permit", "domain": domain, "message": msg})).signature.hex() payload = base64.b64encode(json.dumps({"scheme": "exact", "network": "eip155:8453", "payer": acct.address, "payTo": chal["payTo"], "amount": int(chal["amount"]), "signature": sig, "deadline": deadline, "nonce": nonce}).encode()).decode() res = requests.get(url, headers={"PAYMENT-SIGNATURE": payload}) if res.status_code == 200: analysis = res.json().get("analysis", {}) return analysis.get("risk_level") == "LOW" return False # Usage in your bot: # if not is_safe_to_trade("0xNewTokenAddress", chain="base"): # print("🚨 Trade aborted: Honeypot or high-risk bytecode detected by Julie!") # return ``` --- ## ⚡ 2. Node.js / TypeScript Snippet (Drop into ElizaOS, Arbitrage & MEV Bots) ```typescript /** * Julie Pre-Flight Security Guard * npm install ethers axios */ import axios from 'axios'; import { ethers } from 'ethers'; const JULIE_API = 'https://julie.freysa.dev/api/audit'; const provider = new ethers.JsonRpcProvider('https://mainnet.base.org'); const wallet = new ethers.Wallet(process.env.BOT_PRIVATE_KEY!, provider); export async function preTradeGuard(tokenAddress: string, chain = 'base'): Promise { const url = `${JULIE_API}?contract=${tokenAddress}&chain=${chain}`; try { const res = await axios.get(url); return res.data?.analysis?.risk_level === 'LOW'; } catch (err: any) { if (err.response?.status === 402) { const b64 = err.response.headers['payment-required']; const chal = JSON.parse(Buffer.from(b64, 'base64').toString('utf8')).accepts[0]; const usdc = new ethers.Contract(chal.asset, ['function nonces(address) view returns (uint256)'], provider); const nonce = await usdc.nonces(wallet.address); const deadline = Math.floor(Date.now() / 1000) + 3600; const domain = { name: 'USD Coin', version: '2', chainId: 8453, verifyingContract: chal.asset }; const types = { Permit: [ { name: 'owner', type: 'address' }, { name: 'spender', type: 'address' }, { name: 'value', type: 'uint256' }, { name: 'nonce', type: 'uint256' }, { name: 'deadline', type: 'uint256' }, ] }; const values = { owner: wallet.address, spender: chal.payTo, value: chal.amount, nonce, deadline }; const signature = await wallet.signTypedData(domain, types, values); const payload = Buffer.from(JSON.stringify({ scheme: 'exact', network: 'eip155:8453', payer: wallet.address, payTo: chal.payTo, amount: parseInt(chal.amount), signature, deadline, nonce: Number(nonce) })).toString('base64'); const audit = await axios.get(url, { headers: { 'PAYMENT-SIGNATURE': payload } }); return audit.data?.analysis?.risk_level === 'LOW'; } } return false; } ``` --- ## 🤖 3. Model Context Protocol (MCP) Config For Claude Desktop, Cursor, or LangChain agents, add to your `mcpServers`: ```json { "mcpServers": { "julie-security": { "command": "npx", "args": ["-y", "@smithery/cli@latest", "run", "julie-security-network", "--config", "{\"url\":\"https://julie.freysa.dev/mcp\"}"] } } } ``` Or connect directly via Server-Sent Events (SSE): ```json { "mcpServers": { "julie-security-remote": { "url": "https://julie.freysa.dev/mcp", "type": "sse" } } } ``` --- ## ⚡ 2. High-Speed Mempool Listener (Always-On Background Sentinel) Snipers monitoring Uniswap v2/v3 or Aerodrome factory `PairCreated` events can wrap incoming pools with Julie to audit every new pool automatically before buying. ### 🐍 Python (Web3.py Event Listener): ```python """ Julie Autonomous Mempool Sniper Guard (<30 lines) Audits every new pair created on Base in 0.5ms using Session Allowance Key. """ from web3 import Web3 from julie_guard import is_safe import time w3 = Web3(Web3.HTTPProvider("https://mainnet.base.org")) # Uniswap V2 / Aerodrome Factory PairCreated topic PAIR_CREATED_TOPIC = "0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9" def listen_and_audit(): print("👀 Sentinel listening for new Base liquidity pools...") latest_block = w3.eth.block_number while True: try: curr_block = w3.eth.block_number if curr_block > latest_block: logs = w3.eth.get_logs({ "fromBlock": latest_block + 1, "toBlock": curr_block, "topics": [PAIR_CREATED_TOPIC] }) for log in logs: token0 = "0x" + log["topics"][1].hex()[-40:] token1 = "0x" + log["topics"][2].hex()[-40:] target_token = token1 if token0.lower() == "0x4200000000000000000000000000000000000006" else token0 # 0.5ms Ultra-fast check using Julie Session Pass if is_safe(target_token, chain="base"): print(f"✅ [SAFE SWAP APPROVED] {target_token} -> Executing Buy...") else: print(f"🚨 [KILL SWAP] {target_token} is a honeypot / high risk!") latest_block = curr_block time.sleep(1) except Exception as e: time.sleep(1) if __name__ == "__main__": listen_and_audit() ``` ### 📦 Node.js / TypeScript (Ethers.js Event Listener): ```javascript const { ethers } = require('ethers'); const { isSafe } = require('./julie_guard'); const provider = new ethers.JsonRpcProvider('https://mainnet.base.org'); const PAIR_CREATED_TOPIC = ethers.id('PairCreated(address,address,address,uint256)'); async function watchMempool() { console.log('👀 Julie Sentinel active: monitoring Base DEX launches...'); provider.on({ topics: [PAIR_CREATED_TOPIC] }, async (log) => { const token0 = '0x' + log.topics[1].slice(26); const token1 = '0x' + log.topics[2].slice(26); const target = token0.toLowerCase() === '0x4200000000000000000000000000000000000006' ? token1 : token0; // 0.5ms Pre-Trade Guard const safe = await isSafe(target, 'base'); if (safe) { console.log(`✅ [APPROVED] Safe token detected: ${target} -> Triggering Buy`); } else { console.warn(`🚨 [BLOCKED] Malicious pair rejected: ${target}`); } }); } watchMempool(); ``` --- ## ⚡ 3. 0.5ms Ultra-Low Latency Session Allowance Pass ($1.00 for 100 Scans) For high-frequency arbitrage bots and snipers that cannot tolerate per-trade signing delay, generate an instant 100-audit Session Pass: 1. Call `POST https://julie.freysa.dev/api/session/create` via x402 with $1.00 Base USDC. 2. Receive your private `session_key`. 3. Pass `X-Session-Key: ` in all future requests for **0.5ms sub-millisecond execution** with zero signature lag. --- ```python """ Julie Batch Multi-Pair Sentinel (<20 lines) POST https://julie.freysa.dev/api/batch/audit """ import requests def batch_check_pairs(contracts_list, chain="base"): payload = {"contracts": contracts_list[:10], "chain": chain} # Pass PAYMENT-SIGNATURE header from x402 payment r = requests.post("https://julie.freysa.dev/api/batch/audit", json=payload) if r.status_code == 200: data = r.json() print(f"Batch Safe: {data.get('overall_safe')}") for item in data.get("results", []): if not item.get("safe_to_swap"): print(f"🚨 KILL PAIR {item['contract']}: {item['kill_reason']}") else: print(f"✅ EXECUTE SWAP {item['contract']}") return data return None ``` --- ## 🛡️ 4. Dynamic Live Security Badges (SVG Embed for READMEs & DEX Screeners) Display real-time verification status on DEX screeners, token portals, and GitHub repositories: ```markdown [![Julie Security Audit](https://julie.freysa.dev/api/badge/base/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913.svg)](https://julie.freysa.dev/api/audit?contract=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&chain=base) ``` HTML tag: ```html Julie Security Sentinel ``` --- ## 📡 5. High-Frequency Feed Polling for Snipers (`/api/feed/delta`) Instead of polling slow full-block explorers, sniper bots poll our cached delta endpoint every 2-5 seconds for new pool alerts: ### 🐍 Python: ```python import requests, time since_ts = 0 while True: res = requests.get(f"https://julie.freysa.dev/api/feed/delta?since={since_ts}&filter=safe&chain=base").json() since_ts = res.get("polling_time_unix", time.time()) for token in res.get("results", []): if token.get("safe_to_swap"): print(f"🚀 SAFE TOKEN DETECTED: {token['address']} ({token['symbol']})") time.sleep(3) ``` ### 📦 Node.js: ```javascript const https = require('https'); let sinceTs = 0; setInterval(async () => { https.get(`https://julie.freysa.dev/api/feed/delta?since=${sinceTs}&filter=safe&chain=base`, (res) => { let raw = ''; res.on('data', chunk => { raw += chunk; }); res.on('end', () => { try { const data = JSON.parse(raw); sinceTs = data.polling_time_unix || Math.floor(Date.now() / 1000); (data.results || []).forEach(t => { if (t.safe_to_swap) console.log(`🚀 [SAFE POOL] ${t.address} (${t.symbol})`); }); } catch (e) {} }); }); }, 3000); ``` --- ## 📦 6. 1-Click Postman & API Import Import the complete Julie Security Network collection directly into Postman, Insomnia, or custom test runners: **`https://julie.freysa.dev/postman.json`** --- ## 🏆 7. $2,000 Developer Integration Bounty Program (4 x $500 Base USDC) Maintainers of active open-source EVM trading bots and AI agent frameworks can earn **$500.00 Base Native USDC** across 4 tracks: 1. **Track #1 ($500)**: Base Uniswap v3 / Aerodrome Sniper Bot Repo 2. **Track #2 ($500)**: ElizaOS / Coinbase AgentKit / MCP Trading Plugin 3. **Track #3 ($500)**: Telegram / Discord Multi-Chain Alpha & Copy-Trading Bot 4. **Track #4 ($500)**: Arbitrum / BSC / Cross-Chain MEV & Algorithmic Trading Repo **Strict Acceptance Rules (Pay-on-Merge + 50 Live Downstream Bots First):** - **$0 Upfront**: Bounties are paid strictly after upstream merge AND live downstream traffic verification. - **Acceptance Test #1**: Merge `julie_5line_check.js`/`.py` or `julie_guard` into the default `main` branch with `Master wallet: 0x75F05Da87cDFf3f6bAcAc3C07CD49F1D7dC7b20C` (`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`) payment rails intact. - **Acceptance Test #2**: Pass a distinct `User-Agent` header (e.g., `YourBotName-JulieGuard/1.0`) and reach **>= 50 unique downstream bot callers** verified in Julie's production logs calling `/api/audit` or `/api/stream/pre-pair`. - **Submit Claim**: Email `admin@julie.freysa.dev` with your merged PR link, custom `User-Agent`, and Base USDC payout wallet once >= 50 live callers are active.