sim
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePrerequisites
前提条件
Assume the Dune CLI is already installed and authenticated. Do not run upfront install or auth checks. Just execute the requested command directly.
dune simIf a command fails, inspect the error to determine the cause and follow the recovery steps in install-and-recovery.md:
dune sim- "command not found" → CLI not installed. See CLI Not Found Recovery.
- "missing Sim API key" → No key in flag, env, or config. See Sim Authentication Failure Recovery.
- "authentication failed" → Key is invalid, expired, or revoked. See Sim Authentication Failure Recovery.
- Unknown subcommand or flag / unexpected output → Possible version mismatch. See Version Compatibility.
假设Dune CLI已安装并完成认证。请勿预先运行安装或认证检查,直接执行用户请求的命令即可。
dune sim若命令执行失败,请检查错误原因并按照install-and-recovery.md中的恢复步骤操作:
dune sim- "command not found" → CLI未安装,请查看CLI未找到恢复方案。
- "missing Sim API key" → 未通过参数、环境变量或配置文件提供密钥,请查看Sim认证失败恢复方案。
- "authentication failed" → 密钥无效、过期或已被撤销,请查看Sim认证失败恢复方案。
- 未知子命令或参数/输出异常 → 可能存在版本不兼容问题,请查看版本兼容性。
Dune Sim API
Dune Sim API
A CLI interface for the Dune Sim API -- real-time, pre-indexed blockchain data. Use it to instantly look up wallet balances, token prices, transaction history, activity feeds, NFT holdings, DeFi positions, and token holder distributions across EVM and SVM chains.
这是Dune Sim API的CLI接口,可提供实时的预索引区块链数据。通过它可跨EVM和SVM链快速查询钱包余额、代币价格、交易历史、活动记录、NFT持有量、DeFi仓位以及代币持有者分布情况。
When to Use Sim API vs DuneSQL
何时使用Sim API vs DuneSQL
Choose the right tool based on the task:
| Use Case | Tool | Why |
|---|---|---|
| Wallet token balances | | Instant, multi-chain, includes USD prices |
| Recent wallet activity | | Pre-decoded, classified (sends, swaps, etc.) |
| Token price / metadata | | Real-time pricing from DEX pools |
| NFT holdings | | Includes spam filtering and metadata |
| Token holder leaderboard | | Pre-ranked by balance |
| DeFi positions | | Cross-protocol aggregation |
| Solana wallet balances | | SPL token balances with USD values |
| Custom SQL analytics | | Full DuneSQL power, historical data, aggregations |
| Cross-table joins | | Sim API returns single-entity data |
| Historical time-series | | Sim API returns current state, not historical |
| Data not covered by Sim | | Sim has fixed endpoints; DuneSQL is open-ended |
Rule of thumb: If the user wants current data about a specific wallet or token address, use . If they need custom analytics, historical trends, aggregations across many addresses, or data not available through Sim endpoints, use (see the dune skill).
dune simdune query run-sql根据任务选择合适的工具:
| 使用场景 | 工具 | 原因 |
|---|---|---|
| 钱包代币余额 | | 实时响应、支持多链、包含USD计价 |
| 近期钱包活动 | | 已预解码、分类(转账、兑换等) |
| 代币价格/元数据 | | 来自DEX池的实时定价 |
| NFT持有量 | | 包含垃圾NFT过滤和元数据 |
| 代币持有者排行榜 | | 按余额预排序 |
| DeFi仓位 | | 跨协议聚合数据 |
| Solana钱包余额 | | SPL代币余额及USD计价 |
| 自定义SQL分析 | | 完整DuneSQL功能、历史数据、聚合分析 |
| 跨表关联查询 | | Sim API仅返回单实体数据 |
| 历史时间序列分析 | | Sim API仅返回当前状态,无历史数据 |
| Sim未覆盖的数据查询 | | Sim有固定端点,DuneSQL支持开放式查询 |
经验法则:若用户需要特定钱包或代币地址的当前数据,使用;若用户需要自定义分析、历史趋势、多地址聚合分析,或Sim端点未覆盖的数据,使用(详见dune技能)。
dune simdune query run-sqlAuthentication
认证
Sim API commands require a Sim API key (separate from the Dune API key used by commands). The key is resolved in this priority order:
dune query- flag (highest priority)
--sim-api-key - environment variable
DUNE_SIM_API_KEY - Saved config file at (set via
~/.config/dune/config.yaml)dune sim auth
To save the key interactively (prompted from stdin):
bash
dune sim authException: is a public endpoint and does not require a Sim API key.
dune sim evm supported-chainsDo not attempt to handle the API key yourself -- the user must authenticate outside of this session. Never pass on the command line. Prefer or the environment variable.
--sim-api-keydune sim authDUNE_SIM_API_KEYSim API命令需要Sim API密钥(与命令使用的Dune API密钥不同),密钥的优先级顺序如下:
dune query- 参数(最高优先级)
--sim-api-key - 环境变量
DUNE_SIM_API_KEY - 存储在的配置文件(通过
~/.config/dune/config.yaml设置)dune sim auth
若要交互式保存密钥(从标准输入获取),执行:
bash
dune sim auth例外情况:是公开端点,无需Sim API密钥。
dune sim evm supported-chains请勿自行处理API密钥,用户必须在本次会话外完成认证。绝对不要在命令行中传递参数,优先使用或环境变量。
--sim-api-keydune sim authDUNE_SIM_API_KEYVerifying Authentication
验证认证状态
To test whether the CLI is authenticated, run a lightweight authenticated command:
bash
dune sim evm token-info native --chain-ids 1 -o jsonIf this returns token metadata for ETH, authentication is working. If it returns a 401 or "missing Sim API key" error, direct the user to set up their key (see Sim Authentication Failure Recovery).
若要测试CLI是否已认证,执行轻量级的认证命令:
bash
dune sim evm token-info native --chain-ids 1 -o json若返回ETH的代币元数据,说明认证成功;若返回401错误或"missing Sim API key"错误,请引导用户设置密钥(详见Sim认证失败恢复方案)。
Output Format (per-command flag)
输出格式(按命令参数设置)
Most commands support with values (default, human-readable tables) or (machine-readable).
-o, --output <FORMAT>textjsonAlways useon every command that supports it. JSON output contains the full API response (all fields, nested objects, pagination cursors) while-o jsonmode shows a summarized table that drops many fields.text
大多数命令支持参数,可选值为(默认,人类可读表格)或(机器可读)。
-o, --output <FORMAT>textjson所有支持该参数的命令,请始终使用。JSON输出包含完整的API响应(所有字段、嵌套对象、分页游标),而-o json模式仅显示汇总表格,会丢弃大量字段。text
Key Concepts
核心概念
Chain IDs and Tags
链ID与标签
EVM chains are identified by numeric chain IDs (e.g. for Ethereum, for Base, for Arbitrum). Many commands accept with:
1845342161--chain-ids- Numeric IDs:
--chain-ids 1,8453 - Tag names: (queries all default chains)
--chain-ids default
Run to discover all available chain IDs, their names, tags, and which endpoints each chain supports.
dune sim evm supported-chains -o jsonEVM链通过数字链ID标识(例如:以太坊为,Base为,Arbitrum为)。许多命令支持参数,可传入:
1845342161--chain-ids- 数字ID:
--chain-ids 1,8453 - 标签名称:(查询所有默认链)
--chain-ids default
执行可查看所有可用链ID、名称、标签,以及各链支持的端点。
dune sim evm supported-chains -o jsonPagination
分页
Most commands return paginated results. The response includes a field when more pages are available. Pass this value as to fetch the next page:
next_offset--offsetbash
undefined大多数命令返回分页结果。当存在更多数据时,响应会包含字段,将该值作为参数传入即可获取下一页数据:
next_offset--offsetbash
undefinedFirst page
第一页
dune sim evm balances 0xd8da... -o json
dune sim evm balances 0xd8da... -o json
Response includes "next_offset": "abc123..."
响应包含"next_offset": "abc123..."
Next page
下一页
dune sim evm balances 0xd8da... --offset abc123... -o json
undefineddune sim evm balances 0xd8da... --offset abc123... -o json
undefinedCompute Units
计算单元
Each Sim API request consumes compute units based on the complexity and number of chains queried. The response may include an header indicating units consumed.
X-Compute-Units-Cost每个Sim API请求会根据查询复杂度和涉及链的数量消耗计算单元。响应可能包含头,显示消耗的计算单元数量。
X-Compute-Units-CostEVM vs SVM
EVM vs SVM
- EVM (Ethereum Virtual Machine): Ethereum, Base, Arbitrum, Polygon, Optimism, and other compatible chains. Addresses are -prefixed hex (42 characters).
0x - SVM (Solana Virtual Machine): Solana, Eclipse. Addresses are base58-encoded (32-44 characters). SVM endpoints are currently in beta.
- EVM(以太坊虚拟机):以太坊、Base、Arbitrum、Polygon、Optimism及其他兼容链,地址为前缀的十六进制格式(42个字符)。
0x - SVM(Solana虚拟机):Solana、Eclipse,地址为base58编码格式(32-44个字符)。SVM端点目前处于测试阶段。
Command Overview
命令概览
| Command | Description | Auth |
|---|---|---|
| Save Sim API key to config file | No |
| List supported EVM chains and endpoint availability | No |
| Native + ERC20 token balances with USD values | Yes |
| Single-token balance on one chain | Yes |
| Stablecoin-only balances (USDC, USDT, DAI, etc.) | Yes |
| Decoded activity feed (transfers, swaps, approvals, calls) | Yes |
| Raw transaction history with optional ABI decoding | Yes |
| ERC721/ERC1155 NFT holdings with spam filtering | Yes |
| Token metadata, price, supply, market cap | Yes |
| Top holders of an ERC20 token ranked by balance | Yes |
| DeFi positions across lending, AMM, vault protocols (beta) | Yes |
| SPL token balances on Solana/Eclipse (beta) | Yes |
| Solana transaction history (beta) | Yes |
| 命令 | 描述 | 是否需要认证 |
|---|---|---|
| 将Sim API密钥保存到配置文件 | 否 |
| 列出支持的EVM链及端点可用性 | 否 |
| 原生代币+ERC20代币余额及USD计价 | 是 |
| 单条链上的单一代币余额 | 是 |
| 仅显示稳定币余额(USDC、USDT、DAI等) | 是 |
| 已解码的活动记录(转账、兑换、授权、调用) | 是 |
| 原始交易历史,可选ABI解码 | 是 |
| ERC721/ERC1155 NFT持有量,包含垃圾NFT过滤 | 是 |
| 代币元数据、价格、供应量、市值 | 是 |
| ERC20代币的顶级持有者(按余额排序) | 是 |
| 跨借贷、AMM、金库协议的DeFi仓位(测试阶段) | 是 |
| Solana/Eclipse上的SPL代币余额(测试阶段) | 是 |
| Solana交易历史(测试阶段) | 是 |
Common Workflows
常见工作流
Discover Supported Chains
查看支持的链
Always start here when unsure which chains are available or which endpoints a chain supports:
bash
dune sim evm supported-chains -o json当不确定可用链或链支持的端点时,请先执行:
bash
dune sim evm supported-chains -o jsonCheck a Wallet's Full Portfolio
查询钱包完整资产组合
bash
undefinedbash
undefinedAll token balances across default EVM chains
查询所有默认EVM链上的代币余额
dune sim evm balances 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 -o json
dune sim evm balances 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 -o json
Restrict to Ethereum and Base only
仅查询以太坊和Base链
dune sim evm balances 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 --chain-ids 1,8453 -o json
dune sim evm balances 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 --chain-ids 1,8453 -o json
Exclude spam tokens
排除垃圾代币
dune sim evm balances 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 --exclude-spam -o json
undefineddune sim evm balances 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 --exclude-spam -o json
undefinedCheck Stablecoin Holdings
查询稳定币持有量
bash
dune sim evm stablecoins 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 -o jsonbash
dune sim evm stablecoins 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 -o jsonLook Up a Single Token Balance
查询单一代币余额
bash
undefinedbash
undefinedNative ETH on Ethereum
以太坊上的原生ETH
dune sim evm balance 0xd8da... --token native --chain-ids 1 -o json
dune sim evm balance 0xd8da... --token native --chain-ids 1 -o json
USDC on Base
Base链上的USDC
dune sim evm balance 0xd8da... --token 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 --chain-ids 8453 -o json
undefineddune sim evm balance 0xd8da... --token 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 --chain-ids 8453 -o json
undefinedTrack Recent Wallet Activity
追踪近期钱包活动
bash
undefinedbash
undefinedAll activity types
查询所有活动类型
dune sim evm activity 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 -o json
dune sim evm activity 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 -o json
Only sends and receives on Ethereum
仅查询以太坊上的转账和收款
dune sim evm activity 0xd8da... --activity-type send,receive --chain-ids 1 -o json
dune sim evm activity 0xd8da... --activity-type send,receive --chain-ids 1 -o json
Only ERC20 token activity
仅查询ERC20代币活动
dune sim evm activity 0xd8da... --asset-type erc20 -o json
undefineddune sim evm activity 0xd8da... --asset-type erc20 -o json
undefinedGet Raw Transaction History
获取原始交易历史
bash
undefinedbash
undefinedBasic transaction history
基础交易历史
dune sim evm transactions 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 -o json
dune sim evm transactions 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 -o json
With ABI-decoded function calls and event logs
包含ABI解码的函数调用和事件日志
dune sim evm transactions 0xd8da... --chain-ids 1 --decode -o json
undefineddune sim evm transactions 0xd8da... --chain-ids 1 --decode -o json
undefinedLook Up Token Metadata and Price
查询代币元数据与价格
bash
undefinedbash
undefinedETH price and metadata
ETH价格与元数据
dune sim evm token-info native --chain-ids 1 -o json
dune sim evm token-info native --chain-ids 1 -o json
USDC on Base with historical prices (30d, 7d, 1d ago)
Base链上的USDC及历史价格(30天前、7天前、1天前)
dune sim evm token-info 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 --chain-ids 8453 --historical-prices 720,168,24 -o json
undefineddune sim evm token-info 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 --chain-ids 8453 --historical-prices 720,168,24 -o json
undefinedAnalyze Token Holder Distribution
分析代币持有者分布
bash
undefinedbash
undefinedTop 500 holders of a token on Base
Base链上某代币的前500名持有者
dune sim evm token-holders 0x63706e401c06ac8513145b7687A14804d17f814b --chain-id 8453 -o json
dune sim evm token-holders 0x63706e401c06ac8513145b7687A14804d17f814b --chain-id 8453 -o json
Top 50 holders of USDC on Ethereum
以太坊上USDC的前50名持有者
dune sim evm token-holders 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 --chain-id 1 --limit 50 -o json
undefineddune sim evm token-holders 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 --chain-id 1 --limit 50 -o json
undefinedCheck NFT Holdings
查询NFT持有量
bash
undefinedbash
undefinedAll NFTs (spam filtered by default)
查询所有NFT(默认过滤垃圾NFT)
dune sim evm collectibles 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 -o json
dune sim evm collectibles 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 -o json
Include spam NFTs with scoring details
包含垃圾NFT及评分详情
dune sim evm collectibles 0xd8da... --filter-spam=false --show-spam-scores -o json
undefineddune sim evm collectibles 0xd8da... --filter-spam=false --show-spam-scores -o json
undefinedCheck DeFi Positions
查询DeFi仓位
bash
undefinedbash
undefinedAll DeFi positions across default chains
查询所有默认链上的DeFi仓位
dune sim evm defi-positions 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 -o json
dune sim evm defi-positions 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 -o json
Restrict to Ethereum and Base
仅查询以太坊和Base链
dune sim evm defi-positions 0xd8da... --chain-ids 1,8453 -o json
undefineddune sim evm defi-positions 0xd8da... --chain-ids 1,8453 -o json
undefinedSolana Wallet Lookup
Solana钱包查询
bash
undefinedbash
undefinedSPL token balances
SPL代币余额
dune sim svm balances 86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY -o json
dune sim svm balances 86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY -o json
Transaction history
交易历史
dune sim svm transactions 86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY -o json
undefineddune sim svm transactions 86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY -o json
undefinedLimitations
限制
The Sim API provides pre-indexed, real-time data for specific endpoints. It does not support:
- Custom SQL queries -- Use for arbitrary DuneSQL
dune query run-sql - Historical time-series -- Sim returns current state; use DuneSQL for historical analysis
- Cross-address aggregations -- Sim queries one address at a time; use DuneSQL for multi-address analysis
- Write operations -- Sim is read-only; it does not submit transactions
- Webhook subscriptions -- Available via the Sim API REST endpoints but not through the CLI
Sim API提供预索引的实时数据,但不支持:
- 自定义SQL查询 —— 如需任意DuneSQL查询,请使用
dune query run-sql - 历史时间序列分析 —— Sim仅返回当前状态,如需历史分析请使用DuneSQL
- 跨地址聚合分析 —— Sim每次仅查询一个地址,如需多地址分析请使用DuneSQL
- 写入操作 —— Sim为只读工具,不支持提交交易
- Webhook订阅 —— 该功能可通过Sim API REST端点实现,但CLI不支持
Security
安全注意事项
- Never output API keys or tokens in responses. Before presenting CLI output to the user, scan for strings prefixed with or long alphanumeric tokens. Redact them with
sim_.[REDACTED] - Never pass on the command line when other users might see the terminal history. Prefer
--sim-api-keyor thedune sim authenvironment variable.DUNE_SIM_API_KEY - Do not attempt to handle the API key yourself -- the user must authenticate outside of this session.
- Always use on every command -- JSON output is more detailed and reliably parseable.
-o json - Always confirm with the user before making multiple paginated requests that could consume significant compute units.
- 绝对不要在响应中输出API密钥或令牌。在向用户展示CLI输出前,请扫描以开头的字符串或长字母数字令牌,并用
sim_替换。[REDACTED] - 绝对不要在命令行中传递参数,避免其他用户查看终端历史记录。优先使用
--sim-api-key或dune sim auth环境变量。DUNE_SIM_API_KEY - 请勿自行处理API密钥,用户必须在本次会话外完成认证。
- 所有支持的命令,请始终使用—— JSON输出更详细且更易解析。
-o json - 在执行可能消耗大量计算单元的多页查询前,请务必先征得用户同意。
Reference Documents
参考文档
Load the relevant reference when you need detailed command syntax, flags, and response schemas:
| Task | Reference |
|---|---|
| CLI install, Sim auth recovery, version checks | install-and-recovery.md |
| Token balances (multi-token, single-token, stablecoins) | evm-balances.md |
| Wallet activity feed (transfers, swaps, approvals, calls) | evm-activity.md |
| Raw transaction history and ABI decoding | evm-transactions.md |
| NFT collectibles and spam filtering | evm-collectibles.md |
| Token metadata, pricing, and holder leaderboards | evm-tokens.md |
| DeFi positions (lending, AMM, vaults) | evm-defi.md |
| SVM (Solana, Eclipse) balances and transactions | svm-commands.md |
如需详细的命令语法、参数及响应架构,请查看相关参考文档:
| 任务 | 参考文档 |
|---|---|
| CLI安装、Sim认证恢复、版本检查 | install-and-recovery.md |
| 代币余额(多代币、单代币、稳定币) | evm-balances.md |
| 钱包活动记录(转账、兑换、授权、调用) | evm-activity.md |
| 原始交易历史与ABI解码 | evm-transactions.md |
| NFT持有量与垃圾过滤 | evm-collectibles.md |
| 代币元数据、定价与持有者排行榜 | evm-tokens.md |
| DeFi仓位(借贷、AMM、金库) | evm-defi.md |
| SVM(Solana、Eclipse)余额与交易 | svm-commands.md |