Читать книгу Blockchain Data Analytics For Dummies - Michael G. Solomon - Страница 75

Serializing transaction data

Оглавление

The core of blockchain data is contained in the transaction. A blockchain transaction records the transfer of some value from one account to another account. Additional information may be in the transaction, such as input data that records smart contract parameters, but not every transaction includes additional data.

Each transaction does include a timestamp showing the date and time the transaction was mined, so you can create a chronological list of transactions and see how value changed ownership at specific points in time and how value moved among accounts. This movement is serial. The serial nature of data storage can yield interesting information but can also be an obstacle to analyzing the data.

Unlike traditional data storage systems such as relational databases, final tallies or balances often have to be calculated over time. A traditional database can store the current balance of an account, while you may have to trace all blockchain transactions for an account to arrive at its final balance. The data is available, but it may take more work to get to it.

Blockchain gives you the flexibility of tracing transactions by account but doesn’t always make it easy to query a single value. For example, suppose you want to know the balance of a specific account on a specific date. Finding the current account balance is easy, but finding the balance as of a specific date (and time), requires serializing the transactions for that account and calculating account increases and decreases up to the date and time in question.

If you're comfortable with databases and applications that access database data, searching transactions doesn’t sound like such a bad thing to do. However, remember that a blockchain is not a database. The data in a blockchain is not stored in a manner that makes general purpose queries easy and fast. You can get the information you want, but you have to think about the effort to get that data in a different way.

The serialized transaction storage of blockchain data does provide the flexibility to trace and retrieve activity data in several ways. Here are a few types of queries you can satisfy by tracing blockchain transactions:

 Find all transactions in which a specific account sent funds.

 Find all transactions that resulted in a specific account receiving funds.

 Find all transactions that occurred between two specific accounts.

 Find all transactions that invoked a specific smart contract function.

After you fetch the data you want, you can trace the transactions, calculating the value change (that is, keeping track of the Value and Transaction Fee fields) to find the information you’re looking for, such as a balance at a specific point.

Blockchain Data Analytics For Dummies

Подняться наверх