You are on page 1of 14

UMT Artificial Intelligence Review (UMT-AIR)

Volume 2 Issue 1, Spring 2022


ISSN(P): 2791-1276 ISSN(E): 2791-1268
Homepage: https://journals.umt.edu.pk/index.php/UMT-AIR

Article QR

Title: Role of GraphDB in FinTech, Blockchain Ledgers

Author (s): Hassan Kaleem1, Sundas Rukhsar1, Waqar Ahmad2, Hafiz Ali Haris3

Affiliation (s):
1
9 Frances Street Crewe, England
2
Electronic Government Authority RAK, UAE
3
Communication & Works Department, GOP, Pakistan
DOI: https://doi.org/10.32350.umt-air.21.03

History: Received: March 10, 2022, Revised: April 25, 2022, Accepted: June 10, 2022

H. Kaleem, S. Rukhsar, W. Ahmad, and H. A. Haris, “Role of GraphDB in


Citation:
FinTech, blockchain ledgers,” UMT Artif. Intell. Rev., vol. 2, no. 1, pp. 00–00,
2022, doi: https://doi.org/10.32350.umt-air.21.03

Copyright: © The Authors


Licensing: This article is open access and is distributed under the terms of
Creative Commons Attribution 4.0 International License
Conflict of
Interest: Author(s) declared no conflict of interest

A publication of
Department of Information System, Dr. Hasan Murad School of Management
University of Management and Technology, Lahore, Pakistan
Role of GraphDB in FinTech, Blockchain Ledgers
Hassan Kaleem1*, Sundas Rukhsar 1, Waqar Ahmad 2, Hafiz Ali Haris 3
1
Frances Street Crewe, England
2
Electronic Government Authority RAK
3
Communication & Works Department, GOP, Pakistan
Abstract— GrpahDB stores data in I.Introduction
nodes and edges, nodes represent
entities and edges represents the Blockchain is a peer to peer
relationship between entities. The network that uses digital ledger
role of GraphDB in the blockchain is system that is maintained by
described as blockchain uses blocks different computer in a network. It
and these blocks are connected creates block and these blocks are
through hashcode to store the data. linked together through hash
In cipher language, hash is the function [1], in cryptographic world
irreversible conversion of data Cipher is an algorithm which
which makes it impossible to encrypts and decrypts the data but
decrypt. Blockchain also uses proof
Hash Code is an irreversible
of work system, in which data is
entered only if maximum people
conversion data, which makes
allows verifies it. And once anything blockchain network more secure.
entered into ledger, it cannot be Because once you have entered the
altered or deleted. The paper has data into blockchain ledger which is
provided how hashing & indexing, the database of blockchain you
query processing, transaction can’t alter or delete the data from it.
management, data management and Blockcahin is used for financial
data distribution is done for transactions between two parties
GraphDB into ledger, with without the involvement of any
previously done work and libraries third party for example banks.
to build and manage GraphDB
Blockchain was first developed by
blockchain.
Satoshi Nakamoto [2]. GraphDB
Index Terms-GraphDB in [3] is a type of NoSql database
FinTech, Neo4j, Hashing & which uses nodes and edges to store
Indexing, Query Processing, its data in the database. Nodes and
Transaction Management, Data Edges represents the object and its
Management, Data Distribution
properties. Relational database [4]
is not flexible because once you
have created a relational database

*
Corresponding Author: Hassanrao.hr@gmail.com
Department of Information Systems
25
Volume 2 Issue 1, Spring 2022
Role of GraphDB…

it’s unless you changed it by for developing blockchain-based


yourself which requires extra applications that can be used within
efforts and time and it’s not a good a private organization. The research
practice. GraphDB solves this provides a discussion on the
problem because it’s easy to add motivation and benefits of the
new attributes and relationships in techniques adopted in recent 2017-
the database. But when we develop 2022 GraphDB models for Hashing
GraphDB in blockchain few & Indexing, Query Processing,
problems are related with the Transaction Management, Data
security of Ledger [5]. First, there Management and Data Distribution
was bitcoin [2] and then came for Blockchain.
Ethereum [6] which is much more
II.Background Material
programmable then bitcoin. But
both of these uses its own currency In this section, the first thing get
as a medium of exchange but to know the graph database.
HperLedger Fabric [7] does not GraphDB [3] is a type of NoSql
own its currency, since bitcoin and database which uses nodes and
Ethereum are open networks edges to store its data in the
anybody can connect with this database. Nodes and Edges
network, Hyperledger Fabric is a represents the object and its
private network which can only be properties.
accessed by the people who are the
part of the network. And it is used

Fig. 1. Nodes

UMT Artificial Intelligence Review


26 Volume 2 Issue 1, Spring 2022
Kaleem et al.

A. GraphDB system that is maintained by


different computer in a network.
The importance of storing the
The goal of this research is to
data in GraphDB is explained in the
discuss the motivation and benefits
following research [8], [9]. The
of the techniques adopted in recent
GraphDB consists of two elements,
2017-2022 GraphDB models for
first edge and second node. Nodes
Hashing & Indexing, Query
and Edges represents the object and
Processing, Transaction
its properties. Many systems are
Management and Data
using GraphDB now, twitter is great
Management. Study showed [12]
example of GraphDB [10]. For
that 256 GB of Bitcoin’s data will
example, in Figure 1 “burger” and
require 258*0.33=86 GB of storage
“food” nodes would have the
[13]. Thus, it will result in high
relationship, here’s each node has
different attributes. There are performance.
different models for GraphDB [11] A. Hasing & Indexing
such as, Indexing is way of sorting
AllergoGraph provides special numbers of records in different
features for analysis on social fields. And Hashing is used to
network. DEX which is based on retrieve them using a shorter hashed
Java libraries for management of key. Hashing & Indexing is used in
temporary graph. DEX ensures the different contexts in GrpahDB [14].
good performance for vary large Due to existence of property values
scale database. HyperGraphDB, it in GraphDB, there are two kinds of
is useful for modeling the data like graph indexes, structure based and
Artificial Intelligence and Bio- value based. They occur in
Informatics. InfiniteGraph, it is GraphDB in different forms for
useful for analysis in business, example full text querying support.
social and government intelligence. Some search engines like Apache
Neo4j is an open source GraphDB, Lucene used in GraphDB as index
which uses node, edges and its backend.
attributes to store data. Sones is a In Value-Based Indexing the
GraphDB that has its own graph research presents indexing with
query language. three different Graph Database
III. GrpahDB in Blockchain Management Systems (GDBMS).
The Cypher language of Neo4j
Blockchain is a peer to peer
network that uses digital ledger allows indexing for one or multiple
for all nodes, but only for nodes
Department of Information Systems
27
Volume 2 Issue 1, Spring 2022
Role of GraphDB…

who has given labels [15]. Sparksee indexes based on structure, which
uses compressed bitmap indexes are path-based, index-based and
and B+Trees to store nodes and spectral methods. Spectral methods
edges and with their properties. For uses the concept of spectral graph
faster query processing titan theory. But no Index structure
supports two different kinds of supports all king of substructure
indexing mechanism, node-centric features. Researchers’ [20]
and graph indexing. In node-centric purposes a Lindex, a kind of graph
indexing, these are local index index which allows indexes to
structure which are built on nodes subgraphs contained in GraphDB.
individually. The graph indexes Similarly feature-based graph index
allows enhanced retrieval of nodes techniques can be found in [21]. In
and edges from their properties on [18], the researchers introduced two
selection conditions. Some indexing techniques, structure-
GDBMS are multi-model which aware indexing and attribute-aware
supports graph data model, key indexing to process graph matching
value and document for example for property graph.
OrientDB. It uses indexing Index Graph patterns are a
algorithms like SB-Tree [16]. All of pointer based data structure that
these value based indexes, Neo4j’s
stores for the reference of graph
efficacy is less than OrientDB on patterns. Several number of graph
some of its nodes. So it is patterns are found on different
recommended for large number of GraphDBs. Index graph have
nodes to use OrientDB [17].
different values for patterns that is
In Structure-Based Indexing the based on the kind of data which is
structure-based indexing is used to stored in GraphDB, and use cases
index and extract structural are included in these graph patterns.
properties of GraphDB, generally at One of the most popular graph
the time of insertion and in response pattern, defined as
to a query. Many methods take path GP = (Vp; Ep), where V = {v1; v2;
for example SPath algorithm [18], v3} and E = {(v1; v2); (v2; v3); (v3;
which focus on a path-based
v1)}, is called a triangle. In Cipher
technique for indexing for local triangle can be described in a few
nodes in G in order to transform a different ways, for example
query graph into a set of a shortest
path for query processing. Srinivasa (n1) - [r1] - (n2) - [r2] - (n3) - [r3] -
distinguishes [19] three type of (n1)

UMT Artificial Intelligence Review


28 Volume 2 Issue 1, Spring 2022
Kaleem et al.

Fig. 2. Cipher triangle


Figure 2 shows a social group. the user’s requirements. Cypher
To retrieve that kind of a pattern is [23] a Declarative Query Language
easy for Neo4j. But the problem (Dql) similar to Structured Query
arises when we focus on structural Language (Sql), but Dql is
features of the graph and require all optimized for GraphDB. And now
the triangle who has friendship this language is used by SAP
features in them. In that kind of case HANA [24]. RedisGraph [25] and
structural-based indexing is more Open-Cypher [26], Cypher Queries
suitable. are available at Neo4j [27].
B. Query Processing The following example of
Cypher Query [12], carried out to
Neo4j [3] is an open source
return all the number of tokens that
NoSql language. It stores the data in
have been sent on “Address” with
nodes and edges format. Nodes are
transactions. These transactions
the entities in GraphDB that store
include the chain extended from a
attributes. For fast query processing
block of hash.
results Neo4j offers multiple
libraries [22]. With almost zero MATCH (b:Block{hash:Hash}) -
coding, these algorithms can reveal [:CHILD_OF*0…] -> () - [K] –
the hidden patterns in GraphDB. (t:Transactions) - [:TO] ->
These features makes Neo4j an (u:Users{hex:’Address’})
ideal tool for analyzing and
visualizing the data in blockchain RETURN SUM(t.amount)
ledgers. Moreover, Neo4j offers Unlike the classical structure of
multiple graph models to support the blockchain, these GraphDB

Department of Information Systems


29
Volume 2 Issue 1, Spring 2022
Role of GraphDB…

models allows bidirectional pass Returns all separate pairs of


over of entities in the requested votes; v1 and v2, sent by the same
path. With the help of Neo4j, we validator, where one vote is inside
can analyze and evaluate just by the span of the other.
looking at the execution plan of the The above queries, are not for a
query. In case of any Casper's [28] specific branch, these are for the
event, Casper's usefulness is based whole blockchain tree.
on its capacity to detect and
penalize bad validators who took C. Transaction Management
advantage of any vulnerability. We Cypher is a query language that
reward network nodes to track and based on patterns, and cypher is
report those in our Casper-like specially designed to recognize
protocol. Criminals by providing these patterns. Common keywords
cash incentives in the event of a in cypher are, MATCH, WHERE
well-executed slashing and RETURN. These keywords are
Furthermore, any evidence in similar to Sql but with a slight
support of a rule any node may difference, although they are very
detect and recover from a breach similar. There are 4 properties of
since they are all connected. Transaction Management by using
MATCH (v1:Vote), (v2:Vote) Neo4j GraphDB. ACID are
WHERE v1.r_from = v2.r_from described below,
AND v1.target_height = 1. Atomicity: in case of any
v2.target_height AND ID(v1) < transaction failure, data is left
ID(v2) RETURN v1.r_from, v1, v2 unchanged.
Returns all separate pairs of 2. Consistency: all the transaction
votes, v1 and v2, submitted by the will leave the database in a
same validator with targets at the consistent state.
same height. 3. Isolation: similar to locking
technique, during the
MATCH (v1:Vote), (v2:Vote) transaction data cannot be
WHERE v1.r_from = v2.r_from accessed by any other
AND v1.target_height > operations.
v2.target_height AND 4. Durability: The database
v1.source_height < management system can
v2.source_height AND NOT recover the results of a
ID(v1) = ID(v2) RETURN committed transaction.
v1.r_from, v1, v2

UMT Artificial Intelligence Review


30 Volume 2 Issue 1, Spring 2022
Kaleem et al.

Transaction Management in data node should have a start


Neo4j [29], code in java is available node and end note. It means that
at Github [30]. According to Neo4j, if we try to delete a node that
there are 7 steps to manage a still has a relationship with
transaction in GraphDB. another node, it will throw an
exception.
1. Interaction cycle ensures that it
6. Creating unique Nodes, certain
fulfil ACID properties or not,
level of uniqueness is required
for example begin a transaction,
in nodes. To ensure this there
performing a database operation
are two techniques to ensure the
and commit or roll back in
techniques, single thread and
transaction.
get or create.
2. Isolation levels, it means that if
7. Transaction Event, it notified in
the transaction is under process
case of any transaction event in
it is not available for other
GraphDB through a Transaction
processes until it’s completely
Event Listener [32].
committed.
3. Default Locking behavior. It is D. Data Management
similar to relational database. Decentralized nature of
4. Deadlock. Neo4j can detect any blockchain allows data to be
before they even happen and accessed within the organization
throw an exception, Deadlock easily. Following figure describes
code is available at Github [31].
how data is managed in GraphDB.
5. Delete Semantics, Neo4j
provide semantics that every

Fig. 3. Data management

Department of Information Systems


31
Volume 2 Issue 1, Spring 2022
Role of GraphDB…

Benefits of Blockchain for Data can easily notice any kind of


Management irregularities as they occur and
they can be viewed.
1. Data Security: blockchain uses
5. Data Sharing: blockchain nature
hash values which is
allows data to be shared within
irreversible conversion of data,
the organization easily and
it provide maximum level of
permissions can be set to whom
security as compared to any
can read or edit the data.
encryption algorithms.
2. Data Quality: data is stored in Following are the studies and
edges and if any data is entered tools to build and manage the data
into the ledger, it is analyzed in ledger [33]-[36].
and cross-checked before it
E. Data Distribution
stored in the database.
3. Data Traceability: data can be According to Jim Webber chief
traced through tokens and as scientist of Neo4j states that, Neo4j
blockchain is linear, an is going distributed in GraphDB
historical chain of events can be [37]. For scalability Neo4j has a
followed easily. limit. With the launch of 4.0 Neo4j
4. Real-Time Data Analysis: due is going to be distributed GraphDB.
to blockchain nature, businesses

Fig. 4. Data distribution [38]

UMT Artificial Intelligence Review


32 Volume 2 Issue 1, Spring 2022
Kaleem et al.

With Neo4j, Webber says the this. Data Management section


customer has to decide how to spilt- describes how data is stored and
up or share their data into a managed in database. This study
distributed environment, or sub- also provided solution in how to
GraphDB. But in a Fabric server, build and manage the data in
they can be queried as a single GrpahDB blockchain.
entity. Neo4j is following
References
MongoDB [39] model for this. In [1] H. Stevens, “Hans Peter Luhn
this model, customers can split their and the birth of the hashing
data as per their business function algorithm,” IEEE Spectr., vol.
and geographical region 55, no. 2, pp. 44-49, Feb. 2018,
requirement. doi:
IV. Conclusion https://doi.org/10.1109/MSPE
The study highlighted the C.2018.8278136
features of GraphDB in financial [2] Satoshi Nakamoto, “Bitcoin: A
technologies. GraphDB stores data peer-to-peer electronic cash
in nodes and edges. Nodes stores system," Decen. Bus. Rev., Art.
data entities and edges stores no. 21260,” 2008.
relationship between entities. The [3] Neo4j, “The graph data
study has provided Hashing and platform for today's intelligent
Indexing techniques for GrpahDB applications,” Neo4j.
in blockchain. There are two types
https://neo4j.com/ (accessed
of Hashing, the first is value-based Jan. 23, 2022).
which uses Cypher query language,
and the second structure based [4] M. A. Rodriguez and P.
which uses SPath algorithm. The Neubauer, “Constructions
study then presented how queries from dots and lines,” Bull. Am.
are performed in GraphDB Soc. Inf. Sci. Technol., vol. 36,
blockchain. For query processing, no. 6, pp. 35–41, 2010, doi:
Neo4j has provided multiple https://doi.org/10.1002/bult.20
libraries, unlike traditional 10.1720360610
databases GrpahDB allows [5] M. Shkoukani and A. M.
bidirectional passes between Altamimi, “Graph Database
entities. In the transaction Security: Blockchain Solution
management section, the cypher and Open Challenges,” Int. J.
query language is used to recognize Simul.-Sys. Sci. Technol., vol.
patterns, Java code is available for 21, no.1, pp. 1-7, 2020, doi:
Department of Information Systems
33
Volume 2 Issue 1, Spring 2022
Role of GraphDB…

https://doi.org/10.5013/IJSSS Consumer Elec. Commun.


T.a.21.01.09 Net., Nov. 2013, pp. 533-536.
[6] V. Buterin, "Ethereum white [11] R. Angles, "A comparison of
paper," GitHub Repos., no. 1, current graph database
pp. 22-23, 2013. modelsm," in 2012 IEEE 28th
[7] AWS, “What is hyperledger Int. Conf. Data Eng.
Workshops, pp. 171-177, April
fabric?,” AWS.
1-5, 2012, doi:
https://www.ibm.com/topics/h
https://doi.org/10.1109/ICDE
yperledger (accessed Jan. 23,
W.2012.31
2022).
[12] Y. Tang et al., “Graph
[8] S. Medhi and H. K. Baruah,
database-based knowledge
“Relational database and graph
graph storage and query for
database: A comparative
power equipment
analysis,” J. Process Manag.
management,” in 2020 12th
New Technol., vol. 5, no. 2, pp.
1–9, 2017, doi: IEEE PES Asia-Pacific Power
Energy Eng. Conf. (APPEEC),
https://doi.org/10.5937/joupro
Sep. 2020, pp. 1–5. doi:
man5-13553
https://doi.org/10.1109/APPE
[9] A. Martínez Porras, R. A. EC48164.2020.9220382
Mora Rodríguez, D. Alvarado
[13] Blockchain, “Blocks-size,”
González, G. López Herrera,
Blockchain.com.
and S. Quirós Barrantes, “A
https://www.blockchain.com/e
Comparison between a
l/charts/blocks-size (accessed
relational database and a graph
Feb. 13, 2022).
database in the context of a
Personalized Cancer [14] J. Pokorný, M. Valenta, and J.
Treatment Application,” Ramba, “Graph Patterns
Alberto Mendelzon Int. Indexes: their Storage and
Workshop Found. Data Retrieval,” in Proc. 20th Int.
Manag., vol. 1644, 2016. Conf. Inf. Integ. Web-based
Appl. Serv., New York, USA,
[10] H. Huang and Z. Dong,
Nov. 2018, pp. 221–225. doi:
"Research on architecture and
https://doi.oeg/10.1145/32823
query performance based on
73.3282374
distributed graph database
Neo4j," in 2013 3rd Int. Conf. [15] J. Pokorný and M. Troup,
"Indexing Patterns in Graph
UMT Artificial Intelligence Review
34 Volume 2 Issue 1, Spring 2022
Kaleem et al.

Databases," in Proc. 7th Int. https://doi.org/10.4018/978-1-


Conf. Data Sci. Technol. 61350-053-8.ch003
Appli., 2018, pp. 313-321, doi: [20] X. Yan and J. Han, "Graph
https://doi.org/10.5220/00068 Indexing," in Managing and
26903130321
mining graph data. Advances
[16] P. E. O’Neil, “TheSB-tree an in database systems, C.
index-sequential structure for Aggarwal and H. Wang, Eds.,
high-performance sequential Boston, MA, Springer, 2010,
access,” Acta Inform., vol. 29, doi:
no. 3, pp. 241–265, Mar. 1992, https://doi.org/10.1007/978-1-
doi: 4419-6045-0_5
https://doi.org/10.1007/BF011 [21] H. Dinari, “A Survey on Graph
85680 Queries Processing:
[17] S. A. T. Mpinda, L. C. Ferreira, Techniques and Methods,” Int.
M. X. Ribeiro, and M. T. P. J. Comput. Netw. Inf. Secur.,
Santos, “Evaluation of graph vol. 9, no. 4, pp. 48–56, Apr.
databases performance through 2017, doi:
indexing techniques,” Int. J. https://doi.org/10.5815/ijcnis.2
Artif. Intell. Appl., vol. 6, no. 5, 017.04.06
pp. 87–98, Sep. 2015, doi: [22] M. Needham and A. E. Hodler,
https://doi.org/10.5121/ijaia.2
Graph Algorithms: Practical
015.6506
Examples in Apache Spark and
[18] D. Yuan and P. Mitra, "Lindex: Neo4j. USA: O’Reilly Media,
A lattice-based index for graph 2019.
databases," VLDB J. vol. 22, [23] O. Panzarino, Learning
pp. 229–252, 2013, doi: Cypher. Birmingham, UK:
https://doi.org/10.1007/s00778 Packt Publishing Ltd, 2014.
-012-0284-8
[24] SAP HANA loud, "In-Memory
[19] S. Srinivasa, "Data, storage Database,” SAP.
and index models for graph https://www.sap.com/products
databases," in Graph data /hana.html (accessed Feb. 13,
management: techniques and 2022).
applications, S. Sakr, E.
Pardede, Eds., India, IGI [25] Redis, “Fast graph processing
Global, 2012, pp. 47-70, doi: powered by linear algebra and
matrix multiplication,”
redis.com.
Department of Information Systems
35
Volume 2 Issue 1, Spring 2022
Role of GraphDB…

https://redis.com/modules/redi Management-of-GraphDB-in-
s-graph/ (accessed Feb. 13, Blockchain-Java-Code
2022). (accessed Feb. 13, 2022).
[26] OpenCypher, "What is [31] Neo4j, "About Neo4j
openCypher?,” documentation," Neo4j.
Opersypher.org. https://github.com/neo4j/neo4j
http://opencypher.org/ -
(accessed Feb. 13, 2022). documentation/blob/68a550e7
890a9f5328ff2ec4191cb764c5
[27] G. Walker, “How to import the
7b0500/kernel/src/test/java/ex
bitcoin blockchain into Neo4j
amples/DeadlockDocTest.java
[Community Post],” Neo4j
(accessed Feb. 14, 2022).
Graph Data Platform.
https://neo4j.com/blog/import- [32] Neo4j, “Interface
bitcoin-blockchain-neo4j/ TransactionEventListener<T>,
(accessed Feb. 13, 2022). " Neo4j.
https://neo4j.com/docs/java-
[28] V. Buterin and V. Griffith,
reference/4.4/javadocs/org/neo
“Casper the Friendly Finality
4j/graphdb/event/Transaction
Gadget,” ArXiv171009437 Cs,
Jan. 2019. [Online]. Available: EventListener.html (accessed
Feb. 14, 2022).
http://arxiv.org/abs/1710.0943
7 [33] Mongodb, “Blockchains,
ledgers, and databases: A
[29] Neo4j, “Transaction
guide to navigate the
management - Java
confusion,” MongoDB.
Reference,” Neo4j Graph
https://www.mongodb.com/co
Database Platform.
llateral/blockchains-ledgers-
https://neo4j.com/docs/java-
and-databases-a-guide-to-
reference/4.4/transaction-
navigate-the-confusion
management/ (accessed Feb.
(accessed Feb. 14, 2022).
13, 2022).
[34] R. Wattenhofer, The science of
[30] R. H. Kaleem,
the blockchain, Inverted Forest
"RaoHassanKaleem/Transacti
Publishing, 2016.
on-Management-of-GraphDB-
in-Blockchain-Java-Code," [35] IDC, “Blockchain — A data
Github. management, integration, and
https://github.com/RaoHassan integrity disruptor?,” IDC: The
Kaleem/Transaction- premier global market
UMT Artificial Intelligence Review
36 Volume 2 Issue 1, Spring 2022
Kaleem et al.

intelligence company. [38] Datanami, “Neo4j going


https://www.idc.com/getdoc.js distributed with graph database,”
p?containerId=US42074217 Datanami,
(accessed Feb. 14, 2022). https://www.datanami.com/2020/0
2/04/neo4j-going-distributed-with-
[36] DLACM, “Graph Chain – A
graph-database/ (accessed Feb. 20,
distributed database with
2022).
explicit semantics and chained
[39] MongoDB, “MongoDB: The
rdf graphs,” DLACM Digital
application data platform,”
Library.
https://dl.acm.org/doi/fullHtml MongoDB.
https://www.mongodb.com
/10.1145/3184558.3191554
(accessed Feb. 20, 2022).
[37] Neo4j, “Neo4j going
distributed with graph
database,” Neo4j Graph Data
Platform.
https://neo4j.com/news/neo4j-
going-distributed-with-graph-
database/ (accessed Feb. 20,
2022).

Department of Information Systems


37
Volume 2 Issue 1, Spring 2022

You might also like