Learn about Ethereum transactions and write your first Web3 SQL to extract data from the blockchain.

Kirubakumaresh Rajendran
Coinmonks
3 min readSep 7, 2022

--

Photo by Esther Jiao on Unsplash

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’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.

Create Smart Contract Workflow

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.

Call Existing Contract Workflow

Transaction Type III : Transfer ETH

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

ETH Transfer Workflow

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.

Dune Analytics Data Load

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

Total Ethereum Transactions (as of sep’2022) Since Inception

Fork the above query and create your own chart.

We explored transactions and created our first query with just three lines of code to extract data from the public blockchain.

Follow for more articles on web3/blockchain data analytics.

Originally published at https://www.twigblock.com.

New to trading? Try crypto trading bots or copy trading

--

--

Kirubakumaresh Rajendran
Coinmonks

Building twigblock.com to empower anyone to unlock web3 data. I write about web3 data analytics/science. kikura.eth | linktr.ee/kirubakumaresh