Cover Image for Blockchain Data Observability: Bridging the Gap Between Data and Decisions

Blockchain Data Observability: Bridging the Gap Between Data and Decisions

Blockchain
Observability

Understanding blockchain data can be confusing, but it's simpler than it sounds. Basically, it means keeping track of and analyzing all the information that's generated on-chain. By interpreting this data, it's possible to turn it into something meaningful and derive useful insights. This blog explains what blockchain data observability is and how you can use on-chain data to improve your observability of any ecosystem.

In short, blockchain data is made up of raw facts that need to be transformed into understandable information.

Now, let's break down the term "Blockchain Data Observability".

We would divide it into three components.

  1. Blockchain: A decentralized and permissionless DLT (distributed ledger technology) that records transactions across multiple networks of computers otherwise known as nodes in a secure, immutable, and secure manner.

  2. Data : In the context of blockchain, data refers to information stored on a chain within blocks. This data can be transaction details, assets, smart contract addresses, and code.

  3. Observability: This is the ability to gain insights and understand any system's internal state, analyzing outputs, operation, and performance.

Now combining all components, we can say that Blockchain Data Observability involves monitoring and analysis of data stored within a blockchain to understand its functions, detect anomalies, ensure compliance with industry standards, and gain additional information that can be used for auditing and optimization.

Introducing Observability in Web3

When we talk about decentralized apps (dApps), smart contracts, trading protocols, and interoperability, we need to have strong observability tools. Blockchain observability helps us understand any project or ecosystem built on-chain. For those new to the technology, investing in a bad project can be risky, and the learning curve for web3 is steep. However, using observability tools can help reduce the learning curve and avoid these risks. Without proper observability, we can only guess how the system works, which can lead to poor decision-making

To get a better example and overview, let’s imagine you have some coins or tokens that you have already purchased from a centralized exchange like Binance and then you want to make use of that token to perform functions like providing liquidity to a DeFi platform or even simple swaps (from one token to another). All these involve transactions that range from simple to complex as they can also take different routes to complete, and the transactions contain logs or details that you can further trace with an analysis tool or explorer.

Unlike traditional centralized tools used for observation that can access comprehensive logs and metrics from a single source which is equally controlled by the powers that be, monitoring tools in Web3 present a better use case due to their decentralized nature and ability to source data and information from multiple networks in real time.

What can be observed in Web3?

The beautiful thing about blockchain is that all information is available for anyone to view. With new on-chain data tools being developed, blockchain data observability has become simpler.

Let's start with Tracing and Tracking Events.

These events play a crucial role in any existing blockchain ecosystem, as they provide mechanisms for communications and interaction between smart contracts and decentralized applications, especially when it comes to interoperability systems and bridging. These events exist in some actions you perform, for example, swapping tokens, adding liquidity positions, locking tokens in smart contract vaults which most DAOs (Decentralized Autonomous Organizations) use, and staking.

Smart contract events are also employed in auditing, integration with off-chain systems, decentralized oracles, and overall user experience.

A typical example of a smart contract event is an Approval Event,

Now, in a blockchain like Ethereum, tokens are created with the ERC-20 or ERC-721 standards. When you are building a platform or system that allows users to approve an entity to spend tokens on its behalf, then approval events are utilized. For instance, the ERC-20 standard defines an event named Approval(address indexed owner, address indexed spender, uint256 value) to signal token approval.

A powerful tool that you can use for getting call traces and tracking events in most blockchain networks is Bitquery.

Using Bitquery's API and explorer, you can get a ton of perfectly curated information on

Before we get started, let's understand the concept of tracing and event tracking.

Tracing refers to the ability to track and verify the origin, transfers, and other transaction details regarding an asset across a blockchain network. This is really important as it proves transparency, provides authenticity of data (which is immutable), and verification of assets. The Supply Chain Industry employs tracing a lot since the mechanism ensures and validates its processes.

The two most important things in implementing tracing in blockchain are

  1. Unique Identifier: Every token or asset entry on the blockchain is assigned a unique identifier which is known as transaction hash. This is important as it is very unique and holds a permanent record of such transactions.

  2. Timestamping: This establishes a chronological order of transactions, prevents double spending, and ensures the integrity of the blockchain by recording the exact time each transaction occurs.

Using Bitquery's Explorer to trace transactions

Let’s make use of this address on Ethereum for transaction tracing

https://explorer.bitquery.io/ethereum/address/0xbfb16fdae67627bc1c3b2cdf719b8e50c76f0f91

Before we proceed, note that you can equally perform the same actions as you go through this article

Follow this documentation on tracing transactions on the explorer

Now, let’s begin ⬇

This is the account on the Explorer, note we have selected the Transaction tab to view txns on the address

Note on the Transactions tab, we have the Timestamp and the Hash which is the unique identifier as we mentioned earlier, which are the basic elements involved in implementing transaction tracing.

We can click on any hash to dive deeper into the transaction details, upon getting into the transaction hash, we will get to the tracing by tapping on the Tracing tab

With this, you can fully see what occurred in the transaction as we can see the “approve” calls that triggered an expense on the address.

Why is it important to monitor blockchain calls and events? How can we improve observability to track events?

Every transaction results in some kind of change in a state for example, an Approval event is emitted when "allowance of a spender for an owner is set by a call to approve".

On the blockchain, when you make a transaction, it can either go through successfully or not at all. There's no halfway. To help us understand what changes after a transaction, events can be sent out. These events emitted tell us what changes occured because of the transaction, giving us important information about how things work.

We can also use another address with a complex transaction hash to trace the details existing in the transaction.

Using this hash for tracing below

https://explorer.bitquery.io/ethereum/tx/0x64319c1c3db12b41c7ac0fb5d0e06c443181ef95948ea08dab310f77998e7e9b/tracing

We can see that this transaction hash 0x64319c1c3db12b41c7ac0fb5d0e06c443181ef95948ea08dab310f77998e7e9b has a lot of things going on under the hood as you can see the log in the image below

Now, let us try to interpret some of the complexities in the log.

On a surface level , what you need to understand is that the above transaction log contains information like "execute", which represents the execution of transactions which can be either send/receive commands on chain, others include function calls, transfers, approvals, and other interactions with smart contracts.

Let’s try to explain what some of these functions or commands mean.

  • When you see "execute" it indicates a beginning of a new transaction or action.

  • The "inputs" part holds the details needed for the transaction, including commands and deadline. This is likely to involve the approval of specific tokens.

  • The section which is labeled "permit" or "permitSingle" usually deals with allowing certain actions to happen, often related to approving transactions involving tokens.

  • "transferFrom" or "transfer," refers to moving tokens from one address to another.

  • "balanceOf" is about checking how many tokens a specific address has.

  • If you see "getReserves," it's likely fetching data about the available funds in a pool or pair of tokens.

  • "Swap" indicates an exchange or trade, probably on a decentralized exchange like Uniswap or Kyberswap.

  • "Sync" means updating or adjusting, often related to keeping track of available funds.

  • "Withdrawal" involves taking tokens out of a contract or pool.

  • "[Return: ...]" shows what happened after a certain action, like if it succeeded or failed.

We can also use the explorer to get information about the movement of funds in a particular transaction. A transaction can be complex and requires funds or tokens to move through routes, liquidity pools or even contracts before arriving at a destination (recipient's wallet address).

On the Bitquery Explorer, the tool we can use to do this is Money Flow which visualizes the events or calls made during the transaction process.

Using Money Flow Trace on the Explorer

The Money Flow Diagram illustrates the transfer of tokens between different addresses during that transaction.

It aims to simplify and make users understand complex fund movement by visualizing the transaction.

Below is an example of a money flow diagram on this transaction hash.

Conclusion

Getting blockchain data and observing it to gather detailed information can sometimes be challenging, but with tools like Bitquery, we can explore any data and gain insights into any transaction on-chain. Also adding that becoming a pro at observing blockchain data is way easy with Bitquery’s explorer which gives you real-time and archived datasets and reliable information. You can use the links in the Helpful Resources below to get started.

Helpful Resources

Subscribe to our newsletter

Subscribe and never miss any updates related to our APIs, new developments & latest news etc. Our newsletter is sent once a week on Monday.