Skip to content

Commit

Permalink
Replace tx_sender with tx_from fix duneanalytics#484
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzdogan authored Dec 30, 2024
1 parent e221a6b commit 9da35c3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions learning/how-tos/create-your-first-query.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ GROUP BY

## Crafting Your Query

1. **Identify Your Columns**: Once you've zeroed in on the right table, pinpoint the `tx_fee_usd` column to track USD gas expenditures. To specify the wallet you're examining, use the `tx_sender` field. For demonstration purposes, we'll be using Vitalik's wallet (0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045).
1. **Identify Your Columns**: Once you've zeroed in on the right table, pinpoint the `tx_fee_usd` column to track USD gas expenditures. To specify the wallet you're examining, use the `tx_from` field. For demonstration purposes, we'll be using Vitalik's wallet (0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045).

2. **Aggregation & Time Period**: Our goal is to get monthly gas spendings, so we need to truncate the `block_date` to month and applying the `SUM()` function, then group by each month go derive the results.

Expand All @@ -46,7 +46,7 @@ SELECT
SUM(SUM(tx_fee_usd)) OVER (ORDER BY DATE_TRUNC('month', block_date)) AS cumulative_gas_spent
FROM gas.fees
WHERE
tx_sender = 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 -- vitalik.eth
tx_from = 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 -- vitalik.eth
GROUP BY
1
ORDER BY
Expand All @@ -58,7 +58,7 @@ Here is the [link to demo query](https://dune.com/queries/3100875).

## Boost Flexibility with Parameters

In the example, you'll see `tx_sender = \{\{Your Wallet Address}} -- default is vitalik.eth`. This denotes the use of the parameter feature, enhancing the query's flexibility. To mark a field as a parameter, wrap it in "". Alternatively, activate the "Add Parameter" button.
In the example, you'll see `tx_from = \{\{Your Wallet Address}} -- default is vitalik.eth`. This denotes the use of the parameter feature, enhancing the query's flexibility. To mark a field as a parameter, wrap it in "". Alternatively, activate the "Add Parameter" button.

<div
style={{
Expand Down Expand Up @@ -92,7 +92,7 @@ SELECT
SUM(SUM(tx_fee_usd)) OVER (ORDER BY DATE_TRUNC('month', block_date)) AS cumulative_gas_spent
FROM gas.fees
WHERE
tx_sender = {{Your Wallet Address}} -- default is vitalik.eth
tx_from = {{Your Wallet Address}} -- default is vitalik.eth
GROUP BY
DATE_TRUNC('month', block_date)
ORDER BY
Expand All @@ -106,4 +106,4 @@ All set! Click "Run" and behold the outcome. Kudos on crafting your first query!

Now that you have successfully run your query, you can go ahead and save it so you can keep monitoring your gas usage going forward. To save, click **Save** in the upper right part of the screen.

<Note>For a more intuitive insight, consider visualizing this data. Navigate to [Create your first visualization](learning/how-tos/create-your-first-visualization) and conjure up some graphical magic!</Note>
<Note>For a more intuitive insight, consider visualizing this data. Navigate to [Create your first visualization](learning/how-tos/create-your-first-visualization) and conjure up some graphical magic!</Note>

0 comments on commit 9da35c3

Please sign in to comment.