IPVS/AS

Using Triples as the Data Model for Systems

Dennis Przytarski Agenda

• Motivation • Our approach • Evaluation • Example

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 2 Motivation Blockchain Systems

• Initially designed for cryptocurrencies • Simple and fixed data model

• Other scenarios • Automotive • Full history of a vehicle • Real Estate • Record of land titles • Voting • Reduce voter fraud

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 3 Motivation Blockchain Systems latest application state • Key-value data model World State • Simple query engine queries Query Key-value store • World state Engine (Document store) • Scenarios is derived from • Transportation/Trucking Blockchain • Tracking journey stops, parcel service Ledger Block n-2 Block n-1 Block n • Supply Chain Integrity Header Header Header • Food chain, waste management TRXN TRXN TRXN ...... • Requirements • Flexible information model • Query engine for Transaction • World state Key Value • History (analytics, audit trails) key value ......

based on [1] CAR0 {color:“blue“,make:“Ford“} Example

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 4 Merge Blockchain and Systems

BLOCKCHAIN SYSTEMS DATABASE SYSTEMS • immutability • generic but flexible data model • tamper-resistance • powerful query engine

DESIGN REQUIREMENTS • maintain a flexible information model and an efficient data representation • support a powerful query engine • preserve the integrity of the blockchain‘s data structure (tamper-resistance)

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 5 Data Model

• Key-value • values are often serialized • if key is not known, a full scan is necessary • no powerful query engine, just get/set operations • Relational • too strict for immutable data • schemas evolve over time leading to schema changes • Triples • flexible schemas without maintaining an one-size-fits-all schema • triples are facts  data of interest are easier to extract

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 6 Merkle B-

Hash A

Root node … Pointer Hash B Pointer Hash Pointer Hash D

Node Data Data Data

Hash B Hash C Hash D’

• Pointer: Memory address • Hash: Hash over the node’s data

[2]: The Merkle B-Tree: Li, Feifei, et al. "Dynamic authenticated index structures for outsourced ." SIGMOD 2006.

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 7 Architecture

latest application state World State queries Query Query Key-value store Engine Engine (Document store) queries queries historical latest application application is derived from state state

Blockchain Blockchain

Ledger Block n-2 Block n-1 Block n Block n-2 Block n-1 Block n Header Header Header Header Header Header TRXN TRXN TRXN ......

latest application state Transaction Merkle B-tree entity attribute value Key Value key value CAR0 car/color blue

CAR0 {color:“blue“,make:“Ford“} ...... Example CAR0 car/make Ford ... Example

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 8 Advantage (1/2) Replace three data stores by one

Blockchain

Block n-3 Block n-2 Block n-1 Block n Header Header Header Header TRXN TRXN TRXN TRXN ......

Storage Architecture

Analytics Blockchain World State Blockchain Key-value store on file system is is (Document store) exported derived from from replaced by Ledger

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 9 Advantage (2/2) Built-in Data Integrity Checks (Tamper-resistance) • The database systems ‚Analytics‘ and ‚World State‘ are not aware of the blockchain‘s data structure  data integrity checks must be done manually

Query Query Query Engine Engine Engine if needed if needed built-in data data integrity data integrity integrity checks checks are checks are (tamper-resistance) done manually done manually

Analytics Blockchain World State Blockchain Transaction log Graph database Key-value store on file system Triplestore Relational database is is (Document store) exported derived from from

Ledger

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 10 Problem

• High storage requirements • Optimization mechanisms ( efficient storage techniques) • data compression • data encoding • reuse of already stored data structures

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 11 Example

Transaction 1 Transaction 2

Block 1 Block 2 The query engine uses Hash FC8 Hash 2F7 1 4 the Merkle B-trees of a Node AEV AEV block to compute the A <= name A <= name result of a query

Hash E87 Hash FAA Hash E87 Hash C29 Nodes are 2 3 2 5 stored in a … … … … key-value store Key Value Root of identical node after FC8 1 first block Query Block 1 E87 2 SELECT ?type ASOF n FAA 3 WHERE Query result Root of 2F7 4 [?object name „Pluto“] for n=1: ?type is planet after second block [?object type ?type] for n=2: ?type is dwarf_planet Block 2 C29 5

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 12 Contact Details

Thank you!

University of Stuttgart IPVS/AS Dennis Przytarski Email: [email protected]

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 13 References

• [1]: Androulaki, Elli, et al. "Hyperledger fabric: a distributed operating system for permissioned ." Proceedings of the Thirteenth EuroSys Conference. ACM, 2018. • [2]: Li, Feifei, et al. "Dynamic authenticated index structures for outsourced databases." Proceedings of the 2006 ACM SIGMOD international conference on Management of data. ACM, 2006. • Merkle, Ralph C. "A digital signature based on a conventional encryption function." Conference on the theory and application of cryptographic techniques. Springer, Berlin, Heidelberg, 1987. • C. Mohan, Tutorial: Blockchains and Databases (VLDB 2017)

Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems 14