Learn-skills.dev aicoin-onchain
Use this skill for on-chain DEX operations: token search, swap quotes, DEX trading, wallet portfolio/balance queries, gas estimation, and transaction broadcasting across 20+ blockchains (Ethereum, Solana, Base, BSC, Arbitrum, Polygon, etc.). Use when user says: 'swap ETH for USDC', 'buy token on-chain', 'DEX swap', 'token search on-chain', 'wallet balance', 'portfolio value', 'gas price', 'broadcast transaction', 'trending on-chain tokens', 'hot tokens', 'token holders', 'token liquidity', 'smart money signal', 'whale signal', 'K-line on-chain', '链上交易', '链上swap', 'DEX交易', '买币', '链上行情', '钱包余额', '持仓', 'gas费', '广播交易', '链上热门币', '聪明钱', '巨鲸信号'. Powered by OKX Web3 DEX API with 500+ liquidity sources. MUST run node scripts — NEVER fabricate on-chain data. For CEX trading (Binance/OKX spot/futures), use aicoin-trading. For CEX market data (funding rates, OI, liquidation), use aicoin-market.
git clone https://github.com/NeverSight/learn-skills.dev
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/aicoincom/coinos-skills/aicoin-onchain" ~/.claude/skills/neversight-learn-skills-dev-aicoin-onchain && rm -rf "$T"
data/skills-md/aicoincom/coinos-skills/aicoin-onchain/SKILL.mdWorking directory:
to this SKILL.md directory before running scripts. Example:cdcd ~/.openclaw/workspace/skills/aicoin-onchain && node scripts/token.mjs ...
AiCoin Onchain
On-chain DEX toolkit powered by OKX Web3 DEX API. Token discovery, swap execution, wallet portfolio, gas estimation, and transaction broadcasting across 20+ blockchains.
Version: 1.0.0
Critical Rules
- NEVER fabricate data. Always run scripts. If data is empty or errors, say so — do NOT invent prices or balances.
- NEVER use curl, web_fetch, web_search for on-chain data. Always use these scripts.
- NEVER run
orenv
— leaks API secrets.printenv - Scripts auto-load
— never pass credentials inline..env - Reply in user's language. Chinese input = Chinese response.
- User confirmation required before swap execution. Always show quote details (amount, gas, price impact, honeypot status) and get explicit user approval before calling
.swap swap - This skill does NOT sign transactions. It returns unsigned tx data. User must sign locally with their own wallet/key.
Quick Reference
| Task | Command |
|---|---|
| Search token | |
| Token price | |
| K-line chart | |
| Trending tokens | |
| Hot tokens | |
| Swap quote | |
| Wallet balance | |
| All token holdings | |
| Gas price | |
| Auto swap | |
Skill Routing
- CEX trading (buy/sell on Binance, OKX) → use
aicoin-trading - CEX market data (funding rates, OI, liquidation maps) → use
aicoin-market - Freqtrade strategies → use
aicoin-freqtrade - Hyperliquid whales → use
aicoin-hyperliquid - On-chain DEX operations → use this skill (
)aicoin-onchain
Scripts
token.mjs — Token Discovery
| Action | Params | Description |
|---|---|---|
| , | Search tokens by name/symbol/address |
| , | Token metadata (name, symbol, decimals, logo) |
| , , | Trending token rankings |
| , | Price, market cap, liquidity, 24h change |
| , | Hot tokens by trending score |
| , | Token holder distribution |
| , | Top liquidity pools |
| , | Risk level, creator, dev stats |
market.mjs — Market Data
| Action | Params | Description |
|---|---|---|
| , | Current token price |
| , | Batch price query (comma-separated chain:address) |
| , , , | K-line / candlestick data |
| , | Aggregated index price |
| , , | Smart money / whale / KOL signals |
| (none) | Supported chains for signals |
swap.mjs — DEX Swap
| Action | Params | Description |
|---|---|---|
| , , , , | Get swap quote (read-only) |
| , , , , , | Get swap tx data (unsigned) |
| , , | Get ERC-20 approval tx data |
| (none) | Supported chains for DEX aggregator |
| | Available liquidity sources on a chain |
portfolio.mjs — Wallet Portfolio
| Action | Params | Description |
|---|---|---|
| , | Total portfolio value in USD |
| , | All token balances |
| , | Specific token balances |
| (none) | Supported chains for balance queries |
gateway.mjs — Transaction Gateway
| Action | Params | Description |
|---|---|---|
| | Current gas prices |
| , , , , | Estimate gas limit |
| , , , , | Simulate transaction (dry-run) |
| , , | Broadcast signed transaction |
| , , | Track broadcast order status |
| (none) | Supported chains for gateway |
trade.mjs — Full Auto Trade (optional, requires private key)
| Action | Params | Description |
|---|---|---|
| , , , , | Full auto: quote → approve → sign → broadcast |
| (none) | Show wallet address derived from private key |
Setup: User adds
WALLET_PRIVATE_KEY=0x... to .env. Private key stays local, never sent to any server.
Safety: Auto-blocks honeypot tokens and trades with >10% price impact.
EVM only — Solana auto-trade not yet supported.
Chain Names
The scripts accept human-readable chain names:
| Chain | Name | Also Accepts |
|---|---|---|
| Ethereum | | |
| Solana | | |
| Base | | |
| BSC | | |
| Arbitrum | | |
| Polygon | | |
| XLayer | | |
| Avalanche | | |
| Optimism | | |
Native Token Addresses
| Chain | Address |
|---|---|
| EVM (ETH, BSC, Polygon, etc.) | |
| Solana | |
WARNING: Solana native SOL address is
11111111111111111111111111111111 (system program). Do NOT use So11111111111111111111111111111111111111112 (wSOL).
Swap Workflow
EVM Swap (quote → approve → swap)
1. token.mjs search → find token contract address 2. swap.mjs quote → get price estimate, check honeypot/tax 3. swap.mjs approve → get ERC-20 approval tx data (skip for native tokens) 4. User signs approval → broadcast via gateway.mjs 5. swap.mjs swap → get swap tx data 6. User signs swap → broadcast via gateway.mjs 7. gateway.mjs orders → track transaction status
Solana Swap (simpler, no approve step)
1. token.mjs search → find token address 2. swap.mjs quote → get quote 3. swap.mjs swap → get tx data 4. User signs → broadcast via gateway.mjs
Security Rules
- Never execute swap without user confirmation. Show: token names, amounts, gas estimate, price impact, honeypot status.
- Skip approve for native tokens. Never call
forswap approve
(EVM) or0xeee...
(Solana).111...1 - Honeypot warning. If
, warn prominently and ask user to confirm.isHoneyPot = true - Price impact >5%: warn user. >10%: strongly warn, suggest reducing amount.
- Tax tokens: if
> 0, show to user before confirmation.taxRate
Amount Rules
- Script params use minimal units (wei/lamports):
=1 ETH
,"1000000000000000000"
=1 USDC"1000000" - Display to user in UI units:
,1.5 ETH3200 USDC - Gas fees in Gwei (EVM) or USD
API Key Setup
Requires OKX Web3 API credentials. Free at OKX Developer Portal.
Add to
.env:
OKX_API_KEY=your-api-key OKX_SECRET_KEY=your-secret-key OKX_PASSPHRASE=your-passphrase
Security notice: OKX Web3 API Key is for reading market data and generating unsigned swap calldata. It cannot access your wallet funds or sign transactions. All signing happens locally.