paint-brush
A Simple Guide to Blockchain Queriesby@interoperability
120 reads

A Simple Guide to Blockchain Queries

tldt arrow

Too Long; Didn't Read

This section demonstrates how the prototype application processes typical blockchain queries, with examples showing the identification of transactions within blocks, timestamp-based filtering, and cross-chain data retrieval. It highlights the ability to query across multiple blockchains (e.g., Ethereum and Avalanche), locate transactions with matching timestamps, and track asset transfers, making it suitable for scenarios like cross-chain swaps.
featured image - A Simple Guide to Blockchain Queries
Interoperability in Software Publication HackerNoon profile picture
0-item

Abstract and 1 Introduction

2 Background and Related Work and 2.1 From Bitcoin to Blockchains

2.2 Open and Permissionless Blockchains

2.3 Interoperability Between Blockchains

3 Cross-Chain Query Language and 3.1 Integrated Data Model

3.2 Grammar and Query Processing Architecture

4 Evaluation of Implementation Feasibility and 4.1 Software and Hardware Configuration

4.2 Query Processing

4.3 Discussion

5 Conclusion and Outlook, Acknowledgment, and References

4.2 Query Processing

The prototype application, realizing the architecture illustrated in Figure 2 as described in Section 3.2, was used to evaluate typical queries as follows.


The first query example, illustrated in Figure 3, shows the task of identifying transactions within a block. Here, the query attributes define the Block and BlockDescriptor (BlockDesc) classes along with the properties of the block ID, Height, Timestamp, and transactions. The following source clause specifies Ethereum, the main network, chain 1, and a block number. The query terminates by applying a filter to the timestamp attribute. The output of the query manifests as attributes prefixed by the source number, each displaying instance-level data from the data model with corresponding values. For instance, Block.id and Block.height are denoted as ’0xfb2e[...]’ and ’14505661’, respectively.


Given a specific block, query attributes could be added for continuing the investigation throughout the data model, e.g. identifying accounts in blocks using Block.accounts followed by Asset.balance in order to retrieve their balances. In a cross-chain scenario, a corresponding transaction might be located on another blockchain, e.g. transferring assets or data. By specifying a block and timestamp, transactions occurring with the same or similar timestamp might be queried. In the second query of Figure 3, this example can be seen with the aforementioned classes and attributes. Investigating this scenario further based on the Ethereum and Avalanche transactions, transactions occurring at the same timestamp in both blockchains were located and queried in the third query displayed in Figure 3. For obtaining asset transfers and data, the source clause specifies Transaction (T) and TransactionDescriptor (TDesc) classes with attributes for value and data, respectively. The source is addressed by hexadecimal transaction IDs on the two blockchains. From the query results, it can be observed that both transactions are data transactions, transferring assets of value 0.0 and data represented in hexadecimal format. For investigating assets, accounts might be queried in addition, for example as demonstrated in Query 4 of Figure 3. Given the transactions with matching timestamps together with the involved assets here indicates the exchange of tokens in a cross-chain swap scenario.


Author:

(1) Felix Härer[0000 −0002 −2768 −2342], Digitalization and Information Systems Group, University of Fribourg, Switzerland ([email protected]).


This paper is available on arxiv under CC BY-NC-ND 4.0 DEED license.