Relatr v0.1: Scaling Decentralized Trust
Today, we are releasing Relatr v0.1, with significant architectural improvements powered by the new Nostr Social Duck library. This update solves critical scaling challenges and makes running your own trust engine more accessible than ever.
Trust is not an absolute quantity. It is deeply personal, contextual, and always relative. In centralized systems, we have become accustomed to trust being imposed upon us by platforms and institutions, a "blue check" or a hidden algorithm deciding who is trustworthy for everyone.
But this model misunderstands the nature of trust, especially in decentralized systems like Nostr. Trust is a scaling solution, the fundamental mechanism that reduces friction in complex systems, allowing us to cooperate beyond our immediate relationships.
We built Relatr to reclaim this mechanism. Relatr is a service that anyone can run, computing trust scores based on the perspective of a specific source. It embraces the relative, dynamic, and layered nature of trust, empowering individuals and communities to define what trust means to them.
Today, we are releasing Relatr v0.1, with significant architectural improvements powered by the new Nostr Social Duck library. This update solves critical scaling challenges and makes running your own trust engine more accessible than ever.
A Transparent Algorithm
At its core, Relatr computes trust from a specific source public key perspective. Because decentralized networks like Nostr lack a global state, there is no "global reputation." Instead, we rely on social graph proximity together with objective validations. While Relatr includes some default validations like NIP-05 domain checks, relay lists, and Lightning address verification, among others, the system is fundamentally flexible. You can customize it with any validation rule, enabling highly specific trust models tailored to your needs.
If you are interested in learning more about how Relatr computes trust scores, the about page of the Relatr website is a good way to start. https://www.relatr.xyz/about
This flexibility enables Relatr to serve diverse use cases. Individuals might prioritize social connections, while businesses or communities can configure their instance to validate specific badges, memberships, or other criteria, effectively creating their own Web of Trust metrics based on their own standards. At its core, Relatr embraces the relativity of trust and context. We are still working to make custom validations more accessible and intuitive, but the framework is already extensible enough for anyone to create custom validation rules.
The Challenge
In our initial release, we used a combination of the nostr-social-graph library for social graph distance calculations and SQLite for profile metadata. While this worked well for looking up the score of single pubkeys, it struggled with search. Search is a much more nuanced operation than calculating a score for a given pubkey.
Consider a search for "Alex". This query could potentially return thousands of matches. To find the profiles relevant to you, we must filter and rank these thousands of candidates by their trust score, and then return the top results.
In our previous architecture, the "phone book" (names) and the "social map" (distances and validations) lived in separate systems. We had to fetch large batches of potential matches, calculate trust scores for each individually, and then sort them. This approach was inefficient and prone to making servers hang under load. Returning all potential matches is very expensive and inefficient, so we opted to add a multiplier to the search limit to keep computation under control. However, this limit approach was quite arbitrary: too few possible matches and we missed relevant people; too many or all matches, and performance and response times became unpredictable.
The Solution: Nostr Social Duck
We needed a way to improve this, to query metadata and social graph distance simultaneously while keeping resource requirements low. In other words, we had to shift the concept of the query from returning all matches from "Alex", to returning the most relevant "Alex". After some research, we found an answer that fits our needs.
Enter DuckDB.
DuckDB is an embedded, in-process SQL database designed for high-performance analytics. Crucially, it handles memory management gracefully. When a query requires more memory than is available, DuckDB spills to disk rather than crashing. This allows us to perform complex graph analysis on modest hardware.
We built Nostr Social Duck (NSD), a library that leverages DuckDB to perform graph operations over Nostr data. If you are interested in learning more about NSD, you can visit its repository, and read this introductory note
With this in place, we could move both the social graph and profile metadata into a unified DuckDB instance, transforming the search problem. Now, in a single SQL query we can:
Find profiles matching "Alex" across metadata fields Calculate their social distance from the source key Apply validation criteria Return ranked results
This unified approach allows us to pre-rank and return the most relevant results from the entire dataset in milliseconds, not just a random subset.
Performance and Accessibility
One of our core goals is to ensure Relatr can be self-hosted by anyone, not just those with powerful servers.
The results of this refactor have been excellent. Our public Relatr instance currently runs on a $4 VPS. Even on this constrained hardware, it can handle hundreds of requests per minute with graceful performance degradation. We conducted some naive benchmarking and stress testing, achieving ~30ms response times for searches under normal load and ~300ms response times during peak stress periods. In the other hand the pubkey lookup method demonstrated response times from ~2ms under normal load, to ~30ms under heavy load.
This efficiency makes the results feel instant and can satisfy various application use cases, such as tagging and quick search, among others. Additionally, you can deploy your own trust engine on almost any hardware, including a Raspberry Pi, an Umbrel node, a low-cost cloud server, or even a phone, without significant expense and with reasonable responsiveness. The disk requirements are also quite low; currently, our public instance, which contains more than 300k relationships, along with profile metadata and validations, uses just ~200MB.
Ecosystem Adoption and Use Cases
We cannot conclude this article without mentioning the community's response to Relatr, which is already being integrated into several projects:
Nostrudel: Uses Relatr for username search and tagging Profilestr: Aggregates Relatr scores with other metrics like their own, and Vertex for unified reputation views Zap-Work: Leverages Relatr to compute trust scores for user interactions in their job marketplace AQSTR: Uses Relatr for engagement and reward platform scoring
Thanks to everyone integrating and using Relatr ๐ This adoption validates our belief that the ecosystem needs diverse, interoperable trust models. The potential use cases for Web of Trust on Nostr are extensive, and Relatr's self-hostable design makes it ideal for integration into clients for personalized scoring, tagging, search, and recommendations, among others.
We're also participating in the #WoTathon organized by Nosfabrica, which is advancing important discussions around Web of Trust implementations. This initiative inspires us to integrate NIP-85 trusted assertions into Relatr, providing another interface for developers and users to leverage Relatr's capabilities.
Seamless Integration
We want to make it trivial for developers to add "Web of Trust" features to their apps.
With CtxCn, integrating Relatr is as simple as running one command in your project:
npx @contextvm/ctxcn add
This generates a fully-typed, readable TypeScript client directly in your codebase. You own the code, it's easy to maintain, and it connects immediately to the specified Relatr instance.
But you're not limited to TypeScript. Relatr uses the ContextVM protocol, so in practice, if you can call a DVM, you can call any Relatr instance. The interaction follows a simple Nostr event pattern that works with any programming language.
To call Relatr tools like search_profiles or calculate_trust_score, you send a Nostr event of kind 25910 containing a request. The event must tag the Relatr instance's pubkey and include your call in the content field.
Example request structure:
{ "kind": 25910, "tags": [["p", ""]], "content": { "jsonrpc": "2.0", "id": "your-request-id", "method": "tools/call", "params": { "name": "search_profiles", "arguments": {"query": "jack"} } } }
Note: The content field should be stringified.
Listening for responses: Responses come as Nostr events from the Relatr instance, tagged with your pubkey. The response contains the result with trust-scored profiles and metrics.
Quick Testing with nak CLI
For quick testing, you can use the nak CLI tool:
Send a search request:
nak event -k 25910 -c '{"jsonrpc":"2.0","id":"test","method":"tools/call","params":{"name":"search_profiles","arguments":{"query":"jack"}}}' -t "p=750682303c9f0ddad75941b49edc9d46e3ed306b9ee3335338a21a3e404c5fa3" wss://relay.contextvm.org
Listen for responses:
nak req --stream -s "$(date +%s)" -k 25910 -p wss://relay.contextvm.org
Discover available tools:
nak event -k 25910 -c '{"jsonrpc":"2.0","id":"any-id","method":"tools/list"}' -t "p=750682303c9f0ddad75941b49edc9d46e3ed306b9ee3335338a21a3e404c5fa3" wss://relay.contextvm.org
This returns complete tool definitions with input/output schemas, so you know exactly what methods are available, which parameters to use, and what to expect in responses.
Note that the pubkey used in this examples are the public key of the public Relatr instance that we are running which is accessible to anyone and can also be used through https://relatr.xyz
If you want to learn more about the underlying ContextVM protocol, you can visit the ContextVM documentation.
Run Your Own Instance
Relatr is designed to be self-hostable and accessible. You can deploy it in multiple ways, we provide Docker images for easy deployment, you can have a Relatr instance running in minutes. For custom configurations or development, you can build Relatr from source. The project uses TypeScript and Bun, and the repository contains comprehensive documentation on configuration options, custom validation rules, and more.
Conclusion
Relatr represents more than just a tool for us, it is a statement that in a decentralized world, trust cannot be outsourced. It must be claimed as our own.
The evolution from our initial architecture to the current Nostr Social Duck-powered implementation marks significant progress in making trust metrics accessible, efficient, and scalable. With v0.1, we've established a foundation that empowers individuals, communities, and businesses to define their own trust models.
Looking ahead, we're focusing on several key enhancements. We're working to make validation customization more intuitive for non-developers, moving beyond the current approach that requires modifying Relatr's source code. Performance optimization remains a priority to ensure efficient operations across the board. We're actively incorporating community feedback and exploring the integration of NIP-85 trusted assertions to provide additional interfaces for developers. Additionally, we will expand our documentation to facilitate easier integration of Relatr into any Nostr application.
We're excited to see how the community adopts and builds upon these foundations and invite you to run your own instance, integrate Relatr into your projects, or contribute to the codebase.
Website: relatr.xyz GitHub: github.com/contextvm/relatr Nostr Social Duck: github.com/gzuuus/nostr-social-duck