scsibug / nostr-rs-relay

Mirror of https://sr.ht/~gheartsfield/nostr-rs-relay/
MIT License
568 stars 153 forks source link

About how to use nostr-rs-relay to customize the specific requirment? #88

Open VegeBun-csj opened 1 year ago

VegeBun-csj commented 1 year ago

I have just come into learning with the content of nostr protocol and built my own relay by nostr-relay. My understanding is that on the basis of the NIP implemented by rust-relay at present, we only need to add custom restrictions in the configuration file. Does my relay only need to do this, or does it need to be developed and designed? like: an external gRPC server to solve some spam and then broadcast the event to the relay ?

otherlayer commented 1 year ago

There is gRPC client that can connect to your 'submission'/'validation' gRPC server, you got event and some parameters and can decide to deny this event. I'm implementing some external event processing where there is a gRPC server on relay side and you can send broadcast/notice event back to relay after processing (don't have to respond imediatelly with permit/deny etc.). You must implement your spam protection as gRPC is new in nostr-rs-relay and there is no already made software for it. Issue I've posted what was my idea: https://github.com/scsibug/nostr-rs-relay/issues/75 Not finished branch (based on my PR), wip, not cleaned, proto/example probably to refactor etc: https://github.com/otherlayer/nostr-rs-relay/tree/nostr_grpc_server Sending notice still to be implemented (just to have bare external processing, no extensions, plugins etc) as I need some identification of ws client when event coming back to relay, considering just pubkey and ahash for maping to client notice_tx Sender. Or I don't get something and can be done easier (new to Rust), any mentoring appreciated ;)

VegeBun-csj commented 1 year ago

Ok, thanks. So GRPC is a way to process some request of spam, and nostr NIP can implement some payment mechanism and pos to prevent it.

otherlayer commented 1 year ago

Not only spam, you can do many things depending on event using gPRC. You can do spam deterrence using zaps I guess.

VegeBun-csj commented 1 year ago

what is zaps? 😄

otherlayer commented 1 year ago

Nostr lightning payments, according your nip payment mechanism comment to prevent spam, probably in the future can be used as nostr native pay-to-relay mechanism, but I would like to see it first in nip protocol for what you pay to relay what.