# Query Processing in Blockchain Systems: Current State and Future Challenges
## 4 Object Types in Blockchains  
From the presented application domains in Section 3, we derive two object types that are relevant in the context of blockchains, namely constant objects and expandable objects. Their main properties are summarized in Table 2. In the following, we elaborate on these two object types and describe why they need to be considered in particular when managing data in blockchains. As described in Section 2, blockchains are append-only data stores where blocks are appended to an existing blockchain. Furthermore, blocks cannot be modified subsequently, so the data within a block are immutable. If changes to the data must occur, there are two options. Either the complete object with all its fields is recreated or only a change history is \begin{table}
\begin{tabular}{p{142.3 pt} p{142.3 pt}} \hline \hline
**Query Capability** & **Main Property** \\ \hline _Projection_ & It is possible to specify which fields (i.e., key-value pairs) are included in the result set. \\ \hline _Selection_ & It is possible to specify which objects are included in the result set. \\ \hline _Sorting_ & It is possible to sort the result set by given fields. \\ \hline _Aggregation_ & It is possible to aggregate the values of certain fields using functions. \\ \hline _Grouping_ & It is possible to group given fields. \\ \hline _Join_ & It is possible to join different blockchains. \\ \hline _Temporal Queries_ & It is possible to query constant objects based on a timestamp. While for block-dependent objects there is an inherent timestamp given by the block they are stored in, object-dependent objects have their individual timestamp, which is specified in their attributes. \\ \hline _State-based Queries_ & It is possible to query expandable objects. Expandable objects can be scattered over multiple blocks, meaning that a state-based query must first find all pieces and compose them. \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Overview of the six basic query operators (white rows) and two blockchain-specific query capabilities (gray rows) derived from the presented application domains. kept. This means that there are two different forms of use. Either, an object _lives_ until a new version of it is added to the blockchain or the entire change history of an object must be searched in the blockchain and applied to the _genesis object_, i.e., the original version of the object. These two forms of use are reflected by the following two object types:  
**Constant Object. ** A constant object is final. This means that once the object is added to a block, its fields do not change. Constant objects occur over time and are valid at a specific point in time. In other words, constant objects are events, i.e., actions or occurrences that happened at a specific point in time. **Expandable Object. ** An expandable object is never final. This means that over time, the fields of this object are modified, new fields are added, or existing fields are removed. In other words, expandable objects are documents that get modified over time. Constant objects are, for example, votes in e-voting (see Figure 1(a)) or blood pressure measurements from medical IoT devices in health data management (see Figure 1(b)). In e-voting, votes are created by voters during elections. These votes are only valid once they are successfully added to the blockchain. A vote does not contain its own timestamp attribute, because in this case, only the timestamp of the block is relevant. An election official can query and aggregate these votes to derive valuable information about an election. For these queries, it is relevant in which block a vote is included. In health data management, a medical IoT device performs blood pressure measurements at certain time intervals. These measurements are either added to the blockchain individually or in batches. A measurement contains, among other attributes, a timestamp that records the time of the measurement. A physician can query and aggregate these measurements so that valuable information can be derived for the patient.