Navigate and query crypto networks using OpenScan's infrastructure. Data comes from @openscan/metadata (CDN) and @openscan/network-connectors (RPC).
skills/openscan-crypto/scripts/crypto-cli.mjs
Run with: node
crypto-cli.mjs networks
crypto-cli.mjs rpcs <chain> # All public RPCs
crypto-cli.mjs rpcs <chain> --private # Only tracking:none RPCs
crypto-cli.mjs token <symbol|address> # Search all mainnets
crypto-cli.mjs token <symbol|address> --chain <chain> # Specific chain
crypto-cli.mjs events [--chain <chain>] # List known events
crypto-cli.mjs decode-event <topic_hash> # Decode one topic
crypto-cli.mjs addresses [--chain <chain>]
crypto-cli.mjs profile networks ethereum
crypto-cli.mjs profile apps openscan
RPCs are persisted in ~/.config/openscan-crypto/rpc-config.json. On first use, the skill auto-fetches from @openscan/metadata and selects privacy-first RPCs. All subsequent commands use the persisted config.
crypto-cli.mjs rpc-fetch # Sync all networks from @openscan/metadata
crypto-cli.mjs rpc-fetch ethereum # Sync a specific network
Resolves the latest metadata version dynamically from npm. Auto-selects RPCs (privacy-first, open-source preferred).
crypto-cli.mjs rpc-list ethereum # Show active (configured) RPCs
crypto-cli.mjs rpc-list ethereum --all # Show ALL available RPCs from metadata
crypto-cli.mjs rpc-list ethereum --all --private # Only privacy (tracking:none)
crypto-cli.mjs rpc-set ethereum --strategy race # Set strategy: fallback|race|parallel
crypto-cli.mjs rpc-set ethereum --add https://my-rpc.com # Add custom RPC
crypto-cli.mjs rpc-set ethereum --remove https://rpc.com # Remove an RPC
crypto-cli.mjs rpc-set ethereum --rpcs url1 url2 url3 # Replace all RPCs
crypto-cli.mjs rpc-set ethereum --private-only # Keep only tracking:none
crypto-cli.mjs rpc-set ethereum --reset # Reset to metadata defaults
crypto-cli.mjs rpc-set --default-strategy parallel # Set global default strategy
crypto-cli.mjs rpc-set --max-rpcs 3 # Set global max RPCs per network
crypto-cli.mjs rpc-order ethereum --benchmark # Auto-sort by latency (fastest first)
crypto-cli.mjs rpc-order ethereum --swap 1 3 # Swap positions 1 and 3
crypto-cli.mjs rpc-order ethereum <url> --position 1 # Move URL to position 1
crypto-cli.mjs rpc-test ethereum # Test all configured RPCs
crypto-cli.mjs rpc-test ethereum --all # Test ALL available from metadata
crypto-cli.mjs rpc-test ethereum <url> # Test a specific URL
Tests latency, block number, client version. Detects out-of-sync nodes via block delta.
crypto-cli.mjs rpc-strategy # View defaults + per-network overrides
crypto-cli.mjs rpc-strategy parallel # Set global default to parallel
crypto-cli.mjs address-info <address> # Full address info
crypto-cli.mjs address-info vitalik.eth # ENS name supported
crypto-cli.mjs address-info <address> --chain base # On another chain
crypto-cli.mjs address-info <address> --private # Privacy RPCs only
Returns in a single call:
EOA or contract (with codeSize if contract)This command fires balance, code, and nonce in parallel, then enriches the result with ENS reverse resolution and metadata label lookup.
crypto-cli.mjs price # ETH price (default)
crypto-cli.mjs price BTC # BTC price (via WBTC pools on mainnet)
crypto-cli.mjs price --chain polygon # MATIC price
crypto-cli.mjs price --chain bnb # BNB price
crypto-cli.mjs price --chain arbitrum # ETH price (fetched from mainnet for L2s)
Fetches prices from Uniswap V2-style DEX pools. Uses median of multiple pools for manipulation resistance. Returns per-pool breakdown.
crypto-cli.mjs decode-tx <0xhash> # Decode function + events
crypto-cli.mjs decode-tx <0xhash> --chain arbitrum # On another chain
Decodes transaction input data into human-readable function name + parameters. Also decodes all event logs in the receipt. Uses local database of known selectors + 4byte.directory fallback. Identifies tx type: transfer, contract_call, or contract_creation.
Strategies:
fallback — Try RPCs in order, move to next on failure. Default. Most conservative.race — Fire all RPCs simultaneously, use fastest response. Best for latency.parallel — Fire all, compare results, detect inconsistencies. Trustless verification.All EVM commands accept --chain (default: ethereum) and --private (use tracking:none RPCs only).
crypto-cli.mjs balance <address> # Native balance (ETH)
crypto-cli.mjs balance vitalik.eth # ENS name supported
crypto-cli.mjs balance <address> --token USDC # + ERC20 balance
crypto-cli.mjs balance <address> --chain arbitrum # On Arbitrum
crypto-cli.mjs balance <address> --token USDC --chain base # USDC on Base
Returns native balance in human-readable format (e.g., "32.12 ETH") plus raw wei. Token balance includes symbol, decimals, and formatted amount.
crypto-cli.mjs multi-balance <address> # All mainnet chains
crypto-cli.mjs multi-balance vitalik.eth # ENS supported
crypto-cli.mjs multi-balance <address> --private # Privacy RPCs only
Queries the same address across ALL mainnet EVM chains in parallel. Shows balances sorted by chains with funds first.
crypto-cli.mjs block # Latest block
crypto-cli.mjs block latest # Same
crypto-cli.mjs block 19000000 # By number
crypto-cli.mjs block 0xabcdef... # By hash (66 chars)
Returns: number, hash, timestamp, gasUsed, gasLimit, baseFee, txCount, miner.
crypto-cli.mjs tx <0xhash>
crypto-cli.mjs tx <0xhash> --chain arbitrum
Returns: hash, blockNumber, from, to, value (in ETH), gasPrice, nonce, input data.
crypto-cli.mjs receipt <0xhash>
Returns: status (success/reverted), gasUsed, effectiveGasPrice, contract address (if deploy), logs with decoded event names from metadata.
crypto-cli.mjs gas # Ethereum gas
crypto-cli.mjs gas --chain base # Base gas
crypto-cli.mjs gas --chain arbitrum # Arbitrum gas
Returns: gasPrice, maxPriorityFeePerGas, baseFee — all in gwei.
crypto-cli.mjs call <to_address> <calldata_hex> [--block <tag>]
For raw contract reads. Use for custom ABI calls.
crypto-cli.mjs logs --address <contract> --topic <topic_hash> [--from <block>] [--to <block>]
Returns up to 50 logs. Default range: latest block only.
crypto-cli.mjs code <address>
Returns: isContract (bool), codeSize, truncated bytecode.
crypto-cli.mjs nonce <address>
Bitcoin queries use the mempool.space REST API (no JSON-RPC needed).
crypto-cli.mjs btc-info
Returns: block height, best hash, difficulty, mempool stats, recommended fees — all in one call.
crypto-cli.mjs btc-block # Latest block
crypto-cli.mjs btc-block 800000 # By height
crypto-cli.mjs btc-block 0000000... # By hash (64 chars)
crypto-cli.mjs btc-tx <txid>
Returns: confirmation status, fee (sats + BTC), fee rate (sat/vB), inputs/outputs with addresses and values.
crypto-cli.mjs btc-mempool
Returns: tx count, vsize, total fees, recommended fee rates, 5 most recent txs.
crypto-cli.mjs btc-fee
Returns: fastest, halfHour, hour, economy, minimum — all in sat/vB.
crypto-cli.mjs btc-address <address>
Returns: balance (BTC + sats), total received/sent, tx count, UTXO count.
| Alias | Chain ID | Network |
|---|---|---|
| ------- | ---------- | --------- |
| ethereum, eth, mainnet | 1 | Ethereum |
| optimism, op | 10 | Optimism |
| bnb, bsc | 56 | BNB Smart Chain |
| polygon, matic, pol | 137 | Polygon |
| base | 8453 | Base |
| arbitrum, arb | 42161 | Arbitrum One |
| sepolia | 11155111 | Sepolia Testnet |
| bitcoin, btc | bip122:... | Bitcoin Mainnet |
Numeric chain IDs also work (e.g., 1, 42161).
All commands output JSON to stdout. The agent can parse and format as needed.
Numeric values are pre-formatted:
EVM commands that return on-chain entities include an explorerLink field with a direct URL to openscan.eth.link:
| Command | explorerLink points to |
|---|---|
| --------- | ------------------------ |
balance | address page |
multi-balance | address page per chain |
block | block page |
tx | transaction page |
receipt | transaction page |
code | address page |
nonce | address page |
token | token contract address page |
logs | transaction page per log |
btc-block | Bitcoin block page |
btc-tx | Bitcoin transaction page |
btc-address | Bitcoin address page |
address-info | address page |
URL patterns:
https://openscan.eth.link/#/{chainId}/{type}/{id}https://openscan.eth.link/#/btc/{type}/{id}https://openscan.eth.link/#/tbtc/{type}/{id}Always show this link to the user so they can explore the data further in the UI.
Metadata cached in ~/.cache/openscan-crypto/ (6h TTL). RPC responses are NOT cached.
All EVM address commands accept .eth names (e.g., vitalik.eth). ENS is resolved on Ethereum mainnet automatically. Works with: balance, multi-balance, code, nonce.
--private flag restricts to tracking:none RPCs| User says | Command |
|---|---|
| ----------- | --------- |
| "What's Vitalik's ETH balance?" | balance 0xd8dA...96045 |
| "How much USDC does 0x... have on Base?" | balance 0x... --token USDC --chain base |
| "Show the latest Ethereum block" | block latest |
| "What's gas like on Arbitrum?" | gas --chain arbitrum |
| "Look up this transaction" | tx 0x... |
| "Did this tx succeed?" | receipt 0x... |
| "Is 0x... a contract?" | code 0x... |
| "What networks does OpenScan support?" | networks |
| "What's the USDC contract address?" | token USDC |
| "Show privacy-friendly Polygon RPCs" | rpcs polygon --private |
| "Show vitalik.eth balance on all chains" | multi-balance vitalik.eth |
| "What's the latest Bitcoin block?" | btc-info or btc-block |
| "Tell me everything about this address" | address-info 0x... |
| "Is 0x... a wallet or a contract?" | address-info 0x... |
| "What's the ENS name for 0x...?" | address-info 0x... (reverse ENS) |
| "Show me info for vitalik.eth" | address-info vitalik.eth |
| "How full is the Bitcoin mempool?" | btc-mempool |
| "What are Bitcoin fees right now?" | btc-fee |
| "Look up this Bitcoin transaction" | btc-tx |
| "Check Satoshi's balance" | btc-address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa |
| "Show Bitcoin block 800000" | btc-block 800000 |
共 1 个版本