docs

Dune Analytics Node

The Dune Analytics node lets you execute any Dune SQL query from your workflow and return the results as structured data. Use it for custom on-chain analytics — wallet behavior analysis, protocol-specific metrics, smart money tracking, token holder distributions, and anything else you can write a Dune query for. The node supports parameterized queries, fresh execution or cached results, and automatic parameter validation.

Dune Analytics
Dune Analytics
Query #3237721

Configuration

General

Give this node a custom name to identify it in your workflow

Continue workflow if this node fails

Dune Analytics API

Connect your Dune API key

Your Dune Analytics API key

Query

Configure which Dune query to run

Paste a query ID or full Dune URL

Key-value rows. Each value can be a literal or — via the f(x) toggle — an expression referencing upstream nodes or workflow variables.

Options

Max rows returned (1-10,000)


Why Dune Analytics

Dune is a platform where people write SQL queries against blockchain data (Ethereum transactions, wallet balances, token transfers, etc.) and share the results as public dashboards. With over 900,000 community-created queries covering every major blockchain, you get access to battle-tested analytics without writing SQL from scratch.

The Dune Analytics node brings this power into your workflows:

  • Custom on-chain queries — run any Dune SQL query and pipe the results into LLMs, conditionals, or notifications.
  • Parameterized queries — pass dynamic values (wallet addresses, token symbols, date ranges) from upstream nodes.
  • Cached or fresh — fetch the latest cached results for speed, or re-execute the query for up-to-date data.
  • Community queries — use any of Dune's 900K+ public queries by ID, or create your own.

Configuration

FieldDescription
API CredentialYour Dune Analytics API key. Create one in your Dune workspace settings. Required.
Query IDThe query ID or full Dune URL (e.g. 3237721 or https://dune.com/queries/3237721). The node automatically extracts the ID from URLs. Supports the f(x) toggle for dynamic values.
Execution ModeExecute Fresh (default) re-runs the query and waits for completion. Latest Results fetches cached results without re-running.
ParametersOptional key-value rows that map to placeholders in the Dune query. Each row's value supports an f(x) toggle to reference upstream node outputs or workflow variables.
Row LimitMaximum number of result rows to return. Range: 1–10,000. Default: 1,000.

Finding a Query ID

  1. Go to dune.com/discover/content/trending ↗ to browse trending queries.
  2. Open a query and copy the URL — e.g. https://dune.com/queries/3237721.
  3. Paste it directly into the Query ID field — the node extracts the ID automatically.

Execution Modes

Latest Results fetches the most recent cached execution without re-running the query. This is fast and doesn't consume Dune credits, but the data may be stale.

Execute Fresh re-runs the query on Dune's servers and waits for completion. This gives you up-to-date data but uses Dune API credits and takes longer.

Parameterized Queries

Some Dune queries have placeholders in their SQL — for example, a query that tracks a specific wallet might have a wallet_address parameter. You can find these parameters by opening the query on Dune and looking for input fields above the results table.

Click Add parameter in the Parameters section to add a key-value row. The key must match the parameter name on the Dune query (e.g. wallet_address). The value can be a literal string, number, or boolean.

To reference an upstream node's output or a workflow variable, click the f(x) toggle on that row. The value cell switches into expression mode and shows an autocomplete of available fields. For example, in a workflow where a Function node produces walletAddress, you can set wallet_address to {function.walletAddress} so each run queries whatever wallet the Function emitted.

Common patterns:

  • wallet_address → {function.walletAddress} — flow a wallet from a previous node into a Dune query.
  • token_symbol → {{workflow.symbol}} — use a workflow-level variable.
  • days → 30 — a literal value (no f(x) needed).

Mix and match — some rows can be literal while others are expressions.

The node validates your parameters before execution (when your Dune plan supports it):

  • Wrong parameter names — the node will stop and tell you which names the query expects.
  • Query doesn't accept parameters — the node logs a warning and continues (Dune ignores the extra parameters).
  • Missing parameters — the node continues and Dune uses the query's default values.

Setting Up Your API Key

Step 1: Get a Dune API Key

  1. Log in to dune.com ↗.
  2. Go to your workspace Settings → API.
  3. Create a new API key and copy it.

Dune offers a free plan with 2,500 API credits/month — enough for testing and light usage.

Step 2: Add the Credential in NickAI

  1. Go to Credentials in NickAI.
  2. Click Add Credential and select Dune Analytics.
  3. Paste your API key.
  4. Give it a name (e.g. "My Dune Key") and save.

Step 3: Select in the Node

  1. Open your workflow and select the Dune Analytics node.
  2. In the Dune Analytics API section, select your credential.

Workflow Examples

Smart Money Tracker

Monitor whale wallet activity and get alerts when large transfers happen.

Dune Analytics
Whale Txns
Query #3237721
Filter Large
JavaScript
> $1M?
1 rule
Alert

The Dune query returns recent large transfers. The Function node filters by amount. The Conditional routes significant transactions to a Telegram alert.

Protocol Health Dashboard

Fetch protocol metrics and generate a daily digest with AI analysis.

Dune Analytics
Protocol TVL
Query #456789
Dune Analytics
User Activity
Query #789012
Analyze
Claude Sonnet 4.6
Daily Report

Two Dune queries feed into an LLM — one for TVL metrics, one for user activity. The LLM synthesizes both into a report sent via email.

Token Holder Analysis

Track token distribution changes and generate trading signals.

Dune Analytics
Token Holders
Query #112233
Concentration?
Claude Sonnet 4.6
Risky?
1 rule
Team Alert

Pricing & Credits

Each Dune Analytics API call costs 10 NickAI credits, regardless of execution mode or result size.


Output

The node outputs a structured object with query results and metadata.

PathDescription
{dune.queryId}The Dune query ID that was executed
{dune.executionId}Execution ID (only for Execute Fresh mode)
{dune.state}Execution state (e.g. QUERY_STATE_COMPLETED)
{dune.data.rows}Array of result row objects
{dune.data.rows[0].column_name}Access a specific column in the first row
{dune.data.columns}Array of column name strings
{dune.data.rowCount}Number of rows returned
{dune.data.totalRowCount}Total rows in the full result set
{dune.metadata.source}Always dune
{dune.metadata.executionTimeMs}Query execution duration in milliseconds
{dune.metadata.requestedAt}ISO timestamp of when the request was made
{dune.metadata.creditsUsed}NickAI credits charged

Example Output

{
  "queryId": 3237721,
  "executionId": "01J5K...",
  "state": "QUERY_STATE_COMPLETED",
  "data": {
    "rows": [
      { "wallet": "0xd8dA...", "total_volume": 15234567.89, "tx_count": 342 },
      { "wallet": "0xaBc...", "total_volume": 8901234.56, "tx_count": 178 }
    ],
    "columns": ["wallet", "total_volume", "tx_count"],
    "rowCount": 2,
    "totalRowCount": 2
  },
  "metadata": {
    "source": "dune",
    "executionTimeMs": 4523,
    "submittedAt": "2026-04-20T10:00:00Z",
    "executionEndedAt": "2026-04-20T10:00:04Z",
    "requestedAt": "2026-04-20T10:00:00Z",
    "creditsUsed": 10
  }
}

Common Errors

ErrorCauseFix
Dune API key is invalid or expiredBad credentialRegenerate your API key in your Dune workspace settings
Dune query not foundWrong query ID or query is privateVerify the query ID exists and is accessible with your API key
No cached results availableQuery has never been executedSwitch to "Execute Fresh" mode to run the query for the first time
Dune API credits exhaustedDune plan limit reachedUpgrade your Dune plan or wait for credits to reset
Dune API rate limit exceededToo many requestsSpace out requests or upgrade your Dune plan
Your Dune plan does not support this query's performance requirementsQuery requires a higher Dune tierUpgrade your Dune subscription at dune.com/pricing ↗
Unknown parametersParameter names don't match what the query expectsCheck the query on Dune for the correct parameter names
Invalid query parameters JSONAn f(x) expression resolved to an object/array, breaking the serialized parametersEnsure each parameter expression resolves to a scalar (string, number, or boolean). Use a Function node to extract a scalar field from a complex object before referencing it.
Dune query failedSQL error in the queryCheck the query on Dune for syntax errors

Dune Plan Considerations

The node works with all Dune plans including free. Some things to be aware of:

  • Free plan includes 2,500 API credits/month and access to execute and fetch results.
  • Parameter validation (checking if your parameter names match the query) requires a Plus or Enterprise plan. On free plans, the node skips this check and proceeds with execution.
  • "Latest Results" mode returns cached results from the last execution. If a query has never been executed, there are no cached results — use "Execute Fresh" instead.

Next Steps

  • LLM Node — Analyze Dune query results with AI to generate insights or trading signals.
  • Function Node — Transform or filter query result rows with custom code.
  • Conditional Node — Route decisions based on on-chain metrics.
  • DeFi Llama Node — Combine on-chain analytics with DeFi protocol metrics.
  • Loop Node — Iterate over result rows to process each one individually.