Conceptualizing the Banyan Relay
Introducing the Banyan relay concept. A personal nostr relay built on web-of-trust to collect notes from your most trusted contacts using your engagement with others as a trust metric.
A personal relay ought to serve you first, and in defending your trusted network, it may serve your whole community. The relay I envision--Banyan, named for the tree which grows into a forest by setting down roots as its branches grow outward--embodies this principle. Banyan collects events from the Nostr network authored by those you trust, where trust itself emerges from the patterns of engagement between you and your closest peers, rather than manually (and often randomly) curated lists.
By aggregating this local universe of events, you gain a complete view of the conversations and the creations that matter to you. But you also give back: your relay becomes a stable archive for your most trusted contacts, acting as a steward for their notes as solemnly as your own. It becomes an anchor within an interconnected forest of trusted data. And as more people cultivate their own Banyan relays, a fascinating property emerges--the more widely you are trusted, the more relays hold your content, and the more resistant your voice becomes to suppression. What begins as a humble personal relay becomes impenetrable collective defense.
The Status Quo and Its Flaws
Nostr's current architecture ignores the social structure that produces its data. Relays depend on clients to supply events, and this dependency creates fractures in what users see: missing events, broken threads, and lost messages. Users have compensated for these gaps by connecting to many relays, and relays with the most data, which draws the network toward centralization despite its decentralized ideals. Caching relays and the "outbox model" attempt to mend this defragmentation by either embracing maximal centrality or decentrality, respectively. Caching relays operate under one ruler, and the outbox model overburdens clients. We need a solution that adopts the best of both approaches, a middle path.
The status quo is to treat relays as passive vessels for event storage and force clients to shoulder the burden of control--deciding which events to send and which to receive, performing their own filtering, calculating their own trust, and discovering their own content. This edge computing model has consequences: client codebases grow bloated and complex as they accept ever more responsibilities; development teams become less responsive to feedback as the code grows unwieldy; users find themselves unable to defend themselves against clients that introduce logic they oppose, with no recourse but to accept the new regime or seek refuge elsewhere. The pendulum has swung too far in its journey away from centralized control.
The problem of Trust lurks among these architectural failures. Open relays and file sharing services accept everything that arrives at their door: spam, scams, impersonations... and worse. Open to all; the very best, and the very worst humanity can offer. Filtered relays impose manual policies that transform them into niche tools that often only serve their operators. Whitelist approaches demand constant administrative attention, a burden that few wish to bear. We need a solution that doesn't treat Trust as an afterthought, but a foundational principle.
Nostr filters, the queries made by clients to request data from relays, seem sufficient at first glance, but fall short in the face of organic, highly connected data--the only kind of data that exists on Nostr. Consider the thread, a tree of replies that form a conversation. Anyone can easily identify a thread, and asking for one is as simple as, "give me all the conversations people are having under a note." But turning that question into a query on nostr either results in infinitely recursive filters--get the replies to this reply, then the replies to those, then the replies to those...--or forced coordination among clients to implement a naive hack, the 'root' tag, that ties each reply to its top note so they can all be found in one filter. When queries are necessarily complex, the data model is incorrect.
Every existing Nostr library ossifies the status quo through tight coupling among concerns. When you adopt an omnibus library, a do-everything toolkit, you inherit its entire philosophy whether you want it or not. If you desire the protocol handling, but different transport logic, you find them intertwined beyond separation. If you want different storage, but wish to keep the same filter parsing, you cannot have one without the other. The library is an indivisible monolith--take it, or leave it.
Composite Design, a method described by Glenford Myers in 1975, provides principles for evaluating software that reveal why this coupling matters so much. The methodology measures two essential qualities: module strength, which gauges how focused a piece of code is on a single purpose; and module coupling, which measures how dependent modules are on each other's internal workings. The strongest modules perform a single function with every internal element driving that function, and nothing more. The loosest coupling passes all data between modules in small, discrete chunks--no shared global state, no flags to toggle behavior, no hidden dependencies.
Strong modules with loose coupling makes programs resilient because any piece can be replaced without disturbing the whole. This principle applies fractally at every scale of software organization: from individual functions, classes, and packages; to entire code repositories, applications, and systems. When applied to library architecture, loose coupling means that developers can fork the specific functionality they disagree with, implement their own alternative, and compose it back into their apps. Composite library architecture shifts power back to developers, away from maintainers. Battles over software governance transform into battles over software implementation. Competitions fought in words become competitions fought in runtime. Abstract power shifts into Real power.
Trust is a Graph
You live within relationship networks that are centered around yourself, which grow through your interactions with your peers, and they with theirs. Trust is not an integer score you assign nor a boolean label you attach, but an emergent pattern that crystallizes from sustained engagement over time. Two people who consistently talk to each other, who boost each other's thoughts, who support each other's work--between them grows something that any observer can recognize: Trust.
The current architecture remains blind to this structure. It treats all content with equal indifference or applies arbitrary rules that bear no resemblance to social reality. People have worked around these limitations, finding each other despite the infrastructure, not because of it. Nostr has the potential to be fertile soil that encourages all life to flourish, but remains rough and stony ground, infested with pests, in which only the hardiest defiantly survive.
A personal relay ought to mirror personal reality. It should aggregate the data you trust automatically rather than blindly collect events from undifferentiated masses. If trust manifests as a graph structure, as connections between people and revealed by patterns of engagement, then the data storage must be graph-native to capture it faithfully. Relationships deserve to be first-class citizens in the data model rather than afterthoughts painstakingly extracted from inorganic structures. Nostr events should be stored as they actually exist: interconnected. Where they can form complex structures that reveal higher-order patterns like circles of trust and community boundaries.
The Banyan tree is dependent on the support of existing structures in its early life before it can mature to independence; so too is the Banyan relay dependent on the existing relay network in its initialization phase. Nostr works, and it has worked well enough to survive and flourish. But to continue evolving, the ecosystem needs entities that refine and strengthen the network by harnessing the power of trust and faith its users are pouring into it. Just a single Banyan relay can organize a trusted hub of data around its operator. More instances can lay their own roots, collecting and promoting trusted data across the network.
Why Graph-Native Storage is Essential
Nostr events are discrete cells that naturally stick to each other, immutable once signed, and attributable to their authors. Events signed by the same author cluster together via that common thread, and events also stick to whatever events and users they reference, forming complex structure through their relationships just as organisms form structure through their cells. This web of references creates a projection of relationship networks, with the social graph becoming visible through the data it produces. Events do not exist in isolation but within a rich context, surrounded by the relationships that give them meaning.
Table-based storage can represent this structure, but only awkwardly. Events go in one table, references in another, and the graph must be reconstructed through expensive joins at runtime. Key-value storage fares even worse, requiring application logic to traverse what should be natural pathways through the data. Neither approach provides the generic and performant graph structure the problem demands.
Neo4j, a mature graph-native database management system, physically models nodes and relationships on-disk as structures rather than indexed abstractions between disconnected structures. Nodes connect directly to each other physically in the storage medium, a feature called "index-free adjacency", which is the key factor in Neo4j's exceptional performance in dealing with highly connected data. It makes algorithms that would be impossible to execute in relational databases not merely possible, but efficient. Neo4j's query language, Cypher, doesn't require the developer to contort his thoughts to accommodate tabular logic, but mirrors ordinary, natural reasoning about relationships, letting the database serve him.
With graph storage, relationships become tangible things stored on-disk rather than abstractions reconstructed at runtime. You can traverse engagement paths directly, following connections from person to person, event to event, observing how information flows through the network with no computational overhead. Complex patterns emerge from the data that remain hidden in table-based storage: conversation threads branch like the roots of a tree, engagement patterns trace paths worn by repeated passage, and communities light up like bustling villages. These higher-order structures only become perceptible once the data exists in graph form.
Consider the problem of conversation threads, which has plagued clients since Nostr's early days. To assemble a single thread today either requires every client to carefully keep sight of the root note of the thread or to recursively query for each level of replies. Looking at any single event reveals nothing of its position in the chain, whether it sits near the surface or a dozen levels deep, whether it is worth presenting to the user or not.
Graph queries transform this laborious process into elegance. Subscribing to a thread becomes a single Cypher query: "Retrieve this event and all the events that reference it, recursively, returning the entire tree structure." One request that expresses what you actually want and a database that can fulfill it with ease. With graph-enabled Nostr filters, threads don't have to be dealt with as monoliths, and users can mute or subscribe to whole threads or sub-threads with ease.
The Trust Machine: How Banyan Works
Begin with your own npub, your unique public identifier, as the seed, a process that works best when you already possess history on the network. The relay collects your events from wherever they may be found, then gathers all the events that your events reference. New users face a bootstrapping problem, because starting a Banyan relay with no event history stored elsewhere provides nothing from which to expand. They may seed from an established user they trust or aggregate trusted content from other trusted content providers until their own interactions generate a trust network native to themselves.
Trust emerges from relationship patterns through directed "trust scores" calculated between users based on the types of their engagement: replies, boosts, reactions, zaps (Bitcoin lightning payments), etc. Different forms of engagement carry different weight according to the seed user's preferences. For example, you may choose to value zaps more than reactions, or quote replies more than boosts. The scores accumulate over time because trust emerges from sustained engagement rather than isolated interactions. Someone who replies to you once has demonstrated interest, perhaps, but not necessarily trustworthiness. Someone who you engage with regularly who engages back over weeks and months has woven themselves into the fabric of your network.
The balance between outgoing and incoming engagement reveals mutuality, that essential quality of genuine relationship. You might follow someone and zap all their notes without receiving anything in return; a one-directional flow that resembles admiration more than friendship. Someone may consistently reply to you, while you never respond back, still lopsided and unsatisfying. But when both parties consistently interact, when their engagement volleys back and forth over time, the pattern signals reciprocity, a strong proxy for trust. Engagement captures what follow-based reputation scores miss because popularity is only a weak proxy for trust. Ten thousand follows only means that ten thousand people placed that user in a list, whether because of trust or a whim, or even accident or by default. Engagement, on the other hand, is based on proof of real effort between peers to form trusted relationships.
Continue by identifying your most trusted peers based on high engagement balance and volume: people you engage with who engage back consistently over time. Those peers represent your primary trust circle and become secondary seeds in the relay. Re-run the trust calculation using each secondary seed, collecting all of their events and those they reference, and find their most trusted peers. This once-removed set of users represent your secondary trust circle, and together with the primary circle, form your "personal universe" of users whose content matters to you. The algorithm could expand to tertiary trust circles and beyond, though most likely with diminishing returns.
The relay then actively aggregates events from those trusted users, seeking them out wherever they exist across the wider ecosystem. This self-population requires no manual configuration beyond the initial setup and imposes little ongoing administrative burden. The trust boundary itself acts as a natural filter against spam and malice. Actors outside the boundary remain invisible to the users of the relay by design, entering only by the combined effort of yourself and your primary trust circle. You benefit from all the diverse methods your peers use to discover and cultivate new trusted relationships.
The set of trusted users is roughly bounded and stable, but able to grow or shrink slowly as relationships develop or degrade. The incoming event stream grows the database linearly and predictably, making the relay infrastructure much more manageable than that of public or paid relays. Users who value sophisticated curation and possess basic server skills can provide stable relay service to their trusted circle--people they would help regardless.
The Banyan Forest
Public relays optimize for censorship resistance by allowing events to be published and requested by anyone. Banyan relays optimize for discoverability and relevance, helping you find what matters most within your trust network, surfacing the conversations you care about, filtering noise without manual curation. Many other kinds of relays exist, each serving a specific purpose. The diversity of relays makes the ecosystem as a whole thrive.
Although a single Banyan relay is powerful on its own, many Banyan instances offer greater benefits still. You trust Alice; Bob trusts Alice; both your relay and Bob's relay contain Alice's content. That overlap provides resilience—if one relay fails, the other maintains access. If you are trusted by many other Banyan relay runners, your notes will appear in their relays, backed up without any explicit coordination. Censorship-resistance emerges from the bottom up and strengthens as more relays come online.
Within an ecosystem of diverse relays, Banyan relays serve as hubs of trusted events authored by trusted users. As instances multiply, they will find themselves positioned in distinct communities, with perhaps only a few users bridging between them. Discoverability is a persistent problem on Nostr; relevant content is hard to find. Banyan relays can potentially surface high-quality, trusted content from beyond the bounds of your personal universe—content vouched for by the trust networks of adjacent communities.
Banyan relays can also improve network health by distributing events, not just collecting them. What is commonly referred to as the "outbox model" can be effectively managed by a Banyan relay, which sends events mentioning specific trusted peers to the relays where those peers expect to find them. Your relay becomes both a consumer and a contributor to the broader network, pulling in what matters to you and pushing out what matters to others.
People Can Solve What Technology Can't
Trust as determined by engagement patterns is not infallible, and people can always be fooled. A bad actor might cultivate engagement specifically to infiltrate trust networks, and a trusted friend might change in ways that take time to recognize. Rather than attempt to solve these human problems through algorithmic detection, the philosophy behind this project is that human problems deserve human solutions. Banyan provides an environment where cultural solutions can flourish.
Unfollowing, muting, and reporting remain actions that users take according to their own judgement. When someone in your trust network betrays that trust, you can handle it as you would in any community: you cease engagement, you warn others, you remove them from your circle. Human society has accumulated thousands of years of wisdom about dealing with bad actors through reputation, consequence, and collective memory. These mechanisms work. Technology should support them rather than presume to replace them.
Governance-Minimized Architecture
It is the responsibility of a developer in a decentralized system to diminish his own tyrannical power over it, lest it corrupt him and the system he sought to cultivate. Building omnibus libraries is such a manifestation of power because every developer that adopts them is forced to adopt the whole of the library maintainer's policies, whether they suit their needs or not. The governance systems of open-source libraries consist of arbitrary policies for code review and approval that can be changed at a whim, which often manifest as onerous and shifting hoops contributors must jump through. Large, monolithic libraries and projects are also susceptible to exploitation and abuse due to complicated codebases and tightly controlled governance structures.
By separating concerns into single-minded, focused libraries that are minimally coupled, a library developer can grant optionality and power to the developers who opt to use them. Cultivating systems that empower users begins with creating libraries that empower developers who build on them.
Single-minded libraries, focused on one concern each, with minimal dependencies among themselves, make forking and replacing dependencies with alternative versions more viable than opening pull requests to change the original. If you disagree with the policy of a specific functionality in the library ecosystem, you need only fork it, implement your alternative, and compose the alternative back into your application. This ability of developers to bypass repository governance frees them from the burden of asking permission to alter their dependency stack.
The Banyan relay and its library dependencies will follow this governance-minimized architecture. The proposed architecture consists of three layers: the consensus layer, the basic implementation layer, and the advanced extension layer. The consensus layer (roots, roots-ws) consists of core-protocol libraries that only define the bare minimum set of logic that all downstream developers must agree on, and no more. In Banyan's case, the core nostr library, roots, includes event structure, serialization, cryptographic signatures, and subscription filter structures. roots-ws provides similar primitives for Nostr's WebSocket transport layer.
The basic implementation layer consists of libraries that depend on the consensus layer and provide feature complete solutions to core functionality required by applications. In Banyan's case, there are two basic implementation libraries: event storage (heartwood, sapwood) and event transport (honeybee). The basic implementation libraries are called "basic" because they offer simplicity as a feature: straightforward and practical implementations that serve most use cases.
The last layer, the advanced extension layer, consists of libraries that extend basic libraries with advanced functionality (mana-prefixed libraries). These libraries add necessary complexity to provide optimizations, handle edge cases, and implement custom functionality required by specialty applications by providing drop-in replacements to their basic library counterparts. This layer is of the most crucial importance to the infrastructure, because without them, the basic implementation libraries would inevitably become bloated and complex as their consumers demand more functionality. Library bloat increases the burden on maintainers to control what changes are made to an ever-growing repository and leads to the formation of cumbersome governance systems. By shifting complexity into higher-layer libraries, the need for excessive governance never arises.
Library separation at the repository level is also resistant to exploitation and abuse, as injecting malicious changes into one library has little to no impact on the rest. Developers can easily use earlier versions or clean forks. The proposed changes are easy to see because the libraries are so small and focused. It's much easier to hide malicious updates in a tangled web of interrelated code, where their consequences are obscured. The architecture hamstrings those who would attempt to control a library using its bloated code and governance system and empowers developers, who can develop permissionlessly on forks and settle on the best alternatives rather than every alternative fighting for a place in a monolith in GitHub Issues.
The field of battle in the governance-minimized architecture shifts from argument to implementation. Loose coupling between tightly focused libraries means application developers can swap implementations freely and easily. This forces library maintainers to remain responsive or watch their adoption fade. It is a form of "voting with your feet," where developers can cherry-pick the functionality that best suits their needs. Competition among small libraries replaces arguments over issues and pull requests.
Conclusion
The Banyan relay is not a replacement for the existing relay network, but a symbiont that strengthens it. Public relays will continue to serve their essential purpose: ensuring that anyone can publish and that content survives attempts at suppression. Banyan relays serve a different purpose, organizing the network's abundance into personal relevance, surfacing what matters while letting the rest remain accessible elsewhere. The two approaches complement each other.
What begins as a personal tool becomes collective infrastructure through natural multiplication. Each relay serves its operator first, yet in doing so, it archives the work of trusted peers, distributes their events to where they belong, and adds one more node to an interconnected canopy of curated data. The more relays that take root, the more resilient this canopy becomes--not through central coordination, but through the accumulated choices of individuals tending their own corners of the network.
This is the vision: a forest of Banyan relays, each one anchored in its operator's trust network, each one contributing to a whole greater than itself. The architecture exists to make this possible. The trust machine exists to make it automatic. And the humans at the center exist to do what only humans can do: decide who deserves their trust and what deserves their attention.