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

Decoding block data

Оглавление

Etherscan presents blockchain data in a readable format. But in doing so, it hides some important details. Blockchain data isn’t always stored in a format that is easily readable, at least to most people. For many reasons beyond the scope of this book, blockchain implementations store some data as a hash, not in a raw format. Storing data as hash values makes common querying and analytics operations more difficult than interacting with databases.

Each type of blockchain data has nuances in the way its data is formatted and stored. For example, a transaction’s input data value in its raw format, shown in Figure 3-7, isn't very helpful. You can see this by clicking or tapping View Input As ⇒ Original.


FIGURE 3-7: Original format of input data.

Etherscan can decode the input data for you. Click or tap the Decode Input Data button and Etherscan will try to translate the input data into easy-to-read input parameters for the called function. Figure 3-8 shows successfully decoded data for the cancelOrder() function. (In Figure 3-4, you saw that this transaction calls the cancelOrder() smart contract function.)


FIGURE 3-8: Decoded data for the cancelOrder() function.

You don't get this level of detail in every transaction. This transaction called a function in a registered smart contract. Registering a smart contract means that the developer submitted the application binary interface (ABI) for the contract, along with the compiled bytecode. An ABI is a definition of a smart contract’s state data, events, and functions, including each function’s input and return parameters. Etherscan uses the ABI, if it is available, to provide more descriptive information. If the ABI is not available, Etherscan can display only the raw input data.

If you explore the Etherscan page, you’ll notice the Event Logs, State Changes, and Comments tabs. I don’t cover those here, but I do revisit them in Chapter 6. Transaction data isn’t the only data you’ll encounter in a blockchain application. Smart contract developers commonly use events to log notable actions in a smart contract. Data from these events are often of interest in the data analysis process. You’ll see this type of data again.

Blockchain Data Analytics For Dummies

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