Currently we're using a fixed set of relays in bitchat which is only a temporary solution. We could let users edit their own relays but 1) users don't know what relays are and 2) if users have no overlapping relays they can't talk to each other. Here's a solution that we came up with. I'd like to know your thoughts. We're going to crawl a long list of relay URLs every 24 hours. This list will also include their estimated geo locations, also updated every 24 hours. This could be done in an automated GitHub runner. That list of URLs plus their geo locations will be embedded and shipped with the bitchat app. Users who join a geohash channel will use the five closest relays based on the geohash location of interest. This solves multiple problems at once: 1) relay centralization 2) privacy 3) speed 4) maybe censorship resistance? What do you think?

Replies (53)

The architectural design and the caching system will change so much that the more you delay the more you will have to rewrite later on.
Nikos's avatar
Nikos 4 months ago
*relayed - not delayed ( fat fingers )
Because: 1. centralizing is bad. The main relay set can moderate everything. 2. the fixed set of relays will know the location of each one of your users. 3. You want people to choose relays that are physically closer to them for performance. 4. If I follow people on Nostr and they are using bitchat, I don't want to have to move to their location to talk to them, I just send to their relays. 5. Relays can become topical communities within locations.
Sorry, I didn't fully understand on the first read. This is actually interesting, maybe NIP 66 would help? Trust is an issue though, seems weird to trust a relay based purely on geographical proximity. You would also have to probe them to know they would accept events.
I don't get it. How does this apply to bitchat? The channels are literally location-based. Users have no persistent identities, you can't follow them.
What's brute force about it? I don't want to find specific users, I want to talk to a location-based channel.
The problem were trying to solve isn't following users or finding the relays rhey post on. We're doing location-based channels. What you list applies to Twitter like feeds but I don't see how it applies to bitchat.
Yes for gathering the first step where we gather a relay list it seems like a good option. Do you have a script that can crawl for relay lists?
Yes and I would probe them to see if they accept kind 20000s. If they do, they can be on the list. Ideally it would be hundreds of relays, and each channel would live on say 5 relays. Persistence isn't important right now.
Yes, that’s probably the right idea, in the sense that the authorities are less likely to block their own servers than those located abroad, but we shouldn’t forget that in some locations there aren’t many Nostr relays (in Russia you won’t even find five), and at first this will put a heavy load on the few that do exist there.
hasky's avatar
hasky 4 months ago
This could work wonder to have more secure and minimize black log from overlapping relay .
DZC's avatar
DZC 4 months ago
How easy would be for a bad actor to set a relay and use it as a honeypot to locate the bitchatters IP for certain locations?? 👀 Tor support would be nice to boost privacy...
I've written a few but they are all terrible. I do think maybe self-attested nip 66 would be better here. That way you're not hijacking random personal relays, instead relying on volunteers who want to serve a particular geography. You would only need the usual 2-5 per region, and a few geo "hubs" could do a lot of the lifting.
lkraider's avatar
lkraider null 4 months ago
How can relays opt to be included in that list? What about a DHT for updating the list instead of app updates?
Does this mean that you’d have to make another release to update the list? Also would this also cause users far away from each other to possibly not be able to chat with each other since they’d likely be on different relays?
Default avatar
dyegolara 4 months ago
I’d prefer some UI to manage relays and check if they overlap, then connect to whatever I want
If this is being used for protests and the geohash channels will use local relays, wouldn’t it be easier for authorities to crackdown on it?
Default avatar
Stvu 4 months ago
The bitchat info screen needs to be updated. It says no servers and no data collection. Relays are servers… image
This is a good idea because this is what I do manually on nostr Is 5 going to be enough without some sort of premium relay though Maybe I’m confused but relays don’t always stay persistent… maybe that’s why you are saying a 24 hr turnover though Things should run persistent for 24 hrs reliably
Default avatar
Bit Mumbles 4 months ago
@calle you are literally building the backbone of a new society, pls continue I think geo hash is the way we differentiate human key pairs from ai ley pairs on nostr. Proof of human (cringe) but it is required.
miKe's avatar
miKe 4 months ago
would consider storing and crawling the list of the relays in the app. user can select from interface locations that are translated in background to relays.
Seems like Gitlab runner would be a better choice if you need that kind of functionality. Gitlab has good self-hosting support. Keep up the great work and be careful of feature creep. I love that the apps under 10MB right now!
You can make this deterministic and completely client side: 1. Query bootstrap relays for kind 10002 and 3 events. Extract a list of 100s of relays from these. Takes a second or two when I tested it. 2. Hash every relay URL. 3. Hash the user's npub. 4. Use Kademlia XOR-distance to find the 5 relays "closest" to the npub. 5. Use those relays as inboxes for the npub. 6. (Can update this periodically as the global relay set changes.) An advantage of the deterministic relay set is you can find the inbox relays with just the npub. Solves one of the issues you appear to have with geo-relays. PoC: Enjoy! 🧐 @jack