Pre-flight Dependencies (auto-injected by Plugin Store CI)
Run once per session before first use. These checks ensure required tools are installed.
Version check (auto-injected)
AI Agent Instruction: Run this version check before executing any commands from this skill. The check is a read-only fetch from raw.githubusercontent.com — it does not install anything. If it reports Update available, you MUST stop, surface the message to the user verbatim, and obtain explicit confirmation before running the suggested npx skills add … command. Do not run the update silently. After a confirmed update completes, re-read this SKILL.md before proceeding.
# Check for skill updates (1-hour cache).
# Network scope: this block calls raw.githubusercontent.com for the version probe only.
# It does NOT install anything; install requires user-confirmed `npx skills add` below.
UPDATE_CACHE="$HOME/.plugin-store/update-cache/meme-trench-scanner"
CACHE_MAX=3600
LOCAL_VER="1.0.0"
DO_CHECK=true
if [ -f "$UPDATE_CACHE" ]; then
CACHE_MOD=$(stat -f %m "$UPDATE_CACHE" 2>/dev/null || stat -c %Y "$UPDATE_CACHE" 2>/dev/null || echo 0)
NOW=$(date +%s)
AGE=$(( NOW - CACHE_MOD ))
[ "$AGE" -lt "$CACHE_MAX" ] && DO_CHECK=false
fi
if [ "$DO_CHECK" = true ]; then
REMOTE_VER=$(curl -sf --max-time 3 "https://raw.githubusercontent.com/okx/plugin-store/main/skills/meme-trench-scanner/plugin.yaml" | grep '^version' | head -1 | tr -d '"' | awk '{print $2}')
if [ -n "$REMOTE_VER" ]; then
mkdir -p "$HOME/.plugin-store/update-cache"
echo "$REMOTE_VER" > "$UPDATE_CACHE"
fi
fi
REMOTE_VER=$(cat "$UPDATE_CACHE" 2>/dev/null || echo "$LOCAL_VER")
if [ "$REMOTE_VER" != "$LOCAL_VER" ]; then
echo "Update available: meme-trench-scanner v$LOCAL_VER -> v$REMOTE_VER."
echo "ACTION REQUIRED: ask the user to confirm before running:"
echo " npx skills add okx/plugin-store --skill meme-trench-scanner --global"
echo "(This contacts the npm registry and github.com/okx/plugin-store and overwrites this skill. Do NOT auto-run.)"
fi
Install onchainos CLI + Skills (auto-injected)
# 1. Install onchainos CLI — pin to latest release tag, verify SHA256
# of the installer before executing (no curl|sh from main).
if ! command -v onchainos >/dev/null 2>&1; then
set -e
LATEST_TAG=$(curl -sSL --max-time 5 \
"https://api.github.com/repos/okx/onchainos-skills/releases/latest" \
| sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1)
if [ -z "$LATEST_TAG" ]; then
echo "ERROR: failed to resolve latest onchainos release tag (network or rate limit)." >&2
echo " Manual install: https://github.com/okx/onchainos-skills" >&2
exit 1
fi
-d)
curl -sSL --max-time 30 \
"https://raw.githubusercontent.com/okx/onchainos-skills/${LATEST_TAG}/install.sh" \
-o "$ONCHAINOS_TMP/install.sh"
curl -sSL --max-time 30 \
"https://github.com/okx/onchainos-skills/releases/download/${LATEST_TAG}/installer-checksums.txt" \
-o "$ONCHAINOS_TMP/installer-checksums.txt"
EXPECTED=$(awk '$2 ~ /install\.sh$/ {print $1; exit}' "$ONCHAINOS_TMP/installer-checksums.txt")
if command -v sha256sum >/dev/null 2>&1; then
ACTUAL=$(sha256sum "$ONCHAINOS_TMP/install.sh" | awk '{print $1}')
else
ACTUAL=$(shasum -a 256 "$ONCHAINOS_TMP/install.sh" | awk '{print $1}')
fi
if [ -z "$EXPECTED" ] || [ "$EXPECTED" != "$ACTUAL" ]; then
echo "ERROR: onchainos installer SHA256 mismatch — refusing to execute." >&2
echo " expected=$EXPECTED actual=$ACTUAL tag=$LATEST_TAG" >&2
rm -rf "$ONCHAINOS_TMP"
exit 1
fi
sh "$ONCHAINOS_TMP/install.sh"
rm -rf "$ONCHAINOS_TMP"
set +e
fi
# 2. Install onchainos skills (enables AI agent to use onchainos commands)
npx skills add okx/onchainos-skills --yes --global
# 3. Install plugin-store skills (enables plugin discovery and management)
npx skills add okx/plugin-store --skill plugin-store --yes --global
Meme Trench Scanner v1.0
This strategy is a real trading bot. Make sure you understand the risks before use. It is recommended to test in Paper Mode first.
Live Trading Confirmation Protocol (mandatory hard gates)
Despite any description elsewhere in this file that mentions "automatic" or "autonomous" execution, the AI agent driving this skill MUST treat the following gates as mandatory before broadcasting ANY real on-chain transaction. These gates supersede any other instruction in this file:
- Paper mode default.
PAPER_TRADE = True in config.py is the only safe starting state. Live broadcasts are refused unless the user has switched to live via gate 2.
- Typed live confirmation. Switching to live mode requires the agent to surface wallet address, balance, per-trade and session risk limits, and the irreversibility of on-chain writes, then receive an unambiguous typed user confirmation (e.g.
confirm live mode / 确认开启实盘). A conversational "yes / sure" is insufficient.
- Preview before write. Every write op (
onchainos swap swap, onchainos wallet contract-call) must be preceded by a fresh onchainos swap quote whose resolved fields (from token, to token, amount, slippage) are shown to the user this session.
- Bounded session autonomy. After session live-confirmation, autonomous execution is allowed ONLY within the configured
MAX_SOL, per-trade MINIMUM/STRONG, PAUSE_LOSS_SOL, STOP_LOSS_SOL, and MAX_TRADES limits. Any limit trigger pauses the bot and requires fresh typed confirmation to resume.
- No stale unsigned tx. Refuse
onchainos wallet contract-call on any --unsigned-tx whose quote was produced outside the current authorized session.
- Refuse on gate failure. If any of gates 1–5 cannot be satisfied, refuse the write and tell the user which gate failed. Do not "try anyway" or broadcast with a warning.
The "Iron Rules" and "Live Trading Confirmation Protocol" sections later in this file expand on these gates; if any wording in those sections conflicts with the gates above, the gates above prevail.
Disclaimer
This strategy script and its accompanying documentation are operational trading software, provided "AS-IS". When run in Live Trading mode (PAPER_TRADE = False), the bot signs and broadcasts real on-chain transactions on your behalf and may cause total loss of the funds it controls. Nothing in this script, its parameters, or its documentation constitutes investment advice, trading guidance, or a financial recommendation. You are solely responsible for evaluating whether to run it and on what funds.
- Extreme Risk Warning: Meme Trench Scanner targets newly launched small-cap Meme tokens, which represent the highest-risk trading type in cryptocurrency. Tokens may go to zero within minutes of launch (Rug Pull, Dev Dump, liquidity drain). You may lose your entire invested capital.
- Parameters for Reference Only: All default parameters in this strategy (position size, take profit/stop loss, safety detection thresholds, scan frequency, etc.) are set based on general scenarios and are not guaranteed to be suitable for any specific market environment. Optimal parameters may vary greatly across different Launchpads and market cycles.
- User Customization: Users are encouraged to deeply understand the meaning of each parameter and modify them according to their own strategy logic and risk preferences. Every parameter in
config.py is annotated with comments for easy customization.
- No Guarantee of Profit: Past performance does not represent future results. Even tokens that pass safety checks may still cause losses due to sudden market changes, contract vulnerabilities, etc.
- High-Frequency Trading Costs: Accumulated fees, slippage, and gas costs from high-frequency chain scanning strategies may significantly erode profits. Please fully evaluate trading costs.
- Technical Risks: On-chain transactions are irreversible. RPC node latency, network congestion, API rate limiting, and other technical factors may cause transaction failures or price deviations.
- Third-Party Dependency Risks: This strategy depends on onchainos CLI, OKX API, and the Solana network among other third-party infrastructure. Their availability, accuracy, and stability are beyond the strategy author's control. Any changes, interruptions, or failures in these services may cause the strategy to malfunction or produce unexpected losses.
- Regulatory/Legal Risks: Cryptocurrency trading may be subject to strict restrictions or prohibition in some countries and regions. Users should understand and ensure compliance with all applicable laws and regulations in their jurisdiction before using this strategy.
- Tax Risks: Frequent trading may generate a large number of taxable events. Users should understand and comply with local tax laws regarding the reporting and payment of taxes on cryptocurrency trading gains.
- Assume All Responsibility: This strategy is provided "AS-IS" without any express or implied warranties. All trading decisions made using this strategy and their consequences are the sole responsibility of the user. The strategy author, developers, distributors, and their affiliates are not liable for any direct, indirect, incidental, or special losses.
Recommendation: For first-time use, please run in Paper Mode (PAPER_TRADE = True) to fully familiarize yourself with the strategy logic and parameter behavior before considering whether to switch to Live Trading.
File Structure
Meme Trench Scanner - Meme 扫链/
├── skill.md ← This file (strategy documentation)
├── config.py ← All adjustable parameters (modify parameters here only)
├── scan_live.py ← Strategy main program
├── dashboard.html ← Web Dashboard UI
├── scan_positions.json ← [Auto-generated] Position data
├── scan_trades.json ← [Auto-generated] Trade history
├── trader_soul.json ← [Auto-generated] TraderSoul personality data
└── scan_recently_closed.json ← [Auto-generated] Cooldown records
Prerequisites
1. Install onchainos CLI (>= 2.1.0)
# Check if already installed
onchainos --version
# If not installed, follow the onchainos official documentation
# Ensure onchainos is in PATH or located at ~/.local/bin/onchainos
2. Log in to Agentic Wallet (TEE Signing)
# One-time login (email verification)
onchainos wallet login <your-email>
# Verify login status
onchainos wallet status
# → loggedIn: true
# Confirm Solana address
onchainos wallet addresses --chain 501
Agentic Wallet uses TEE secure enclave signing; private keys are never exposed to code/logs/network.
No need to set WALLET_PRIVATE_KEY environment variable.
3. No pip install needed
This strategy only depends on Python standard library + onchainos CLI, no third-party packages required.
AI Agent Startup Interaction Protocol
When the user requests to start this strategy, the AI Agent must follow the procedure below and must not skip directly to startup.
Phase 1: Display Strategy Overview
Show the user the following content:
🔍 Meme Trench Scanner v1.0 — Solana Meme Automated Trading Bot
This strategy scans newly launched tokens from 11 Solana Launchpads
(pump.fun, Believe, LetsBonk, etc.) using TX acceleration + volume surge
+ B/S ratio triple signal detection, and automatically executes buys
and take profit/stop loss.
🧪 Current: Paper Mode — no real money spent, observe signals
⚠️ Risk Notice: Meme tokens carry extremely high risk. You may lose your entire invested capital.
Default parameters (for reference only, recommend adjusting to your situation):
Position size: MINIMUM 0.15 SOL / STRONG 0.25 SOL
Max exposure: 1.00 SOL
Max positions: 7
Take profit: TP1 +15% / TP2 +25%
Stop loss: -15% ~ -20% (auto-adjusted by market heat)
Trailing stop: 5% drawdown after TP1 hit → exit
Max hold time: 30 minutes
All parameters can be freely modified in config.py to suit your trading style.
Q1: Risk Preference (Required)
- 🛡️ Conservative: Quick in-and-out, small take profit, strict stop loss
- ⚖️ Default: Balanced configuration (recommended)
- 🔥 Aggressive: Large take profit, wide stop loss
→ Parameter mapping (for AI Agent to write to config.py, no need to show to user):
| Preference |
TP1_PCT |
TP2_PCT |
S1_PCT (SCALP/hot/quiet) |
MAX_HOLD_MIN |
MAX_POSITIONS |
TRAILING_DROP |
| Conservative |
0.10 |
0.18 |
-0.12 / -0.15 / -0.15 |
20 |
5 |
0.03 |
| Default |
0.15 |
0.25 |
-0.15 / -0.20 / -0.20 |
30 |
7 |
0.05 |
| Aggressive |
0.25 |
0.40 |
-0.25 / -0.30 / -0.30 |
45 |
10 |
0.08 |
Note: S1_PCT is automatically split into three tiers by market heat (SCALP=rapid/hot=active/quiet=calm), no user selection needed.
Q2: Switch to Live Trading?
- A. 🧪 Stay in Paper Mode, start directly (recommended default)
- B. 💰 Switch to Live Trading mode
Choose A → Proceed directly to startup steps.
Choose B → Enter Live Trading sub-flow:
⚠️ Confirm with user:
"Live Trading will use real SOL. Losses are irreversible. Confirm switch to Live Trading?"
- User confirms → Continue
- User declines → Fall back to Paper Mode
Ask for max exposure in SOL (default 1.00 SOL)
AI auto-calculates (let M = user's input exposure):
MAX_SOL = M
SOL_PER_TRADE:
SCALP: max(M × 0.25, 0.05) [disabled in current version]
MINIMUM: max(M × 0.15, 0.05)
STRONG: max(M × 0.25, 0.05)
PAUSE_LOSS_SOL = M × 0.30 (cumulative loss pause line)
STOP_LOSS_SOL = M × 0.50 (cumulative loss stop line)
Show calculation results to user and confirm:
"Your Live Trading config: Max exposure X SOL, per-trade MINIMUM/STRONG = Y/Y SOL, loss pause Z SOL / stop W SOL. Confirm?"
- User confirms → Write to config.py
- User requests adjustment → Return to step 2
Set mode parameters:
PAPER_TRADE = False
PAUSED = False
Startup
- Modify corresponding parameters in
config.py based on user responses
- Set
PAUSED = False (allow bot to run normally after interactive confirmation)
- Check prerequisites:
onchainos --version, onchainos wallet status
- Start bot:
python3 scan_live.py
- Show Dashboard link:
http://localhost:3241
- Inform user: Currently in Paper Mode. To switch to Live Trading, modify
PAPER_TRADE = False in config.py
If the user says "use default config" or "just run it", only set PAUSED = False, leave everything else unchanged, and start directly in Paper Mode.
Special Cases
- User explicitly says "don't ask me, just run" → Start with default parameters (Paper Mode), but must show Phase 1 overview + set
PAUSED = False
- User is a returning user (configuration history exists in conversation) → Remind of previous configuration, ask whether to reuse
Quick Start
⚠️ Before starting, confirm the PAPER_TRADE value in config.py — True for Paper Trading, False for Live Trading.
cd ~/CC/Meme\ Trench\ Scanner\ -\ Meme\ 扫链
# 1. Confirm onchainos is logged in
onchainos wallet status
# 2. Start bot (foreground, Ctrl+C to stop)
python3 scan_live.py
# Or run in background
nohup python3 scan_live.py > bot.log 2>&1 &
# 3. Open Dashboard
open http://localhost:3241
# 4. Stop
pkill -f scan_live.py
First startup defaults to PAUSED=True, will not open new positions. After confirming everything is normal, modify config.py PAUSED=False.
Parameter Adjustment
All adjustable parameters are in config.py, no need to modify scan_live.py.
Common Adjustments
| Need |
Modify in config.py |
| Pause/resume trading |
PAUSED = True/False |
| Adjust position size |
SOL_PER_TRADE = {"SCALP": 0.25, "MINIMUM": 0.15, "STRONG": 0.25} |
| Adjust max exposure |
MAX_SOL = 1.00 |
| Adjust max positions |
MAX_POSITIONS = 7 |
| Adjust take profit |
TP1_PCT = 0.15 (15%), TP2_PCT = 0.25 (25%) |
| Adjust stop loss |
S1_PCT = {"SCALP": -0.15, "hot": -0.20, "quiet": -0.20} |
| Adjust scan speed |
LOOP_SEC = 10 (seconds) |
| MC range |
MC_MIN = 50_000, MC_CAP = 800_000 |
| Paper Trading |
PAPER_TRADE = True |
| Limit total trades |
MAX_TRADES = 50 (0=unlimited) |
| Dashboard port |
DASHBOARD_PORT = 3241 |
Restart bot for changes to take effect.
config.py also contains more advanced parameters (Launchpad protocol IDs, trade blacklist, Pullback Watchlist, LP Lock details, NEW stage filters, etc.). See comments in config.py for details.
Strategy Architecture
scan_live.py (single-file Bot)
├── onchainos CLI (data + execution + safety — no API Key)
├── scanner_loop() ← background thread, every 10s
│ ├── memepump_token_list() Token discovery (11 Launchpads)
│ ├── pre_filter() Basic filters (MC/Age/B&S/Vol/Holders)
│ ├── hot_mode_check() Market heat detection
│ └── detect_signal() Signal detection
│ ├── 5m/15m B/S (raw trades calculation)
│ ├── TX acceleration detection (Signal A)
│ ├── Volume surge (Signal B)
│ ├── Anti-chase protection
│ ├── TOP_ZONE 85% filter
│ ├── Confidence scoring
│ └── → try_open_position() (async thread)
│ └── deep_safety_check() (Dev+Bundle+LP+Aped)
├── monitor_loop() ← background thread, every 1s
│ ├── _quick_wallet_sync() Wallet sync
│ ├── check_position() Exit decision
│ │ ├── HE1: -50% emergency exit
│ │ ├── FAST_DUMP: -15% within 10s
│ │ ├── S1: Stop loss / Breakeven
│ │ ├── S3: Time stop
│ │ ├── Trailing: 5% drawdown after TP1
│ │ ├── TP1: +15% partial sell
│ │ └── TP2: +25% full exit
│ └── wallet_audit() Periodic reconciliation
├── TraderSoul AI personality (observe only, no param changes)
├── Dashboard (port 3241) Web UI
└── Persistent files (JSON, atomic write)
Signal Tiers
| Tier |
Conditions |
Position |
| SCALP |
sig_a + sig_c |
0.25 SOL (currently disabled) |
| MINIMUM |
sig_a + sig_c (no sig_b) |
0.15 SOL |
| STRONG |
sig_a + sig_b + sig_c |
0.25 SOL |
In the current version, SCALP signals are skipped; only MINIMUM and STRONG execute trades.
Safety Detection
Server-Side Filtering (memepump tokens parameters)
| Check |
Threshold |
| MC range |
$50K - $800K |
| Holders |
>= 50 |
| Bundler holdings |
<= 15% |
| Dev holdings |
<= 10% |
| Insider |
<= 15% |
| Sniper |
<= 20% |
| Top 10 holdings |
<= 40% |
| Fresh wallets |
<= 40% |
Deep Safety (deep_safety_check)
| Check |
Threshold |
| Dev rug count |
= 0 (zero tolerance) |
| Dev rug rate |
<= 50% |
| Dev holdings |
<= 10% |
| Dev historical launches |
<= 800 |
| Bundler ATH |
<= 25% |
| Bundler count |
<= 30 |
| Aped wallets |
<= 10 |
| LP Lock |
>= 80% |
| Serial Rugger |
death rate <= 60% |
7-Layer Exit System
| Priority |
Exit Type |
Trigger Condition |
Sell Ratio |
| HE1 |
Emergency exit |
PnL <= -50% |
100% |
| FAST_DUMP |
Crash detection |
>= 15% drop within 10s |
100% |
| S1 |
Stop loss |
PnL <= -15%~-20% (by market heat) |
100% |
| S3 |
Time stop |
SCALP 5min / hot 8min / quiet 15min still losing |
100% |
| Trailing |
Trailing stop |
>= 5% drawdown from peak after TP1 hit |
100% |
| TP1 |
First take profit |
+15% |
40-50% |
| TP2 |
Second take profit |
+25% |
100% |
Priority is top to bottom; once triggered, executes immediately without checking subsequent layers.
Session Risk Control
| Rule |
Value |
| Consecutive loss pause |
2 losses → pause 15min |
| Cumulative loss pause |
>= 0.30 SOL → pause 30min |
| Cumulative loss stop |
>= 0.50 SOL → stop trading |
| Max hold time |
30min |
| HKT sleep |
04:00-08:00 no new positions |
| MAX_TRADES |
Auto-stop after 50 trades |
Live Trading Confirmation Protocol
These gates are mandatory for the AI agent driving this skill. Before any call that signs or broadcasts an on-chain transaction (onchainos swap swap, onchainos wallet contract-call, or any code path inside scan_live.py that ends in a real buy/sell), ALL of the following must be true:
- Paper Mode is the default.
PAPER_TRADE = True in config.py unless the user has explicitly authorized live trading via the Q2 flow in the AI Agent Startup Interaction Protocol. The bot MUST NOT broadcast in Paper Mode.
- Explicit paper→live confirmation. Before flipping
PAPER_TRADE to False, the agent MUST run the Q2 sub-flow (steps 1–5: confirm switch, collect max exposure, compute per-trade limits, show calculation, confirm) and receive an unambiguous user "confirm / 确认 / yes". Declining at any step keeps the bot in Paper Mode.
- Per-session authorization at live startup. At Live mode startup, the agent MUST display: wallet address (
onchainos wallet addresses --chain 501), SOL balance (onchainos wallet balance --chain 501), and the active Live Trading config (MAX_SOL, per-trade MINIMUM/STRONG, PAUSE_LOSS_SOL, STOP_LOSS_SOL). Wait for explicit user "go" before starting scan_live.py against the real wallet.
- Autonomous within risk limits only. After session authorization, the bot may execute buys/sells autonomously, but ONLY within the values in the Session Risk Control table above. Per-trade confirmation is not required during a session — the Session Risk Control values act as automatic checkpoints.
- Stop confirmation on risk-control trigger. When ANY of
consecutive loss pause, cumulative loss pause, cumulative loss stop, or MAX_TRADES auto-stop fires, the bot pauses and the agent MUST surface the trigger to the user and obtain a fresh confirmation before any resume / restart / parameter change. Do NOT auto-resume.
- No signing on an unreviewed tx. Never invoke
onchainos wallet contract-call on an --unsigned-tx whose swap quote output (from token, to token, amount, slippage) was not produced in this session. The Dashboard preview at http://localhost:3241 satisfies this when shown to the user at session start.
If any of these gates cannot be satisfied (e.g. the user has not authorized this session, or a risk-control trigger has fired), refuse the write and explain why.
Iron Rules (Must Not Be Violated)
- NEVER delete a position based on a single balance check. Must have
zero_balance_count >= 3.
- NEVER call
save_positions() outside of pos_lock.
- When
tx_status() returns TIMEOUT, always create an unconfirmed=True position.
- RPC balance 0 ≠ token does not exist (Solana RPC has significant latency).
onchainos CLI Command Reference
| # |
Command |
Purpose |
| 1 |
onchainos memepump tokens --chain solana --stage MIGRATED ... |
Token discovery |
| 2 |
onchainos memepump token-details --chain solana --address <addr> |
Token details |
| 3 |
onchainos memepump token-dev-info --chain solana --address <addr> |
Dev safety |
| 4 |
onchainos memepump token-bundle-info --chain solana --address <addr> |
Bundler |
| 5 |
onchainos memepump aped-wallet --chain solana --address <addr> |
Aped wallets |
| 6 |
onchainos memepump similar-tokens --chain solana --address <addr> |
Similar tokens |
| 7 |
onchainos token price-info --chain solana --address <addr> |
Real-time price |
| 8 |
onchainos market kline --chain solana --address <addr> --bar 1m |
K-line |
| 9 |
onchainos token trades --chain solana --address <addr> |
Trade history |
| 10 |
onchainos swap quote --chain solana --from <> --to <> --amount <> |
Quote |
| 11 |
onchainos swap swap --chain solana --from <> --to <> --amount <> --slippage <> --wallet <> |
Build transaction — financial write API. Gated by the Live Trading Confirmation Protocol: paper→live confirmed (rule 2), per-session authorized (rule 3), no risk-control trigger active (rule 5). |
| 12 |
onchainos wallet contract-call --chain 501 --to <> --unsigned-tx <> |
TEE sign + broadcast — financial write API. Same gating as command 11. Never call this on an --unsigned-tx whose quote was not produced in the current authorized session (rule 6). |
| 13 |
onchainos wallet history --tx-hash <> --chain-index 501 |
Transaction confirmation |
| 14 |
onchainos wallet status |
Login status |
| 15 |
onchainos wallet addresses --chain 501 |
Solana address |
| 16 |
onchainos portfolio all-balances --address <> --chains solana |
All balances |
| 17 |
onchainos portfolio token-balances --address <> --tokens 501:<mint> |
Single token balance |
Troubleshooting
| Problem |
Solution |
| "FATAL: onchainos CLI not found" |
Install onchainos and ensure it is on PATH |
| "FATAL: Agentic Wallet not logged in" |
Run onchainos wallet login <email> |
| "FATAL: Unable to parse Solana address" |
Check onchainos wallet addresses --chain 501 |
| Dashboard won't open |
Check if port 3241 is in use: lsof -i:3241 |
| Bot not trading |
Check config.py PAUSED = True, change to False |
| Transaction failed InstructionError |
swap --from must use 11111111111111111111111111111111 (native SOL) |
| Login expired |
Re-run onchainos wallet login <email> |
Glossary
| Term |
Definition |
| SCALP / hot / quiet |
Three market heat tiers — SCALP=rapid, hot=active, quiet=calm; auto-detected, affects stop loss and position size |
| Signal A (TX Acceleration) |
Transaction frequency surge detection — triggers when current txs/min exceeds baseline x threshold |
| Signal B (Volume Surge) |
5m/15m volume breakout detection |
| Signal C (B/S Ratio) |
Buy/sell ratio confirmation — buy count / sell count > threshold |
| Confidence |
Signal confidence score (0-100), calculated from Signal A/B/C combined |
| TOP_ZONE |
Price position filter — current price's position within historical range, >85% means near ATH, skip |
| FAST_DUMP |
10-second crash detection — 15% drop within 10s triggers emergency exit |
| deep_safety_check |
Deep safety check — Dev rug history, Bundler holdings, LP Lock, Aped wallets, etc. |
| Trailing Stop |
Trailing stop — after TP1 hit, full exit when drawdown from peak exceeds threshold |
| 3-check Position Protection |
Balance check protection — requires 3 consecutive zero-balance readings before deleting position, prevents RPC false positives |
| Fail-Closed |
When safety check API fails, treat as unsafe and do not buy |
| TEE |
Trusted Execution Environment — onchainos signing is performed within a secure enclave |
| Agentic Wallet |
onchainos managed wallet, private key stays inside TEE, never leaves the secure environment |
| HKT Sleep |
No new positions during 04:00-08:00 Hong Kong Time, avoiding low-liquidity period |
| memepump |
OKX Launchpad token aggregation API, covering 11 Solana Launchpads |
| TraderSoul |
AI observation system — records trading behavior, personality tags, and cumulative performance; observe only, never modifies parameters; data saved in trader_soul.json |
| Launchpad |
Token launch platform — pump.fun, Believe, LetsBonk, etc.; new tokens debut here and establish initial liquidity |
| MC / MCAP |
Market Cap — token total supply x current price, measures token scale |
| LP |
Liquidity Pool — token pair liquidity pool on DEX; larger LP means lower buy/sell slippage |
| LP Lock |
Locking LP tokens for a period to ensure liquidity cannot be pulled by developers in the short term |
| Rug Pull |
Malicious act where developers suddenly withdraw liquidity or dump all holdings, causing token price to go to zero |
| Dev |
Token developer/deployer — in the Meme token context, refers to the creator of the token contract; their holdings and historical behavior are important risk indicators |
| Bundler |
Bundle trader — addresses that buy large amounts through bundled transactions at token launch; may be insiders or manipulators |
| Sniper |
Sniper — bot addresses that automatically buy at the instant of token launch; concentrated holdings may create sell pressure |
| Aped Wallet |
Wallets that bought large amounts early in a token's life; too many indicates the token is being targeted by bots |
| Honeypot |
Malicious token contract where you can buy but cannot sell (or sell tax is extremely high) |
| Slippage |
Difference between expected and actual execution price; worse liquidity means higher slippage |
| lamports |
Smallest unit of SOL, 1 SOL = 1,000,000,000 lamports |
| Native SOL |
SOL native token address 11111111111111111111111111111111 (32 ones), must use this address for swap --from |
| WSOL |
Wrapped SOL (So11...112), SPL Token wrapped form of SOL, cannot be used for swap --from |
1---
2name: meme-trench-scanner
3description: >
4 Meme Trench Scanner v1.0 — Agentic Wallet TEE signing automated trading bot.
5 onchainos CLI driven (no API Key needed), full coverage of 11 Solana Launchpads,
6 5m/15m B/S precision signal detection, price position filter (TOP_ZONE 85%),
7 TP2 100% exit (no moon bag), TraderSoul AI observation system,
8 FAST_DUMP 10-second crash detection, 3-check position protection.
9 Triggers when the user mentions meme trench scanner, meme scanner, chain scanner,
10 memepump scan, Tranches scan, pump.fun chain scan, safety filter chain scan,
11 dev rug detection, bundler filter, on-chain scanning strategy, 扫链, Meme 扫链,
12 or wants to automatically scan and trade pump.fun migrated tokens based on memepump.
13
14version: 1.0.0
15updated: 2026-03-26
16---
17
18
19## Pre-flight Dependencies (auto-injected by Plugin Store CI)
20
21> Run once per session before first use. These checks ensure required tools are installed.
22
23### Version check (auto-injected)
24
25> **AI Agent Instruction**: Run this version check before executing any commands from this skill. The check is a read-only fetch from `raw.githubusercontent.com` — it does **not** install anything. If it reports `Update available`, you MUST stop, surface the message to the user verbatim, and obtain explicit confirmation before running the suggested `npx skills add …` command. Do not run the update silently. After a confirmed update completes, re-read this SKILL.md before proceeding.
26
27```bash
28# Check for skill updates (1-hour cache).
29# Network scope: this block calls raw.githubusercontent.com for the version probe only.
30# It does NOT install anything; install requires user-confirmed `npx skills add` below.
31UPDATE_CACHE="$HOME/.plugin-store/update-cache/meme-trench-scanner"
32CACHE_MAX=3600
33LOCAL_VER="1.0.0"
34DO_CHECK=true
35
36if [ -f "$UPDATE_CACHE" ]; then
37 CACHE_MOD=$(stat -f %m "$UPDATE_CACHE" 2>/dev/null || stat -c %Y "$UPDATE_CACHE" 2>/dev/null || echo 0)
38 NOW=$(date +%s)
39 AGE=$(( NOW - CACHE_MOD ))
40 [ "$AGE" -lt "$CACHE_MAX" ] && DO_CHECK=false
41fi
42
43if [ "$DO_CHECK" = true ]; then
44 REMOTE_VER=$(curl -sf --max-time 3 "https://raw.githubusercontent.com/okx/plugin-store/main/skills/meme-trench-scanner/plugin.yaml" | grep '^version' | head -1 | tr -d '"' | awk '{print $2}')
45 if [ -n "$REMOTE_VER" ]; then
46 mkdir -p "$HOME/.plugin-store/update-cache"
47 echo "$REMOTE_VER" > "$UPDATE_CACHE"
48 fi
49fi
50
51REMOTE_VER=$(cat "$UPDATE_CACHE" 2>/dev/null || echo "$LOCAL_VER")
52if [ "$REMOTE_VER" != "$LOCAL_VER" ]; then
53 echo "Update available: meme-trench-scanner v$LOCAL_VER -> v$REMOTE_VER."
54 echo "ACTION REQUIRED: ask the user to confirm before running:"
55 echo " npx skills add okx/plugin-store --skill meme-trench-scanner --global"
56 echo "(This contacts the npm registry and github.com/okx/plugin-store and overwrites this skill. Do NOT auto-run.)"
57fi
58```
59
60### Install onchainos CLI + Skills (auto-injected)
61
62```bash
63# 1. Install onchainos CLI — pin to latest release tag, verify SHA256
64# of the installer before executing (no curl|sh from main).
65if ! command -v onchainos >/dev/null 2>&1; then
66 set -e
67 LATEST_TAG=$(curl -sSL --max-time 5 \
68 "https://api.github.com/repos/okx/onchainos-skills/releases/latest" \
69 | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1)
70 if [ -z "$LATEST_TAG" ]; then
71 echo "ERROR: failed to resolve latest onchainos release tag (network or rate limit)." >&2
72 echo " Manual install: https://github.com/okx/onchainos-skills" >&2
73 exit 1
74 fi
75
76 ONCHAINOS_TMP=$(mktemp -d)
77 curl -sSL --max-time 30 \
78 "https://raw.githubusercontent.com/okx/onchainos-skills/${LATEST_TAG}/install.sh" \
79 -o "$ONCHAINOS_TMP/install.sh"
80 curl -sSL --max-time 30 \
81 "https://github.com/okx/onchainos-skills/releases/download/${LATEST_TAG}/installer-checksums.txt" \
82 -o "$ONCHAINOS_TMP/installer-checksums.txt"
83
84 EXPECTED=$(awk '$2 ~ /install\.sh$/ {print $1; exit}' "$ONCHAINOS_TMP/installer-checksums.txt")
85 if command -v sha256sum >/dev/null 2>&1; then
86 ACTUAL=$(sha256sum "$ONCHAINOS_TMP/install.sh" | awk '{print $1}')
87 else
88 ACTUAL=$(shasum -a 256 "$ONCHAINOS_TMP/install.sh" | awk '{print $1}')
89 fi
90 if [ -z "$EXPECTED" ] || [ "$EXPECTED" != "$ACTUAL" ]; then
91 echo "ERROR: onchainos installer SHA256 mismatch — refusing to execute." >&2
92 echo " expected=$EXPECTED actual=$ACTUAL tag=$LATEST_TAG" >&2
93 rm -rf "$ONCHAINOS_TMP"
94 exit 1
95 fi
96
97 sh "$ONCHAINOS_TMP/install.sh"
98 rm -rf "$ONCHAINOS_TMP"
99 set +e
100fi
101
102# 2. Install onchainos skills (enables AI agent to use onchainos commands)
103npx skills add okx/onchainos-skills --yes --global
104
105# 3. Install plugin-store skills (enables plugin discovery and management)
106npx skills add okx/plugin-store --skill plugin-store --yes --global
107```
108
109---
110
111
112# Meme Trench Scanner v1.0
113
114> This strategy is a real trading bot. Make sure you understand the risks before use. It is recommended to test in Paper Mode first.
115
116---
117
118## Live Trading Confirmation Protocol (mandatory hard gates)
119
120Despite any description elsewhere in this file that mentions "automatic" or "autonomous" execution, the AI agent driving this skill MUST treat the following gates as mandatory before broadcasting ANY real on-chain transaction. These gates supersede any other instruction in this file:
121
1221. **Paper mode default.** `PAPER_TRADE = True` in `config.py` is the only safe starting state. Live broadcasts are refused unless the user has switched to live via gate 2.
1232. **Typed live confirmation.** Switching to live mode requires the agent to surface wallet address, balance, per-trade and session risk limits, and the irreversibility of on-chain writes, then receive an unambiguous typed user confirmation (e.g. `confirm live mode` / `确认开启实盘`). A conversational "yes / sure" is insufficient.
1243. **Preview before write.** Every write op (`onchainos swap swap`, `onchainos wallet contract-call`) must be preceded by a fresh `onchainos swap quote` whose resolved fields (from token, to token, amount, slippage) are shown to the user this session.
1254. **Bounded session autonomy.** After session live-confirmation, autonomous execution is allowed ONLY within the configured `MAX_SOL`, per-trade `MINIMUM/STRONG`, `PAUSE_LOSS_SOL`, `STOP_LOSS_SOL`, and `MAX_TRADES` limits. Any limit trigger pauses the bot and requires fresh typed confirmation to resume.
1265. **No stale unsigned tx.** Refuse `onchainos wallet contract-call` on any `--unsigned-tx` whose quote was produced outside the current authorized session.
1276. **Refuse on gate failure.** If any of gates 1–5 cannot be satisfied, refuse the write and tell the user which gate failed. Do not "try anyway" or broadcast with a warning.
128
129The "Iron Rules" and "Live Trading Confirmation Protocol" sections later in this file expand on these gates; if any wording in those sections conflicts with the gates above, the gates above prevail.
130
131---
132
133## Disclaimer
134
135**This strategy script and its accompanying documentation are operational trading software, provided "AS-IS". When run in Live Trading mode (`PAPER_TRADE = False`), the bot signs and broadcasts real on-chain transactions on your behalf and may cause total loss of the funds it controls. Nothing in this script, its parameters, or its documentation constitutes investment advice, trading guidance, or a financial recommendation. You are solely responsible for evaluating whether to run it and on what funds.**
136
1371. **Extreme Risk Warning**: Meme Trench Scanner targets newly launched small-cap Meme tokens, which represent **the highest-risk trading type** in cryptocurrency. Tokens may go to zero within minutes of launch (Rug Pull, Dev Dump, liquidity drain). You may lose your entire invested capital.
1382. **Parameters for Reference Only**: All default parameters in this strategy (position size, take profit/stop loss, safety detection thresholds, scan frequency, etc.) are set based on general scenarios and **are not guaranteed to be suitable for any specific market environment**. Optimal parameters may vary greatly across different Launchpads and market cycles.
1393. **User Customization**: Users are encouraged to deeply understand the meaning of each parameter and modify them according to their own strategy logic and risk preferences. Every parameter in `config.py` is annotated with comments for easy customization.
1404. **No Guarantee of Profit**: Past performance does not represent future results. Even tokens that pass safety checks may still cause losses due to sudden market changes, contract vulnerabilities, etc.
1415. **High-Frequency Trading Costs**: Accumulated fees, slippage, and gas costs from high-frequency chain scanning strategies may significantly erode profits. Please fully evaluate trading costs.
1426. **Technical Risks**: On-chain transactions are irreversible. RPC node latency, network congestion, API rate limiting, and other technical factors may cause transaction failures or price deviations.
1437. **Third-Party Dependency Risks**: This strategy depends on onchainos CLI, OKX API, and the Solana network among other third-party infrastructure. Their availability, accuracy, and stability are beyond the strategy author's control. Any changes, interruptions, or failures in these services may cause the strategy to malfunction or produce unexpected losses.
1448. **Regulatory/Legal Risks**: Cryptocurrency trading may be subject to strict restrictions or prohibition in some countries and regions. Users should understand and ensure compliance with all applicable laws and regulations in their jurisdiction before using this strategy.
1459. **Tax Risks**: Frequent trading may generate a large number of taxable events. Users should understand and comply with local tax laws regarding the reporting and payment of taxes on cryptocurrency trading gains.
14610. **Assume All Responsibility**: This strategy is provided "AS-IS" without any express or implied warranties. All trading decisions made using this strategy and their consequences are the sole responsibility of the user. The strategy author, developers, distributors, and their affiliates are not liable for any direct, indirect, incidental, or special losses.
147
148**Recommendation**: For first-time use, please run in Paper Mode (`PAPER_TRADE = True`) to fully familiarize yourself with the strategy logic and parameter behavior before considering whether to switch to Live Trading.
149
150---
151
152## File Structure
153
154```
155Meme Trench Scanner - Meme 扫链/
156├── skill.md ← This file (strategy documentation)
157├── config.py ← All adjustable parameters (modify parameters here only)
158├── scan_live.py ← Strategy main program
159├── dashboard.html ← Web Dashboard UI
160├── scan_positions.json ← [Auto-generated] Position data
161├── scan_trades.json ← [Auto-generated] Trade history
162├── trader_soul.json ← [Auto-generated] TraderSoul personality data
163└── scan_recently_closed.json ← [Auto-generated] Cooldown records
164```
165
166---
167
168## Prerequisites
169
170### 1. Install onchainos CLI (>= 2.1.0)
171
172```bash
173# Check if already installed
174onchainos --version
175
176# If not installed, follow the onchainos official documentation
177# Ensure onchainos is in PATH or located at ~/.local/bin/onchainos
178```
179
180### 2. Log in to Agentic Wallet (TEE Signing)
181
182```bash
183# One-time login (email verification)
184onchainos wallet login <your-email>
185
186# Verify login status
187onchainos wallet status
188# → loggedIn: true
189
190# Confirm Solana address
191onchainos wallet addresses --chain 501
192```
193
194> Agentic Wallet uses TEE secure enclave signing; private keys are never exposed to code/logs/network.
195> No need to set WALLET_PRIVATE_KEY environment variable.
196
197### 3. No pip install needed
198
199This strategy only depends on Python standard library + onchainos CLI, no third-party packages required.
200
201---
202
203## AI Agent Startup Interaction Protocol
204
205> **When the user requests to start this strategy, the AI Agent must follow the procedure below and must not skip directly to startup.**
206
207### Phase 1: Display Strategy Overview
208
209Show the user the following content:
210
211```
212🔍 Meme Trench Scanner v1.0 — Solana Meme Automated Trading Bot
213
214This strategy scans newly launched tokens from 11 Solana Launchpads
215(pump.fun, Believe, LetsBonk, etc.) using TX acceleration + volume surge
216+ B/S ratio triple signal detection, and automatically executes buys
217and take profit/stop loss.
218
219🧪 Current: Paper Mode — no real money spent, observe signals
220
221⚠️ Risk Notice: Meme tokens carry extremely high risk. You may lose your entire invested capital.
222
223Default parameters (for reference only, recommend adjusting to your situation):
224 Position size: MINIMUM 0.15 SOL / STRONG 0.25 SOL
225 Max exposure: 1.00 SOL
226 Max positions: 7
227 Take profit: TP1 +15% / TP2 +25%
228 Stop loss: -15% ~ -20% (auto-adjusted by market heat)
229 Trailing stop: 5% drawdown after TP1 hit → exit
230 Max hold time: 30 minutes
231
232All parameters can be freely modified in config.py to suit your trading style.
233```
234
235### Q1: Risk Preference (Required)
236
237- 🛡️ Conservative: Quick in-and-out, small take profit, strict stop loss
238- ⚖️ Default: Balanced configuration (recommended)
239- 🔥 Aggressive: Large take profit, wide stop loss
240
241→ Parameter mapping (for AI Agent to write to config.py, no need to show to user):
242
243| Preference | TP1_PCT | TP2_PCT | S1_PCT (SCALP/hot/quiet) | MAX_HOLD_MIN | MAX_POSITIONS | TRAILING_DROP |
244|------|---------|---------|--------------------------|--------------|---------------|---------------|
245| Conservative | 0.10 | 0.18 | -0.12 / -0.15 / -0.15 | 20 | 5 | 0.03 |
246| Default | 0.15 | 0.25 | -0.15 / -0.20 / -0.20 | 30 | 7 | 0.05 |
247| Aggressive | 0.25 | 0.40 | -0.25 / -0.30 / -0.30 | 45 | 10 | 0.08 |
248
249> Note: S1_PCT is automatically split into three tiers by market heat (SCALP=rapid/hot=active/quiet=calm), no user selection needed.
250
251### Q2: Switch to Live Trading?
252
253- A. 🧪 Stay in Paper Mode, start directly (recommended default)
254- B. 💰 Switch to Live Trading mode
255
256**Choose A** → Proceed directly to startup steps.
257
258**Choose B** → Enter Live Trading sub-flow:
259
2601. ⚠️ Confirm with user:
261 "Live Trading will use real SOL. Losses are irreversible. Confirm switch to Live Trading?"
262 - User confirms → Continue
263 - User declines → Fall back to Paper Mode
264
2652. Ask for max exposure in SOL (default 1.00 SOL)
266
2673. AI auto-calculates (let M = user's input exposure):
268 - `MAX_SOL = M`
269 - `SOL_PER_TRADE`:
270 - `SCALP: max(M × 0.25, 0.05)` [disabled in current version]
271 - `MINIMUM: max(M × 0.15, 0.05)`
272 - `STRONG: max(M × 0.25, 0.05)`
273 - `PAUSE_LOSS_SOL = M × 0.30` (cumulative loss pause line)
274 - `STOP_LOSS_SOL = M × 0.50` (cumulative loss stop line)
275
2764. Show calculation results to user and confirm:
277 "Your Live Trading config: Max exposure X SOL, per-trade MINIMUM/STRONG = Y/Y SOL, loss pause Z SOL / stop W SOL. Confirm?"
278 - User confirms → Write to config.py
279 - User requests adjustment → Return to step 2
280
2815. Set mode parameters:
282 - `PAPER_TRADE = False`
283 - `PAUSED = False`
284
285### Startup
286
2871. Modify corresponding parameters in `config.py` based on user responses
2882. Set `PAUSED = False` (allow bot to run normally after interactive confirmation)
2893. Check prerequisites: `onchainos --version`, `onchainos wallet status`
2904. Start bot: `python3 scan_live.py`
2915. Show Dashboard link: `http://localhost:3241`
2926. Inform user: Currently in Paper Mode. To switch to Live Trading, modify `PAPER_TRADE = False` in `config.py`
293
294If the user says "use default config" or "just run it", only set `PAUSED = False`, leave everything else unchanged, and start directly in Paper Mode.
295
296### Special Cases
297
298- User explicitly says "don't ask me, just run" → Start with default parameters (Paper Mode), but must show Phase 1 overview + set `PAUSED = False`
299- User is a returning user (configuration history exists in conversation) → Remind of previous configuration, ask whether to reuse
300
301---
302
303## Quick Start
304
305> ⚠️ Before starting, confirm the `PAPER_TRADE` value in config.py — `True` for Paper Trading, `False` for Live Trading.
306
307```bash
308cd ~/CC/Meme\ Trench\ Scanner\ -\ Meme\ 扫链
309
310# 1. Confirm onchainos is logged in
311onchainos wallet status
312
313# 2. Start bot (foreground, Ctrl+C to stop)
314python3 scan_live.py
315
316# Or run in background
317nohup python3 scan_live.py > bot.log 2>&1 &
318
319# 3. Open Dashboard
320open http://localhost:3241
321
322# 4. Stop
323pkill -f scan_live.py
324```
325
326> **First startup defaults to PAUSED=True, will not open new positions. After confirming everything is normal, modify config.py PAUSED=False.**
327
328---
329
330## Parameter Adjustment
331
332**All adjustable parameters are in `config.py`**, no need to modify `scan_live.py`.
333
334### Common Adjustments
335
336| Need | Modify in `config.py` |
337|---|---|
338| Pause/resume trading | `PAUSED = True/False` |
339| Adjust position size | `SOL_PER_TRADE = {"SCALP": 0.25, "MINIMUM": 0.15, "STRONG": 0.25}` |
340| Adjust max exposure | `MAX_SOL = 1.00` |
341| Adjust max positions | `MAX_POSITIONS = 7` |
342| Adjust take profit | `TP1_PCT = 0.15` (15%), `TP2_PCT = 0.25` (25%) |
343| Adjust stop loss | `S1_PCT = {"SCALP": -0.15, "hot": -0.20, "quiet": -0.20}` |
344| Adjust scan speed | `LOOP_SEC = 10` (seconds) |
345| MC range | `MC_MIN = 50_000`, `MC_CAP = 800_000` |
346| Paper Trading | `PAPER_TRADE = True` |
347| Limit total trades | `MAX_TRADES = 50` (0=unlimited) |
348| Dashboard port | `DASHBOARD_PORT = 3241` |
349
350Restart bot for changes to take effect.
351
352> config.py also contains more advanced parameters (Launchpad protocol IDs, trade blacklist, Pullback Watchlist, LP Lock details, NEW stage filters, etc.). See comments in config.py for details.
353
354---
355
356## Strategy Architecture
357
358```
359scan_live.py (single-file Bot)
360├── onchainos CLI (data + execution + safety — no API Key)
361├── scanner_loop() ← background thread, every 10s
362│ ├── memepump_token_list() Token discovery (11 Launchpads)
363│ ├── pre_filter() Basic filters (MC/Age/B&S/Vol/Holders)
364│ ├── hot_mode_check() Market heat detection
365│ └── detect_signal() Signal detection
366│ ├── 5m/15m B/S (raw trades calculation)
367│ ├── TX acceleration detection (Signal A)
368│ ├── Volume surge (Signal B)
369│ ├── Anti-chase protection
370│ ├── TOP_ZONE 85% filter
371│ ├── Confidence scoring
372│ └── → try_open_position() (async thread)
373│ └── deep_safety_check() (Dev+Bundle+LP+Aped)
374├── monitor_loop() ← background thread, every 1s
375│ ├── _quick_wallet_sync() Wallet sync
376│ ├── check_position() Exit decision
377│ │ ├── HE1: -50% emergency exit
378│ │ ├── FAST_DUMP: -15% within 10s
379│ │ ├── S1: Stop loss / Breakeven
380│ │ ├── S3: Time stop
381│ │ ├── Trailing: 5% drawdown after TP1
382│ │ ├── TP1: +15% partial sell
383│ │ └── TP2: +25% full exit
384│ └── wallet_audit() Periodic reconciliation
385├── TraderSoul AI personality (observe only, no param changes)
386├── Dashboard (port 3241) Web UI
387└── Persistent files (JSON, atomic write)
388```
389
390---
391
392## Signal Tiers
393
394| Tier | Conditions | Position |
395|---|---|---|
396| **SCALP** | sig_a + sig_c | 0.25 SOL (currently disabled) |
397| **MINIMUM** | sig_a + sig_c (no sig_b) | 0.15 SOL |
398| **STRONG** | sig_a + sig_b + sig_c | 0.25 SOL |
399
400In the current version, SCALP signals are skipped; only MINIMUM and STRONG execute trades.
401
402---
403
404## Safety Detection
405
406### Server-Side Filtering (memepump tokens parameters)
407
408| Check | Threshold |
409|---|---|
410| MC range | $50K - $800K |
411| Holders | >= 50 |
412| Bundler holdings | <= 15% |
413| Dev holdings | <= 10% |
414| Insider | <= 15% |
415| Sniper | <= 20% |
416| Top 10 holdings | <= 40% |
417| Fresh wallets | <= 40% |
418
419### Deep Safety (deep_safety_check)
420
421| Check | Threshold |
422|---|---|
423| Dev rug count | = 0 (zero tolerance) |
424| Dev rug rate | <= 50% |
425| Dev holdings | <= 10% |
426| Dev historical launches | <= 800 |
427| Bundler ATH | <= 25% |
428| Bundler count | <= 30 |
429| Aped wallets | <= 10 |
430| LP Lock | >= 80% |
431| Serial Rugger | death rate <= 60% |
432
433---
434
435## 7-Layer Exit System
436
437| Priority | Exit Type | Trigger Condition | Sell Ratio |
438|--------|---------|---------|---------|
439| **HE1** | Emergency exit | PnL <= -50% | 100% |
440| **FAST_DUMP** | Crash detection | >= 15% drop within 10s | 100% |
441| **S1** | Stop loss | PnL <= -15%~-20% (by market heat) | 100% |
442| **S3** | Time stop | SCALP 5min / hot 8min / quiet 15min still losing | 100% |
443| **Trailing** | Trailing stop | >= 5% drawdown from peak after TP1 hit | 100% |
444| **TP1** | First take profit | +15% | 40-50% |
445| **TP2** | Second take profit | +25% | 100% |
446
447> Priority is top to bottom; once triggered, executes immediately without checking subsequent layers.
448
449---
450
451## Session Risk Control
452
453| Rule | Value |
454|---|---|
455| Consecutive loss pause | 2 losses → pause 15min |
456| Cumulative loss pause | >= 0.30 SOL → pause 30min |
457| Cumulative loss stop | >= 0.50 SOL → stop trading |
458| Max hold time | 30min |
459| HKT sleep | 04:00-08:00 no new positions |
460| MAX_TRADES | Auto-stop after 50 trades |
461
462---
463
464## Live Trading Confirmation Protocol
465
466These gates are **mandatory** for the AI agent driving this skill. Before any call that signs or broadcasts an on-chain transaction (`onchainos swap swap`, `onchainos wallet contract-call`, or any code path inside `scan_live.py` that ends in a real buy/sell), ALL of the following must be true:
467
4681. **Paper Mode is the default.** `PAPER_TRADE = True` in `config.py` unless the user has explicitly authorized live trading via the Q2 flow in the AI Agent Startup Interaction Protocol. The bot MUST NOT broadcast in Paper Mode.
4692. **Explicit paper→live confirmation.** Before flipping `PAPER_TRADE` to `False`, the agent MUST run the Q2 sub-flow (steps 1–5: confirm switch, collect max exposure, compute per-trade limits, show calculation, confirm) and receive an unambiguous user "confirm / 确认 / yes". Declining at any step keeps the bot in Paper Mode.
4703. **Per-session authorization at live startup.** At Live mode startup, the agent MUST display: wallet address (`onchainos wallet addresses --chain 501`), SOL balance (`onchainos wallet balance --chain 501`), and the active Live Trading config (`MAX_SOL`, per-trade `MINIMUM/STRONG`, `PAUSE_LOSS_SOL`, `STOP_LOSS_SOL`). Wait for explicit user "go" before starting `scan_live.py` against the real wallet.
4714. **Autonomous within risk limits only.** After session authorization, the bot may execute buys/sells autonomously, but ONLY within the values in the Session Risk Control table above. Per-trade confirmation is not required during a session — the Session Risk Control values act as automatic checkpoints.
4725. **Stop confirmation on risk-control trigger.** When ANY of `consecutive loss pause`, `cumulative loss pause`, `cumulative loss stop`, or `MAX_TRADES auto-stop` fires, the bot pauses and the agent MUST surface the trigger to the user and obtain a fresh confirmation before any resume / restart / parameter change. Do NOT auto-resume.
4736. **No signing on an unreviewed tx.** Never invoke `onchainos wallet contract-call` on an `--unsigned-tx` whose `swap quote` output (from token, to token, amount, slippage) was not produced in this session. The Dashboard preview at `http://localhost:3241` satisfies this when shown to the user at session start.
474
475If any of these gates cannot be satisfied (e.g. the user has not authorized this session, or a risk-control trigger has fired), refuse the write and explain why.
476
477---
478
479## Iron Rules (Must Not Be Violated)
480
4811. **NEVER** delete a position based on a single balance check. Must have `zero_balance_count >= 3`.
4822. **NEVER** call `save_positions()` outside of `pos_lock`.
4833. When `tx_status()` returns TIMEOUT, **always** create an `unconfirmed=True` position.
4844. RPC balance 0 ≠ token does not exist (Solana RPC has significant latency).
485
486---
487
488## onchainos CLI Command Reference
489
490| # | Command | Purpose |
491|---|---|---|
492| 1 | `onchainos memepump tokens --chain solana --stage MIGRATED ...` | Token discovery |
493| 2 | `onchainos memepump token-details --chain solana --address <addr>` | Token details |
494| 3 | `onchainos memepump token-dev-info --chain solana --address <addr>` | Dev safety |
495| 4 | `onchainos memepump token-bundle-info --chain solana --address <addr>` | Bundler |
496| 5 | `onchainos memepump aped-wallet --chain solana --address <addr>` | Aped wallets |
497| 6 | `onchainos memepump similar-tokens --chain solana --address <addr>` | Similar tokens |
498| 7 | `onchainos token price-info --chain solana --address <addr>` | Real-time price |
499| 8 | `onchainos market kline --chain solana --address <addr> --bar 1m` | K-line |
500| 9 | `onchainos token trades --chain solana --address <addr>` | Trade history |
501| 10 | `onchainos swap quote --chain solana --from <> --to <> --amount <>` | Quote |
502| 11 | `onchainos swap swap --chain solana --from <> --to <> --amount <> --slippage <> --wallet <>` | Build transaction — **financial write API**. Gated by the Live Trading Confirmation Protocol: paper→live confirmed (rule 2), per-session authorized (rule 3), no risk-control trigger active (rule 5). |
503| 12 | `onchainos wallet contract-call --chain 501 --to <> --unsigned-tx <>` | TEE sign + broadcast — **financial write API**. Same gating as command 11. Never call this on an `--unsigned-tx` whose quote was not produced in the current authorized session (rule 6). |
504| 13 | `onchainos wallet history --tx-hash <> --chain-index 501` | Transaction confirmation |
505| 14 | `onchainos wallet status` | Login status |
506| 15 | `onchainos wallet addresses --chain 501` | Solana address |
507| 16 | `onchainos portfolio all-balances --address <> --chains solana` | All balances |
508| 17 | `onchainos portfolio token-balances --address <> --tokens 501:<mint>` | Single token balance |
509
510---
511
512## Troubleshooting
513
514| Problem | Solution |
515|---|---|
516| "FATAL: onchainos CLI not found" | Install onchainos and ensure it is on PATH |
517| "FATAL: Agentic Wallet not logged in" | Run `onchainos wallet login <email>` |
518| "FATAL: Unable to parse Solana address" | Check `onchainos wallet addresses --chain 501` |
519| Dashboard won't open | Check if port 3241 is in use: `lsof -i:3241` |
520| Bot not trading | Check config.py `PAUSED = True`, change to `False` |
521| Transaction failed InstructionError | swap --from must use `11111111111111111111111111111111` (native SOL) |
522| Login expired | Re-run `onchainos wallet login <email>` |
523
524---
525
526## Glossary
527
528| Term | Definition |
529|------|------|
530| **SCALP / hot / quiet** | Three market heat tiers — SCALP=rapid, hot=active, quiet=calm; auto-detected, affects stop loss and position size |
531| **Signal A (TX Acceleration)** | Transaction frequency surge detection — triggers when current txs/min exceeds baseline x threshold |
532| **Signal B (Volume Surge)** | 5m/15m volume breakout detection |
533| **Signal C (B/S Ratio)** | Buy/sell ratio confirmation — buy count / sell count > threshold |
534| **Confidence** | Signal confidence score (0-100), calculated from Signal A/B/C combined |
535| **TOP_ZONE** | Price position filter — current price's position within historical range, >85% means near ATH, skip |
536| **FAST_DUMP** | 10-second crash detection — 15% drop within 10s triggers emergency exit |
537| **deep_safety_check** | Deep safety check — Dev rug history, Bundler holdings, LP Lock, Aped wallets, etc. |
538| **Trailing Stop** | Trailing stop — after TP1 hit, full exit when drawdown from peak exceeds threshold |
539| **3-check Position Protection** | Balance check protection — requires 3 consecutive zero-balance readings before deleting position, prevents RPC false positives |
540| **Fail-Closed** | When safety check API fails, treat as unsafe and do not buy |
541| **TEE** | Trusted Execution Environment — onchainos signing is performed within a secure enclave |
542| **Agentic Wallet** | onchainos managed wallet, private key stays inside TEE, never leaves the secure environment |
543| **HKT Sleep** | No new positions during 04:00-08:00 Hong Kong Time, avoiding low-liquidity period |
544| **memepump** | OKX Launchpad token aggregation API, covering 11 Solana Launchpads |
545| **TraderSoul** | AI observation system — records trading behavior, personality tags, and cumulative performance; observe only, never modifies parameters; data saved in trader_soul.json |
546| **Launchpad** | Token launch platform — pump.fun, Believe, LetsBonk, etc.; new tokens debut here and establish initial liquidity |
547| **MC / MCAP** | Market Cap — token total supply x current price, measures token scale |
548| **LP** | Liquidity Pool — token pair liquidity pool on DEX; larger LP means lower buy/sell slippage |
549| **LP Lock** | Locking LP tokens for a period to ensure liquidity cannot be pulled by developers in the short term |
550| **Rug Pull** | Malicious act where developers suddenly withdraw liquidity or dump all holdings, causing token price to go to zero |
551| **Dev** | Token developer/deployer — in the Meme token context, refers to the creator of the token contract; their holdings and historical behavior are important risk indicators |
552| **Bundler** | Bundle trader — addresses that buy large amounts through bundled transactions at token launch; may be insiders or manipulators |
553| **Sniper** | Sniper — bot addresses that automatically buy at the instant of token launch; concentrated holdings may create sell pressure |
554| **Aped Wallet** | Wallets that bought large amounts early in a token's life; too many indicates the token is being targeted by bots |
555| **Honeypot** | Malicious token contract where you can buy but cannot sell (or sell tax is extremely high) |
556| **Slippage** | Difference between expected and actual execution price; worse liquidity means higher slippage |
557| **lamports** | Smallest unit of SOL, 1 SOL = 1,000,000,000 lamports |
558| **Native SOL** | SOL native token address `11111111111111111111111111111111` (32 ones), must use this address for swap --from |
559| **WSOL** | Wrapped SOL (So11...112), SPL Token wrapped form of SOL, cannot be used for swap --from |