Flipside Docs
  • Welcome to Flipside!
    • Welcome to Flipside
    • Growth Services
    • Data
      • Choose your Flipside plan
        • Free
        • Builder
        • Pro
          • Get Started in Snowflake
          • Incremental Table Pattern
          • Copy Data from Snowflake to AWS
          • Copy Data from Snowflake to GCP
          • Copy Data from Snowflake to Azure
        • Snowflake Data Shares
          • Mounting a Snowflake Data Share
    • Earn
    • Community
  • Data
    • Flipside Data
      • Table Docs by Chain
      • Data Modeling Approach
      • Labels
        • Centralized Exchange Label Type
        • Decentralized Exchange Label Type
        • Operator Label Type
        • Chain Admin Label Type
        • Decentralized Finance Label Type
        • NonFungible Tokens Label Type
        • Games Label Type
        • Bridge Label Type
        • Decentralized Applications Label Type
        • Token Label Type
        • Flotsam Label Type
      • Tags
      • Table Freshness Targets
      • Contribute to Our Data
        • Contract Decoding & ABIs
        • How to Add Your Own Tags
        • Community Curation
          • Getting Started
            • Contribution Workflow
          • Model Standards
            • dbt Tips
          • PR Checklist
    • Data Products
      • Data Studio (SQL Analysts)
        • Get Started
          • Write/fork your first query
        • Flipside AI
        • Studio in Depth
          • Query Editor
            • Query Referencing
            • Pro Tips for Querying
            • Keyboard Shortcuts
            • Hex-to-Integer Function
          • Create a Chart
            • Advanced Visualization
          • Build a Dashboard
            • Markdown Reference
          • Team Accounts
        • Tutorials
          • How to Analyze Web3 Data
          • Video Tutorials
            • Overview of Schemas & Tables
            • Ethereum Tutorials
              • Getting Started with Decoded Ethereum Events
              • Getting Started with Ethereum Balances
              • Block Level and Daily Balances
              • Finding Centralized Exchange Flows
            • Solana Tutorials
              • Solana Schema & Tables: Video Walkthrough
              • Solana Specialty Tables: Video Walkthrough
              • Exploring Transactions in solana.events
            • THORChain Tutorials
              • THORChain Schema & Tables
              • Calculating IL for THORChain
          • More Tools & Resources
        • Get Inspired
      • LiveQuery
        • Get Started
        • LiveQuery in Depth
          • Functions
            • 🤝Partner Functions
            • 🧙‍♂️EVM Functions
              • 💡Seaport: Real-time Orders
              • 💡WETH Pool Balances
              • 💡General EVM Node Queries
            • 🤖API Functions
              • 💡Query TheGraph
              • 💡Query Defi Llama
            • ⚙️Utility Functions
              • 💡Hex Converters
              • 💡JSON RPC Request Builder
              • 💡EVM Logs Decoder
              • 💡Keccak256 Encoder
          • QuickNode Setup Guide
        • Secrets Manager
        • Get Inspired
      • Snowflake
      • API/SDK (Developers)
        • Get Started - Your first API call in < 2 min
        • SDK in Depth
          • JSON RPC methods
          • Run A Query
          • Query Results
          • Pagination
          • Sorting
          • Filtering
          • Query Seconds
          • Caching (maxAgeMinutes)
          • Rate Limits
          • Errors
          • More Examples
          • Archive
            • [ARCHIVED] JS/TS SDK
            • ShroomDK Migration Guide
            • [LEGACY] R
        • Tutorials
          • Have Questions?
        • Get Inspired
    • Insights and Tools
  • Earn
    • Flipside Earn
    • Onchain Rewards
      • Quests
    • Analyst Rewards
      • Top Dashboards
        • Top Dashboard Guidelines
        • Skill Tree
      • Ambassador Program
      • Direct to Analyst Commissions
    • Wallet Management
    • Tax Center
  • Support
    • General Support
    • Open a Ticket
      • That email doesn't look quite right
    • 🌟Product Special Releases
      • 2025
        • 2025-02-06 | EVM Blockchain Standardization
          • Table Change Overview
      • 2024
        • 2024-06-13 | Solana native and wrapped addresses
        • 2024-05-01 | Improvements to Pricing Data
          • Actions for Data Studio Users
          • Actions for API Users
          • Action for Data Share Users
    • 🗒️Release Notes
      • 2025
        • 2025-05-15 | Release Notes
        • 2025-05-01 | Release Notes
        • 2025-04-17 | Release Notes
        • 2025-04-03 | Release Notes
        • 2025-03-20 | Release Notes
        • 2025-03-06 | Release Notes
        • 2025-02-20 | Release Notes
        • 2025-02-06 | Release Notes
        • 2025-01-23 | Release Notes
      • 2024
        • 2024-12-24 | Release Notes
        • 2024-12-12 | Release Notes
        • 2024-11-27 | Release Notes
        • 2024-11-14 | Release Notes
        • 2024-10-31 | Release Notes
        • 2024-10-03 | Release Notes
        • 2024-10-17 | Release Notes
        • 2024-09-19 | Release Notes
        • 2024-09-05 | Release Notes
        • 2024-08-22 | Release Notes
        • 2024-08-08 | Release Notes
        • 2024-07-25 | Release Notes
        • 2024-07-11 | Release Notes
        • 2024-06-27 | Release Notes
        • 2024-06-14 | Release Notes
        • 2024-05-30 | Release Notes
        • 2024-05-16 | Release Notes
        • 2024-05-02 | Release Notes
        • 2024-04-18 | Release Notes
        • 2024-04-05 | Release Notes
        • 2024-03-18 | Release Notes
        • 2024-03-05 | Release Notes
        • 2024-02-20 | Release Notes
        • 2024-02-05 | Release Notes
    • 📊Studio Change log
  • Flipside Community
    • Get Started
    • Ambassador Program
    • Join Our Discord
    • Join Our Guild
Powered by GitBook
On this page

Was this helpful?

  1. Data
  2. Data Products
  3. Data Studio (SQL Analysts)
  4. Tutorials
  5. Video Tutorials
  6. Ethereum Tutorials

Getting Started with Decoded Ethereum Events

This guide will take you through some sample queries working with decoded ethereum events.

PreviousEthereum TutorialsNextGetting Started with Ethereum Balances

Last updated 1 year ago

Was this helpful?

This guide provides an introduction to the ethereum.core.ez_decoded_event_logs table via a series of simple queries that explore the data.

For a breakdown of the Ethereum tables

Let's familiarize ourselves with the table by first looking at the types of events emitted by the USDC contract in the last week.

select
  event_name,
  count(*) as events
from
  ethereum.core.ez_decoded_event_logs
where
  block_timestamp >= current_date() - 7
  and contract_address = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' -- USDC
group by
  event_name
order by
  events desc;

As you would expect, the most common event for the USDC token is the Transfer event. Let us dig a big deeper into the Transfer event. The human-readable arguments for this event can be found in the decoded_log column. This column is an object and must be queried using a specific syntax, demonstrated below.

select
  decoded_log,
  decoded_log:from :: string as from_address,
  decoded_log:to :: string as to_address,
  decoded_log:value :: integer as value
from
  ethereum.core.ez_decoded_event_logs
where
  block_timestamp >= current_date() - 7
  and contract_address = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
  and event_name = 'Transfer'
limit
  5;

Now that we know how to work with this data, let's analyze it.

select
  block_timestamp :: date as block_date,
  sum(decoded_log:value :: int) / pow(10, 6) as amount
from
  ethereum.core.ez_decoded_event_logs
where
  block_timestamp >= current_date() - 7
  and contract_address = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
  and event_name = 'Transfer'
group by
  block_date
order by
  block_date desc;

The query above totals the transfer volume by day, for the last week, for USDC. Token amounts on the blockchain almost always require a decimal transformation, which for USDC is 6 places. We'll learn how to pull this in programmatically in the next section where we dig into who is receiving USDC in the last week.

with raw_transfers as (
  select
    block_timestamp :: date as block_date,
    contract_address,
    decoded_log:to :: string as to_address,
    decoded_log:value :: int as value
  from
    ethereum.core.ez_decoded_event_logs events
  where
    block_timestamp >= current_date() - 7
    and contract_address = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
    and event_name = 'Transfer'
)
select
  block_date,
  ifnull(address_name, 'Unknown') as address_name,
  to_address,
  decimals,
  sum(value) / pow(10, decimals) as amount
from
  raw_transfers e
  left join ethereum.core.dim_labels l on e.to_address = l.address
  left join ethereum.core.dim_contracts c on e.contract_address = c.address
group by
  all
order by
  block_date desc,
  amount desc;

This query utilizes a common-table-expression (CTE) to first pull in the relevant transfers in the last week. Next, we take advantage of the metadata in dim_labels and dim_contracts to enrich our analysis. dim_contracts is the home of decimals and symbols for smart contracts, as well as other metadata. dim_labels is useful for tagging addresses with human readable names, as well.

go here.