Cover photo

Data is Life

Hypothetically speaking, a hack happened but not to worry we have killer Analysts/Detectives like Zachxbt who find the root and the story of how and when it happened. So, data gives you superpowers. It’s like coke, a rebirth of the mind and view of life. But how?

It all starts with a why. You’ve probably seen a couple of dashboards fly around Twitter or Warpcast and the likes and perhaps you've attempted to interpret them, but the information was ambiguous. But today, we’ll be diving into the basics of data. The what, why, and how. Gm, I’m Hedera. I speak to data and tell its story for fun. Everything you need can be seen on the block, see for yourself.

I did say we’ll be breaking down the basics, so if you’re asked, ‘What is data?’, what would your answer be? As basic as the term data seems, it’s only fair to know we know what it means without any assumptions. Data is raw, unprocessed, and facts. Still vague terms? If something is true but you can’t seem to understand it, you can call it data. In short, data is unrefined facts.

If data is raw and unprocessed facts, that must mean data analysis is the process of trying to make sense of data with tools. In short, data analysis is the refinement of unprocessed facts. Now, here’s the fun part and a core, when it comes to the refinement, you need to ask yourself why. Before getting your hands dirty, you need a target or goal to know what you are looking for. When you take trades, your goal is probably to make a profit, right? So, it guides you to thread carefully to avoid honeypots, and rug pulls, and buy the top as much as possible. The same principle applies to analysis.

You need to know what you’re looking for. Let’s have a little exercise. Open this dashboard, what's the first thing that comes to mind? It may be a little confusing but if you pay close attention you can see a lot of stable coins and metrics on stables. So, you can conclude the dashboard is on something about stablecoins. Just hold this thought as we go deeper in this article.

To a noob, might seem like a ton of work, well, it is. But it’s exciting. We now understand data and data analysis. Now, what do we understand by the word ‘Blockchain data analysis’? I think it’s quite self-explanatory. But just for the sake of it, blockchain data analysis is the refinement of unprocessed facts concerning a blockchain. Don’t know what a blockchain is?  A blockchain is simply a chain of blocks. Blocks are places where data is stored on a blockchain. Examples of blockchains are Solana, Aptos, Ethereum, and so many others.

Source: https://images.app.goo.gl/rUXpLTRVxmsinojm7
Source: https://images.app.goo.gl/rUXpLTRVxmsinojm7

Now, the next question should be how do we get started. Right? We will need tools to ‘see’ the data and ask the data questions. SQL is the primary language of every blockchain data analyst. We use platforms like Dune Analytics, BigQuery, or Flipside Crypto to communicate or extract your needs from blockchain data.

Sample SQL syntax from HederaWrites on Flipside
Sample SQL syntax from HederaWrites on Flipside

Structured Query Language, SQL, is an easy-to-learn language that is used to communicate with databases. It is always advisable to start with understanding and mastering spreadsheets/excel before learning SQL as SQL can be tagged advanced sheets. SQL is quite easy to pick up as it’s more relatable as compared to other languages like Python. Think of it like speaking basic English.

SQL is pretty basic and let me show you how. Let’s say you want to know the highest number of NFTs sold by someone on Solana. Seems pretty hard. Well, it’s not. To give better context, data can be structured or unstructured. Meaning it can be tidy and arranged or even categorized into what we call tables or it could be messy and super raw.

So, we have a new term, table. Think of a table like a category like how you have a supermarket with different sections for veggies, junk, beauty, and the like. Take another example we have a blockchain like Solana. On that blockchain, we can have different sections like Defi, NFTs, and Brigdes, right? Think of these sections like tables. We now have three tables, Defi, NFTs, and Bridges on Solana. In these sections, we could now have even more tables. So, a table can contain another table. An example is the Solana NFT table. It could have more tables like mints, sales, and transfers.

The syntax to answer our highest number of NFTs sold by someone would look something like this:

SELECT MAX(COUNT tx_hash)

FROM solana.nft_sale

WHERE seller = ‘someone_wallet_address’

AND event_name = ‘sale’

This is just a sample query to show you how easy it is to get answers. Every SQL statement starts with your question ‘What do you want?’- SELECT and the next question is ‘Where should I look?’ or ‘From where?’- FROM statement. You can then add filters using the WHERE statement because you want a specific person’s transaction history. SQL yet again is basic English with reason.

It’s not as complex as it sounds. But a question can then come up as to how can you connect multiple tables, right? We can connect multiple tables with what is called a primary key. A primary key is a field that can be found in both tables. It could be a column that is tagged id meaning if id in table one is also found in table 2, that can serve as the primary ket. Note, that they don't have to have the same name but rather the same content. A primary key could even be the tx_hash, which can be called just a hash in another table.

Identifying the primary key is just the first step, the next step will be to join the table using the primary key. Take a step back to reflect on how basic these steps are, a database is simply a collection of tables. To then get what you want, you simply need to communicate to the database using a language it understands, SQL from the right table. But if you need to create links it is then tagged a relational database as you can identify similar columns which is now called the primary key and join the tables to get your answer.

Data is life. It brings clarity and precision to all spheres of life. You just need to ask the right questions and find your tools. Everything you need can be seen on the block. It’s a wrap for this read.