alexbosworth / balanceofsatoshis

Tool for working with the balance of your satoshis on LND
MIT License
555 stars 78 forks source link

[nostr]: New command to publish events to nostr relays #497

Open niteshbalusu11 opened 1 year ago

niteshbalusu11 commented 1 year ago

Signed-off-by: Nitesh Balusu niteshbalusu@icloud.com

Created a new command called nostr which broadcasts messages to relays.

Protocol flow: https://github.com/nostr-protocol/nips/blob/master/01.md

Clients to use for testing: https://iris.to/

Note: Private key needs to be added in hex format.

Example relay to use: wss://nostr.foundrydigital.com (I run this one) Need to add this relay to your client for testing, most clients come with default relays which should also probably be added to bos.

niteshbalusu11 commented 1 year ago

This is an initial PR, we have to figure out how the message would look like. Also we could send random messages, need to add some parsing of the message to see if its a group-open message, if the parsing fails may be just broadcast the message as is?

alexbosworth commented 1 year ago

This is an initial PR, we have to figure out how the message would look like. Also we could send random messages, need to add some parsing of the message to see if its a group-open message, if the parsing fails may be just broadcast the message as is?

parsing of which message?

niteshbalusu11 commented 1 year ago

Most people will have their private key stored in bech32 format with a prefix of nsec because that's how clients usually generate and give you, maybe we should should accept both bech32 and hex as input but while saving we convert to hex and save because we sign with the hex key.

alexbosworth commented 1 year ago

Sounds good to me

Is it possible the key could be optional and it could just generate a key itself, or does that not make sense within the Nostr world because the key then isn't tied to your identity?

niteshbalusu11 commented 1 year ago

We could generate a key and log it. People can use it to login into any other client. bos is also a client anyway. How are we tying a key to an identity by generating one?

alexbosworth commented 1 year ago

We could generate a key and log it. People can use it to login into any other client. bos is also a client anyway. How are we tying a key to an identity by generating one?

generating a key sounds cool to make it optional to add one, also could there be some default gateways?

for identity i mean maybe the generated key wouldn't be optimal for people because it wouldn't be their normal identity so no one would be following them?

niteshbalusu11 commented 1 year ago

I think it's only useful if someone will be using Nostr for the first time. Maybe --generate-keys should be its own flag.

alexbosworth commented 1 year ago

I started to look at this

Some things I'm thinking should be changed though:

And maybe

Stretch

Big Stretch

So I started on it but I want to get it to MVP state in terms of feature and design

niteshbalusu11 commented 1 year ago

Sounds good. You can use this for a default relay. I run it.

wss://nostr.foundrydigital.com

Paid relays as of today, there is a NIP where you can advertise to clients you're a paid relay. And then you build your own UI for people to come and add their pubkeys to the whitelist by paying an invoice. I plan to make mine paid soon.

alexbosworth commented 1 year ago

Is there a link for the paid relay stuff?

niteshbalusu11 commented 1 year ago

https://github.com/nostr-protocol/nips/blob/master/11.md

It's missing in this, but basically from what I understand it's just adding is_paid: true and payments_url : url to this.

{
  "name": <string identifying relay>,
  "description": <string with detailed information>,
  "pubkey": <administrative contact pubkey>,
  "contact": <administrative alternate contact>,
  "supported_nips": <a list of NIP numbers supported by the relay>,
  "software": <string identifying relay software URL>,
  "version": <string version identifier>
}

Here's a paid relay website: https://eden.nostr.land/invoices

alexbosworth commented 1 year ago

ok cool i'll play with that

alexbosworth commented 1 year ago

I'm still working through the basics of this one, making progress

niteshbalusu11 commented 1 year ago

Cool ok.