From ca208432099b79da8951ca894fb63c5ea92ca174 Mon Sep 17 00:00:00 2001 From: 0ceanSlim Date: Mon, 22 Jul 2024 15:33:54 -0400 Subject: [PATCH] readme updated --- go.mod | 4 +-- go.sum | 1 + readme.md | 84 +++++++++++++++++-------------------------------------- 3 files changed, 28 insertions(+), 61 deletions(-) diff --git a/go.mod b/go.mod index 0e2d871..c24361a 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,13 @@ module grain go 1.22.2 require ( + github.com/btcsuite/btcd/btcec/v2 v2.3.4 go.mongodb.org/mongo-driver v1.16.0 golang.org/x/net v0.27.0 + gopkg.in/yaml.v2 v2.4.0 ) require ( - github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect @@ -22,5 +23,4 @@ require ( golang.org/x/crypto v0.25.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/text v0.16.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 41f4529..a852686 100644 --- a/go.sum +++ b/go.sum @@ -58,6 +58,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/readme.md b/readme.md index 8d3a883..5f03a52 100644 --- a/readme.md +++ b/readme.md @@ -1,63 +1,25 @@ -# GRAIN 🌾 WIP - - -TODO: -- Handling kind 0 and kind 1 EVENTS - - Validation Checking - - updating (replacing replacable notes) -- Handle REQs (requests) -- Handle CLOSE +# GRAIN 🌾 **Go Relay Archetecture for Implementing Nostr** -GRAIN is an open-source Nostr relay implementation written in Go. This project aims to provide a robust and efficient Nostr relay that supports the NIP-01 protocol, focusing on processing user metadata and text notes. +GRAIN is an open-source Nostr relay implementation written in Go. This project aims to provide a robust and efficient Nostr relay that currently supports the NIP-01 of the nostr protocol. ## Features -- **NIP-01 Protocol Support**: GRAIN fully supports the NIP-01 protocol for WebSocket communication. +- **NIP-01 Protocol Support**: GRAIN fully supports the NIP-01 for WebSocket communication. - **Event Processing**: Handles events of kind 0 (user metadata) and kind 1 (text note). - **MongoDB 🍃**: Utilizes MongoDB to store and manage events efficiently. - **Scalability**: Built with Go, ensuring high performance and scalability. - **Open Source**: Licensed under the MIT License, making it free to use and modify. -## Installation +## Configuration 🍃 -1. **Clone the repository**: +Configuration options can be set through environment variables or a configuration file. - ```sh - git clone https://github.com/oceanslim/grain.git - cd grain - ``` +There is an example config in this repo. Copy the example config to config.yml to get started -2. **Build the executable**: - - ```sh - go build -o grain.exe - ``` - - The `grain.exe` will be placed in a temporary directory within `...\appdata\local\temp\go-build` and subdirectories. - -## Usage - -To run the GRAIN relay: - -```sh -./grain.exe -``` - -### Configuration 🍃 - -Configuration options can be set through environment variables or a configuration file. Example configuration: - -```yml -server: - port: 8080 -database: - type: mongodb - connection_string: mongodb://localhost:27017 - database_name: grain -logging: - level: info +```bash +cp config.example.yml config.yml ``` ### WebSocket Endpoints @@ -65,33 +27,37 @@ logging: - Connect: / - Clients can connect to this endpoint to start a WebSocket session. - Publish Event: Send events of kind 0 (user metadata) or kind 1 (text note) to the relay. +### TODO + +- Handle more kinds +- create whitelist/blacklist functionality + for: + - valid nip05 domain + - pubkey + - npub + - kind int + - kind 1 wordlist +- Rate limit Events + ### Development To contribute to GRAIN, follow these steps: 1. Fork the repository. -2. Create a new branch: - -```sh -git checkout -b feature-branch -``` - -3. Make your changes. -4. Commit your changes: +2. Make your changes. +3. Commit your changes: ```sh git commit -m "Description of changes" ``` -5. Push to the branch: +4. Push to the repo: ```sh -git push origin feature-branch +git push ``` -6. Create a Pull Request. - -### Contributing +5. Create a Pull Request. ### License