using triples as the data model for blockchain systems
TRANSCRIPT
Agenda
• Motivation
• Our approach
• Evaluation
• Example
2Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems
Motivation
• 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
3
Blockchain Systems
Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems
Motivation
Blockchain
Block n-1 Block nBlock n-2Header
TRXN
...
Header
TRXN
...
Header
TRXN
...
Key-value store(Document store)
World State
queries QueryEngine
Transaction
Key Value
... ...
latest application state
Led
ger
key value
CAR0 {color:“blue“,make:“Ford“}
Exam
ple
is derived from
• Key-value data model
• Simple query engine• World state
• Scenarios
• Transportation/Trucking
• Tracking journey stops,parcel service
• Supply Chain Integrity
• Food chain,waste management
• Requirements
• Flexible information model
• Query engine for
• World state
• History (analytics, audit trails)
4
Blockchain Systems
Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems
based on [1]
BLOCKCHAIN SYSTEMS
• immutability
• tamper-resistance
5
DATABASE SYSTEMS
• generic but flexible data model
• powerful query engine
Merge Blockchain and Database Systems
• 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)
DESIGN REQUIREMENTS
Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems
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
6Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems
Merkle B-Tree
7
[2]: The Merkle B-Tree: Li, Feifei, et al. "Dynamic authenticated index structures for outsourced databases." SIGMOD 2006.
Pointer Pointer PointerHash B Hash C Hash D
Data Data Data
Hash A
…Root node
Node
• Pointer: Memory address
• Hash: Hash over the node’s data
Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems
Hash B Hash C Hash D’
Architecture
Blockchain
Block n-1 Block nBlock n-2Header
TRXN
...
Header
TRXN
...
Header
TRXN
...
Key-value store(Document store)
World State
Block n-1 Block nBlock n-2
queries QueryEngine
QueryEngine
Transaction
Key Value
... ...
latest application state
querieslatest
applicationstate
Merkle B-tree
<Triple>
...
Led
ger
key value
CAR0 {color:“blue“,make:“Ford“}
entity attribute value
CAR0 car/color blue
CAR0 car/make Ford
Exam
ple
Exam
ple
querieshistorical
applicationstateis derived from
Header HeaderHeader
latest application state
Blockchain
8Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems
Advantage (1/2)
Replace three data stores by one
Blockchain
Block n-1 Block nBlock n-2Block n-3
Key-value store(Document store)
World State
Graph databaseRelational database
Analytics
isexported
from
isderived
from
Transaction logon file system
Blockchain
Ledger
Header
TRXN
...
Header
TRXN
...
Header
TRXN
...
Header
TRXN
...
replaced by
Storage Architecture
Triplestore
Blockchain
9Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems
• The database systems ‚Analytics‘ and ‚World State‘ are not aware of the blockchain‘sdata structure data integrity checks must be done manually
Advantage (2/2)
Built-in Data Integrity Checks (Tamper-resistance)
10
if neededdata integritychecks aredone manually
if neededdata integrity
checks aredone manually
built-in dataintegrity checks
(tamper-resistance)
QueryEngine
QueryEngine
QueryEngine
Key-value store(Document store)
World State
Graph databaseRelational database
Analytics
isexported
from
isderived
from
Transaction logon file system
Blockchain
Triplestore
Blockchain
Ledger
Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems
Problem
• High storage requirements
• Optimization mechanisms ( efficient storage techniques)
• data compression
• data encoding
• reuse of already stored data structures
11Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems
Example
12
<B9F, name, „Pluto“>
…<B9F, type, „planet“>
…
AEVA <= name
Transaction 1<B9F, name, „Pluto“><B9F, type, „planet“>
Hash FC8
Hash E87
Block 1
<B9F, name, „Pluto“> <B9F, type, „dwarf_planet“>
… …
AEVA <= name
Transaction 2<B9F, type, „dwarf_planet“>
Hash 2F7
Hash E87 Hash C29
Block 2
1
2
4
2 5
QuerySELECT ?type ASOF nWHERE[?object name „Pluto“][?object type ?type]
Node
Key Value
FC8
E87
FAA
2F7
C29
1
2
3
4
5
Nodes arestored in a
key-value store
afterBlock 1
afterBlock 2
Query resultfor n=1: ?type is planetfor n=2: ?type is dwarf_planet
Root ofsecond block
identical node
Hash FAA3
The query engine uses the Merkle B-trees of a block to compute the result of a query
Root offirst block
Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems
Contact Details
Thank you!
University of Stuttgart
IPVS/AS
Dennis Przytarski
Email: [email protected]
13Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems
References
• [1]: Androulaki, Elli, et al. "Hyperledger fabric: a distributed operating system for
permissioned blockchains." 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)
14Dennis Przytarski • Using Triples as the Data Model for Blockchain Systems