The Social Layer
Explore how Refract builds a rich, queryable social graph and the data models that power it.
Concept: The Social Layer
Web3 is inherently social, yet most applications lack the tools to understand or leverage the relationships between their users. Refract addresses this by building a rich Social Graph at the infrastructure level. This graph is not just a feature; it’s a core data primitive that powers analytics, viral growth loops, and community-building tools.
The Social Graph Data Model
The Social Graph is constructed automatically as users interact with Magic dApp Links. It is primarily composed of two entities—Users
and DApps
—and the relationships that connect them.
Core Data Models
-
User
: Represents an individual on the Refract Network.userId
: The primary key. A unique, stable Refract Network ID generated upon first contact.tiktokId
,telegramId
, etc.: Nullable, platform-specific identifiers.displayName
,profilePhotoUrl
,username
: Social profile information, synced from the primary source platform.
-
DApp
: Represents a developer’s application registered on the Refract Portal.dAppId
: The primary key. A unique string identifier set by the developer.dAppName
,description
,category
: Metadata about the application.developerId
: Links to the developer or organization account on Refract.
The REFERRED_BY
Relationship
This is the most critical relationship in the Social Graph. It is a directed edge created when a new user (the referee) joins through another user’s (the referrer’s) Magic dApp Link.
(Referee:User)-[:REFERRED_BY {metadata}]->(Referrer:User)
This relationship edge contains crucial metadata:
timestamp
: When the referral occurred.dAppId
: The specific dApp for which the referral is valid.sourcePlatform
: Where the link was clicked (e.g.,tiktok
,telegram
).depthLevel
: The level in the referral chain (1 for a direct referral, 2 for a referral-of-a-referral, and so on). This allows for tracking the full viral cascade.
Refract Nexus: The Social Graph Engine
Refract Nexus is the backend engine that ingests, processes, and serves this social graph data. It is not just a database; it is a live system that provides the foundation for other Refract services.
- For Refract Insights: Nexus provides the raw relationship data that allows the Insights engine to calculate social-based metrics, identify key influencers within a dApp’s community, and map viral growth patterns.
- For Refract Quest: The Quest engine can use Nexus to define referral-based triggers. For example, a dApp could create a quest that rewards users for “successfully referring 3 friends” or for “achieving a referral chain depth of 5.” Nexus provides the real-time data to validate these conditions.
By building this social layer directly into our infrastructure, we provide dApps with powerful, out-of-the-box tools for community analysis and growth that would otherwise require significant engineering effort to build.