List Ethereum Transactions using Dune Analytics

Avatar of Kirubakumaresh Rajendran
Kirubakumaresh Rajendran

August 20, 2022 · 2 min read

We will be using Dune Analytics to query the blockchain data and create the charts.

Let's navigate to Dune query window.

Dune setup

Dune Query Window

We will look at transactions created so far in Ethereum network.

What is a Transaction?

Ethereum is a global computer that executes smart contract and stores its data (generally referred as contract state).

In addition to smart contract's state, it also stores account balances i.e ETH owned by accounts.

Ethereum global state

Ethereum global state

Ethereum's global state is updated on the following three scenarios.

Transaction Type I : Create Smart Contract

To create a smart contract on the Ethereum network, the user signs and sends a transaction along with the code. Once the transaction is processed, the Ethereum Virtual Machine (also known as the EVM) updates the global state to store the new contract's code and data.

Transaction Type II : Call Smart Contract

In order to perform action on an existing contract, the user signs and sends a transaction to invoke the required method along with the input data. Upon processing, the EVM updates the contract's data to reflect the current state. 

For instance, when a user sells their NFT registered in a particular contract, the contract's state will be updated to reflect the new owner.

Transaction Type III : Transfer ETH

When a user transfers ETH to another user, the account state is updated to reflect the new balances.

As we've seen, any changes to the Ethereum network are made through transactions. Transactions are the means by which external users interact with the system. So, by measuring the transaction volume, we can observe how active the network is.

Since we have observed that every transaction is recorded in the blocks (referred to as the blockchain), we can figure out the total number of transactions by querying the blocks.

Dune Analytics extracts the transaction data from the blocks and loads them into the ethereum.transactions table.

Host blockchain data

To identify the total number of transactions since inception, we can just count the total number of rows in the table.

/* Query to retrieve total number of transactions in Ethereum */
  --Divided by 1e9 to report results in billions
  COUNT(*)/1e9 AS transactions_count

👨🏽‍💻 Now paste the above query into your Dune window and execute it. It may take some time to produce the results.

Once executed, We can create a counter chart to show the results.

Steps to create counter chart in Dune

Steps to create counter chart

Great work! We explored transactions and created our first query to extract data from the public blockchain.

If you're interested in learning more about blockchain analytics, sign up to receive notifications about upcoming articles and projects.

© 2022 TwigBlock All rights reserved. Credits.