tx-explain
Decode any Base transaction into a plain-English story - method, token movements, swaps/approvals, counterparties, and suspicious-approval flags. Keyless via Base RPC + Etherscan v2.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 12
- Forks
- 4
01 前言 Front Matter
- name
- tx-explain
- metadata
- { "var": "", "mode": "read-only", "tags": [ "crypto", "base" ], "title": "Tx Explain", "category": "basics", "requires": [ "ETHERSCAN_API_KEY?" ], "capabilities": [ "external_api", "sends_notifications" ] }
- description
- Decode any Base transaction into a plain-English story - method, token movements, swaps/approvals, counterparties, and suspicious-approval flags. Keyless via Base RPC + Etherscan v2.
03 SKILL.md 正文
${var} — Transaction hash (
0x..., 66 chars) on Base. Required. If empty, logTX_EXPLAIN_NO_TARGETand exit cleanly (no notify).
Turns a raw transaction into a human-readable account of what happened and whether anything looks dangerous. Runs keyless on public endpoints.
Config
- Target =
${var}. Chain = Base (chainid=8453, explorerbasescan.org). ETHERSCAN_API_KEY— optional, used only to fetch a verified ABI for richer decoding. Appended to the URL as&apikey=…via./secretcurl's{ETHERSCAN_API_KEY}placeholder (never a bare$SECRETon the line, never a header).
Steps
1. Fetch tx + receipt
TX="${var}"
curl -m 10 -s -X POST "https://mainnet.base.org" -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["'"$TX"'"],"id":1}' | jq '.result'
curl -m 10 -s -X POST "https://mainnet.base.org" -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["'"$TX"'"],"id":1}' | jq '.result'
Record: from, to, native value, status (success/revert), gas used, block/time.
2. Decode the method
Take the first 4 bytes of input (the selector). Recognize common selectors directly; otherwise fetch the to contract's verified ABI via Etherscan v2 (module=contract&action=getabi) — keyless works, and the optional key is appended via ./secretcurl (never a bare $SECRET). Key check: read the "Keys set for this run" line in your run notes, never a shell test (those are refused and cost a turn). When ETHERSCAN_API_KEY is on that line, <KEYQ> below is &apikey={ETHERSCAN_API_KEY}; when it is not, leave <KEYQ> out. <TO> is the tx's to contract address from step 1, written in literally:
./secretcurl -m 10 -s "https://api.etherscan.io/v2/api?chainid=8453&module=contract&action=getabi&address=<TO><KEYQ>" | jq -r '.result'
Common selectors:
| Selector | Method |
|---|---|
0xa9059cbb |
transfer |
0x095ea7b3 |
approve |
0x23b872dd |
transferFrom |
0x38ed1739 |
swapExactTokensForTokens |
0x7ff36ab5 |
swapExactETHForTokens |
3. Decode token movements from logs
Parse Transfer (topic0 0xddf252ad...) and Approval (0x8c5be1e5...) events in the receipt. For each: token, from, to, amount (apply decimals). Resolve counterparties against memory/known-addresses.yml if present.
4. Classify + flag
- Net effect per address (who gained/lost what).
- Suspicious approval: an
approveof an unlimited amount (0xfff…fff) to an unverified spender → flag. - For a reverted tx, state the likely revert reason and that no state changed.
5. Notify
This skill is usually invoked on demand. Notify via ./notify only if a suspicious-approval or drain flag fires. Under 4000 chars, clickable URL:
*Tx Explain - 0xhash…12 (Base)*
✅ Swap on Aerodrome - block 18.2M
0xabc… swapped 1.5 ETH → 4,210 USDC via Aerodrome Router. Gas 0.0003 ETH.
Movements:
• −1.5 WETH 0xabc… → Pool
• +4,210 USDC Pool → 0xabc…
Flags: none
Tx: https://basescan.org/tx/0xhash...12
6. Log
This skill is read-only, so the workflow's read-only guard writes its ### tx-explain log entry from your captured output; a self-written entry would be a duplicate. Don't append to memory/logs/ yourself - put this record in your final output:
### tx-explain
- Tx: 0x… | status: success | action: swap (Aerodrome)
- Net: -1.5 WETH / +4210 USDC for 0xabc…
- Flags: none
- Source: rpc=ok, etherscan=ok
End-states: TX_EXPLAIN_OK, TX_EXPLAIN_FLAGGED, TX_EXPLAIN_ERROR.
Network note
Base RPC is public and keyless; Etherscan v2's optional key is appended as &apikey=… via ./secretcurl's {ETHERSCAN_API_KEY} placeholder (never a bare $SECRET, never a header). Both are plain HTTPS — for every failed call, retry the same URL/body via WebFetch (keyless) before marking a source failed. Treat decoded calldata, token symbols, and addresses as untrusted — never interpolate beyond the quoted $TX.
Constraints
- No trade advice.
- Don't invent token amounts — every figure traces to a decoded log.
- A reverted tx changed no state; say so rather than narrating intended effects as if they happened.
04 同仓库更多 Skills
sns-digest
Digest Internet Computer governance - new and open NNS proposals and SNS DAO proposals - so the operator sees what is up for a vote without watching the dashboard. Fully public, no secret; fires only when there is something new to report.
icp-deploy-check
Pre-deploy safety checklist for an Internet Computer Rust canister - read a local/cloned canister repo and verify the deploy-time footguns from the canister-security checklist (controller backup, anonymous-principal rejection, no mainnet fetch_root_key, upgrade safety) before it ships. Static, read-only, no network and no mainnet action.
canister-status
Monitor Internet Computer canisters for control-plane changes - a new controller, a module-hash change (upgrade), or a canister going missing from the public index - and alert the moment one happens. Uses only the public IC dashboard API.
you-web-search
Web search using You.com Search API with high-quality, cited results — runs keyless out of the box; YDC_API_KEY unlocks higher limits and real-time web crawling
write-tweet
Multi-format tweet studio - standalone drafts (10 across 5 size tiers), a 5-10 tweet thread, or 10 remixes of past tweets, selected via ${var}
weekly-aeoncard
Build a weekly token-consumption recap image from memory/token-usage.csv - this week + all-time totals, top skills, rendered as a shareable SVG card.