RelationService — Why is Graph Database important for Next.ID?
2023-05-08 14:43
Next.ID
2023-05-08 14:43
订阅此专栏
收藏此文章

RelationService — Why is Graph Database important for Next.ID?

Introduction

Next.ID is a decentralized identity (DID) protocol that integrates all Web2 and Web3 digital identities, aggregating them together into an “Avatar”. This service is used to power decentralized social networks.

In the context of Next.ID’s RelationService, Graph Databases are crucial for supporting a full range of identity queries and social use cases. Graph Databases focus on relationships between data, making them a better option when dealing with complex relationships between intertwined data stored in multiple tables.

In this article, we will elaborate on how our understanding of Graph Databases influences our choice over other traditional Relational/SQL Databases.

Graph Database

What is a graph database?

A graph database is a database that focuses on relationships, i.e. Something — is related to — Something else

  • It is a class of NoSQL databases
  • Stores relationships, reflecting entity-to-entity relationships
  • Uses directional-based nodes to represent data, rather than rows and columns in a table

Below is a detailed description of what a graph database is, the features that make it different from other databases, and what types of data problems it is designed to solve. There are many different types of databases (Key-value, Document-Oriented, Column Clusters, Graphs, etc.). The main focus of comparison for this article is on the differences between Graph Databases and Relational Databases.

Graph Databases vs. Relational Databases

When do we use Graph Databases?

The term “Graph” is used to describe a collection of nodes, each containing information (attributes) and labeled relationships between nodes (edges). A good analogy would be to think of graphs as social networks. The individuals in the social network are the nodes, the characteristics of each individual (e.g, name, age, etc.) are the attributes, and the lines connecting the individuals (with labels such as “friend”, and “acquaintance”) represent their relationships.

In a traditional Relational/SQL Database, queries can take a long time to process because relationships are implemented with foreign keys and are queried by joining tables. In contrast, Graph Databases store relationships, reflecting entity-to-entity relationships, and use directional-based nodes to represent data, rather than rows and columns in a table. With Graph Databases, accessing related nodes is straightforward, and satisfying a query is a simple matter of “traversing” the graph.

Since Next.ID involves dealing with intricate relationships, the use of a Graph Database will be a more optimum solution.

Application of Graph Database in Next.ID

Graph databases, such as the one used by Next.ID, offers a powerful way to model, manipulate, and analyze data. By representing data as a series of interconnected nodes, edges, and attributes, these databases can effectively manage complex relationships and information.

Next.ID takes advantage of this technology to create a comprehensive personal identity graph, which incorporates both on-chain data like wallet IDs, transactions, and smart contracts, as well as off-chain data from platform accounts like Twitter, Facebook, and Github. This approach enables the seamless integration of various digital identities across different platforms and blockchain networks.

1. Data Model

The data model employed by Next.ID involves several steps.

Step 1 — Data is represented as a graph with direct relationships and two-way bindings

Step 2 — Individual nodes are selected, each carrying simple and distinct attributes.

Step 3 — Personal identity graph is built to consolidate various identities across platforms and contract addresses across different blockchains.

Step 4 — Relationships between nodes, relationships, and attributes are modeled to capture relevant connections.

2. Database — Append, Delete, Edit, Search

Managing a graph database involves performing basic operations such as creating, reading, updating, and deleting nodes, edges, and attributes. While writing data is relatively straightforward, reading can be memory-intensive, and the speed of querying results largely depends on the number and complexity of relationships. We aim to optimize these processes to ensure efficient and effective management of identity graphs.

Example: Identity Graph Management

This is a demo of a query search by Web3.bio (Web3 Search Engine), powered by NextID: digital assets linked to a domain name.

3. Data Analysis

3.1. Finding Fixed Patterns: Triadic Closures

Data analysis within Next.ID’s graph database focuses on various techniques, such as finding fixed patterns through triadic closures. This principle posits that two people with a mutual friend in a social network are more likely to become friends in the future.

3.2. Similarity Algorithms

Similarity Algorithms assign scores to pairs of vertices based on their similarity, which can help identify closely related identities.

3.3. Traversing through Path-Finding Algorithms

Path-Finding Algorithms explore routes between nodes, starting from a specific node and traversing through relationships until the destination is reached. This enables the discovery of the most efficient path in terms of the number of hops or weight.

The traversal starts from a specific “startNode” and follows all edges connected to that node, all the way to the “endNode”. Multiple iterations will be performed to find all possible solutions to the relationship.

https://docs.next.id/relation-service/rs-graphql#query-an-identity-w-its-relations-to-other-identities

4. Status of Identity Graph

https://web5.bio/?s=sujiyan.eth

RelationService — Next step to perform

1. Using RelationService to enrich relationships between Identity Graphs

E.g. Transactions of sending/receiving Red Packets with Mask Browser Extension on Ethereum

Red packet “Send” record

Red packet “Received_by” record

The initiator created 10 Red Packets, sending them to 2 different recipients, and formed an enriched relation graph amongst the 3 identities.

“Send” and “Received_by” are both relationship methods used to form a relationship between an identity and a contract. NextID takes this information to redefine and enrich social interactions.

2. Using RelationService for analytics

RelationService Analytics vs. Dune Analytics

Dune Analytics

Dune is a free blockchain analytics platform that allows users to find events associated with a specific address. It also allows you to see the amount of ETH transferred by the associated address. Dune makes it easy for users to transform blockchain data into actionable charts and metrics. Using Dune, anyone is able to query data from a dataset and create visualizations using the query output.

RelationService Analytics

Using RelationService Analytics, anyone can query data from a dataset and create visualizations using the queried output. Visualizations include but are not limited to linear and graphical charts. For example, if the project is more concerned about NFT-related communities, they can find active people from the available data and promote their friends or friends of friends. Anyone can query using our tool (and also customize the weights) according to their needs.

It is also possible to integrate community discovery, node classification, node hierarchy, graph classification, link prediction, and other analysis functions

Queries

Tables

Graphical Visualizations

In summary, Next.ID leverages the power of graph databases to model, manage, and analyze complex data sets. This technology enables the creation of comprehensive personal identity graphs, incorporating both on-chain and off-chain data to provide a holistic view of an individual’s digital presence. Through various data analysis techniques, Next.ID can identify patterns, similarities, and efficient paths within the graph database, enabling more accurate and actionable insights.

Intrigued? Find out more at docs.next.id or reach out to us at developer@next.id. Follow us on Twitter: @NextDotID

【免责声明】市场有风险,投资需谨慎。本文不构成投资建议,用户应考虑本文中的任何意见、观点或结论是否符合其特定状况。据此投资,责任自负。

在 App 打开
特朗普
空投
rwa
稳定币
babylon
以太坊
wayfinder
wct
morph
香港
hyperliquid
wal