readme updated

This commit is contained in:
0ceanSlim 2024-07-22 15:33:54 -04:00
parent a7773d0041
commit ca20843209
3 changed files with 28 additions and 61 deletions

4
go.mod
View File

@ -3,12 +3,13 @@ module grain
go 1.22.2 go 1.22.2
require ( require (
github.com/btcsuite/btcd/btcec/v2 v2.3.4
go.mongodb.org/mongo-driver v1.16.0 go.mongodb.org/mongo-driver v1.16.0
golang.org/x/net v0.27.0 golang.org/x/net v0.27.0
gopkg.in/yaml.v2 v2.4.0
) )
require ( require (
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // 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/crypto/blake256 v1.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // 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/crypto v0.25.0 // indirect
golang.org/x/sync v0.7.0 // indirect golang.org/x/sync v0.7.0 // indirect
golang.org/x/text v0.16.0 // indirect golang.org/x/text v0.16.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
) )

1
go.sum
View File

@ -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.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/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= 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/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 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=

View File

@ -1,63 +1,25 @@
# GRAIN 🌾 WIP # GRAIN 🌾
TODO:
- Handling kind 0 and kind 1 EVENTS
- Validation Checking
- updating (replacing replacable notes)
- Handle REQs (requests)
- Handle CLOSE
**Go Relay Archetecture for Implementing Nostr** **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 ## 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). - **Event Processing**: Handles events of kind 0 (user metadata) and kind 1 (text note).
- **MongoDB 🍃**: Utilizes MongoDB to store and manage events efficiently. - **MongoDB 🍃**: Utilizes MongoDB to store and manage events efficiently.
- **Scalability**: Built with Go, ensuring high performance and scalability. - **Scalability**: Built with Go, ensuring high performance and scalability.
- **Open Source**: Licensed under the MIT License, making it free to use and modify. - **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 There is an example config in this repo. Copy the example config to config.yml to get started
git clone https://github.com/oceanslim/grain.git
cd grain
```
2. **Build the executable**: ```bash
cp config.example.yml config.yml
```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
``` ```
### WebSocket Endpoints ### WebSocket Endpoints
@ -65,33 +27,37 @@ logging:
- Connect: / - Clients can connect to this endpoint to start a WebSocket session. - 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. - 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 ### Development
To contribute to GRAIN, follow these steps: To contribute to GRAIN, follow these steps:
1. Fork the repository. 1. Fork the repository.
2. Create a new branch: 2. Make your changes.
3. Commit your changes:
```sh
git checkout -b feature-branch
```
3. Make your changes.
4. Commit your changes:
```sh ```sh
git commit -m "Description of changes" git commit -m "Description of changes"
``` ```
5. Push to the branch: 4. Push to the repo:
```sh ```sh
git push origin feature-branch git push
``` ```
6. Create a Pull Request. 5. Create a Pull Request.
### Contributing
### License ### License