Nostr & Decentralized Social

GrainNostr Relay for Operators Who Need Fine-Grained Control

A free, open-source Go relay for Nostr operators who want fine-grained control. Learn what Grain does, how to install it on Windows and how to use it safely.

Free Open source Windows: Yes v0.8.1 Updated 7 Oct 2026
9 min read Last update 7 Oct 2026 github.com/0ceanslim/grain

Grain is a free, open-source Nostr relay written in Go, built for server operators who want detailed control over how events are accepted, stored and served. If you run a relay for yourself, a community or a project and want it on a Windows machine, this page explains what the program does, how to install it and where it fits among other Nostr tools. Grain also ships as a complete Go client library, which matters mostly to developers rather than everyday users.

The program keeps events in MongoDB and is released under the MIT license, so you can read the code, modify it and reuse it under permissive terms. The project has seen recent code updates, and the current release is v0.8.1. Grain is a server-side tool rather than an app for posting notes, so plan your setup with that in mind.

02

What Is Grain and Who Is It For?

Grain is best understood as two tools in one package. The main product is a relay, a server that receives, stores and serves Nostr events. The second part is a Go client library for developers who want to build their own Nostr applications and need code for connections, publishing, subscriptions and signing.

The primary audience is operators: people who host infrastructure and care about exactly how their server behaves. If you want a relay that you can tune to match your policies, storage setup and traffic patterns, Grain is designed for that job. If you only want to read and post notes from your desktop, a client application will suit you better.

Developers form the second audience. Because the library covers pooling, broadcasting, filters and signing, a Go project can reuse those building blocks instead of writing them from scratch. That reuse is useful for prototypes, internal tools and experiments with the protocol.

03

How a Nostr Relay Fits Into the Network

Nostr is a protocol in which users publish signed events, and relays carry those events between people and applications. A relay does not own your account. Your identity is tied to your keys, and any relay that accepts your signed events can help distribute them. This is why operators can run relays independently and why users can publish to several of them at once.

In practice, a relay sits between clients and the wider network. Clients send events to it, ask it for events that match filters, and receive updates in real time. The relay decides what to store, how long to keep it and which requests to serve. Grain puts those decisions in the hands of the operator through its configuration.

Understanding this role explains why the program is less visible to end users than a client. Most people will never open a relay directly. They benefit from it when their favorite client loads faster, stays online longer or reaches content that other servers do not carry.

04

Practical Scenarios for Running a Relay on Windows

A common scenario is a small community relay. A group that wants a shared space for discussion can host its own server, set policies for what it stores and keep its members' activity within infrastructure it controls. A Windows desktop or small server can serve this purpose if the MongoDB backend is available and the machine stays online.

Another scenario is a development environment. A developer testing a Nostr client can run a local relay, watch how events move between clients and relays, and check how subscriptions behave before pushing code to a public server. Local testing like this shortens the feedback loop and keeps experiments private.

A third scenario is a relay used as one node among several. Operators who want redundancy can use the multi-relay features to broadcast events to more than one server, so a single outage does not silence the whole account. Plan backups and monitoring from the start, because a relay that stores events for others carries responsibility for that data.

05

Key features

Automatic Connection Pooling

Grain keeps connections to other relays in a pool and manages them automatically, so the software does not have to reopen links every time it needs to talk to a peer. This helps when your relay or client must stay in touch with several remote servers at the same time, without constant manual reconnection.

Multi-Relay Event Broadcasting

A published event can be sent to several relays at once, and Grain collects the results of each delivery. That combined view makes it easier to notice an upstream relay that is failing, without digging through raw logs for every attempt.

Subscriptions With Filters and Relay Hints

Applications can subscribe to events that match specific filters. Relay hints point the software toward the servers most likely to hold the events it needs, which cuts down on wasted queries and keeps subscriptions focused on useful results.

Event Signing With Private Keys

Events can be signed with a private key, and the signing layer is an interface that developers can extend with their own logic. Because the private key is central to your identity on Nostr, treat the machine that holds it with the same care you would give any credential.

Sessions and User Authentication

Grain supports user authentication and keeps sessions persistent, so a signed-in user does not need to authenticate again every time a connection restarts. This smooths out day-to-day use for operators who run the relay continuously.
06

Supported coins

Grain is built around the Nostr protocol, and its documentation names Nostr as the network it works with. As a relay, it stores and serves Nostr events rather than holding coins or tokens, so it is not a cryptocurrency wallet or exchange tool.

07

How to install Grain on Windows

  1. 1

    Get the Program From the Official Source

    Download only from the official website or the project's GitHub Releases page. Choose the Windows build or installer listed for the current version, which is v0.8.1 at the time of writing. Avoid copies on forums and file-sharing sites, because a modified binary could capture your private keys.

  2. 2

    Verify the File

    Compare the SHA-256 checksum of the downloaded file with the value published on the release page. If the project provides a signature, verify that as well. Do not run the file if the values do not match.

  3. 3

    Prepare a MongoDB Database

    Grain stores events in MongoDB, so set up a MongoDB instance that the program can reach before you start the relay. Make sure the database location, access rules and storage space match the amount of data you expect to keep.

  4. 4

    Run the Program

    Start grain.exe from the folder where you installed it. The program reads its configuration and launches the relay. Check the console output for connection messages and errors before you expose the server to other users.

  5. Optional: Set Up a Windows Service

    The full installation documentation describes running Grain as a system service on Windows with NSSM, which keeps the relay running after a reboot or logout. Follow that guide carefully, and test the service once before relying on it.

08

System requirements

  • A Windows build or installer for the current release
  • A reachable MongoDB database, since events are stored there
  • Enough disk space for the events you plan to keep
09

How to use Grain

Grain is a server, so using it means configuring it, starting it and checking that clients can reach it. The steps below assume you have already installed the program and set up a MongoDB database.

  1. Open the configuration and point it to your MongoDB instance.
  2. Decide which events and users your relay should accept, and set the rules that match your purpose.
  3. Start grain.exe and watch the console for startup messages and connection errors.
  4. Connect a Nostr client to the address your relay listens on and publish a test event.
  5. Subscribe with a simple filter from another client and confirm that the test event comes back.
  6. Check how the relay handles a second relay: if you use multi-relay broadcasting, confirm that delivery results appear as expected.
  7. Review logs regularly, back up your MongoDB data, and schedule updates when new releases appear.
10

Pros & cons

Pros
  • Free and released under the MIT license
  • Highly configurable, so operators can tune behavior to their needs
  • Stores events in MongoDB
  • Includes a Go client library for developers
  • Supports multi-relay broadcasting and subscription filters
  • Documentation covers running it as a service on Windows
Cons
  • Built primarily for relay operators, not for everyday users
  • Requires a MongoDB database to run
  • Configuration takes time to learn for beginners
  • The Go client library is aimed at developers who write code
  • Running it as a service on Windows needs an extra tool such as NSSM
11

Is Grain safe?

Grain handles signing with private keys, so treat it as a sensitive program. Download it only from the official GitHub repository or the project's official website, and compare the SHA-256 checksum with the value published on the release page before running it. If a signature is provided, verify it too. Never type your private key or seed phrase into a third-party website or a tool you did not install from a trusted source. Keep the machine running the relay patched and limit who can access it. Check the latest version on the official website before installing, since you should always run the most recent release that the project has published.

  • Official source only. Download from github.com/0ceanslim/grain. Ignore ads and lookalike domains.
  • Check the SHA-256. Compare the installer hash with the value the developer publishes before running it.
  • Never share your seed phrase. No developer, support agent or website — including CryptApps — will ever ask for it.
12

Alternatives

Most programs in the Nostr group of this catalog are clients, which means they are apps people use to read, write and manage their own notes and messages. Amethyst, Gossip and Vega fit that pattern, and Blockcore Notes focuses on following people in circles through a progressive web app. Grain works from the other side of the network. It is a relay that stores and distributes events, and it is meant for operators who want control over their server.

Command-line tools such as NAK and Nostr Commander RS are closer to Grain in spirit, since they suit people comfortable with a terminal. Nostr VPN addresses a different problem, creating a mesh network on top of Nostr signaling. If you want a relay you can run and configure yourself, Grain is the better fit. If you want a daily app, pick a client instead.

13

Specifications

Price
Free
Type
Open source
License
MIT
Latest version
v0.8.1
Last update
7 Oct 2026
Windows support
Yes (Windows build or installer)
Source code
github.com/0ceanslim/grain
14

Frequently asked questions

Yes. Grain is listed as free and open source, and it is released under the MIT license. You can download the Windows build or installer without paying a fee. Check the official GitHub repository for the current release and its files before installing.

Grain is primarily a Nostr relay for operators who need detailed control over how events are accepted, stored and served. It also includes a complete Go client library for developers building Nostr applications. Most everyday users will use a client app instead.

It can be, provided you download it from the official GitHub Releases page or the project website and verify the SHA-256 checksum before running it. Because the program handles private keys for signing, avoid copies from unofficial sources and never enter a seed phrase or private key on third-party sites.

Yes. Grain stores events in MongoDB, so you need a MongoDB instance that the program can connect to. Plan storage capacity and backups before you start the relay, because the database will grow as events accumulate.

The full installation documentation describes setting up Grain as a system service on Windows using NSSM. This keeps the relay running after reboots or logouts. Test the service carefully before relying on it for public traffic.

No. Grain is a relay and a developer library, not an app for writing or reading notes. To post and browse, connect a Nostr client such as Amethyst or Gossip to your relay or to other public relays.

A client lets a person sign in, write and read content. A relay receives and serves events for many clients. Grain focuses on the relay side, which is why operators, not everyday readers, are its main audience.

15

Verdict

Grain suits operators who want a configurable Nostr relay on Windows and developers who need a Go library for Nostr applications. It is free, MIT licensed and built around MongoDB storage, so it rewards people who are comfortable with servers and databases. If you only want a social app, a client will serve you better. For a relay you can shape to your own rules, Grain is worth a careful look.

Download now