Skip to content

Instantly share code, notes, and snippets.

@dskvr
Last active October 30, 2024 02:11
Show Gist options
  • Save dskvr/6036030fb5302e8a519e1d73d5f790c4 to your computer and use it in GitHub Desktop.
Save dskvr/6036030fb5302e8a519e1d73d5f790c4 to your computer and use it in GitHub Desktop.
NIP66 NIP50 relays

Issue #1

NOTICE from wss://feeds.nostr.band/: error: unknown feed

nostr.band feeds are tricky because the root domain connects like a relay, but does not actually behave like a relay. Only it's sub paths act like relays, and I'm still trying to figure out how to handle this in a way that doesn't require manual treatment. It would be better if feeds.nostr.band refused to connect.

Issue #2

NOTICE from wss://relay.noswhere.com/: internal error on filter 0

Internal issue it seems.

Issue #3

Some search relays don't implement search correctly and return events that do not include the search string. N filters presently just enable supported_nips to be filtered against.

While I do run a variety of tests, things like NIP-50 are difficult to validate because false negatives are almost expected (maybe it's a new relay and the term being searched is not there yet...)

I am open to suggestions about how to handle this situation.

Overall

Every relay returned advertises NIP-50 support via NIP-11. 0/50 returned are missing NIP-50 from their NIP-11.

Aside: Funny that there are presently 50 NIP-50 relays :D

found nip50 relay: wss://relays.diggoo.com/
found nip50 relay: wss://feeds.nostr.band/
found nip50 relay: wss://bouncer.minibolt.info/
found nip50 relay: wss://bostr.erechorse.com/
found nip50 relay: wss://rebelbase.social/relay
found nip50 relay: wss://relay.rebelbase.site/
found nip50 relay: wss://relay.zhoushen929.com/
found nip50 relay: wss://arab.place/relay
found nip50 relay: wss://ditto.slothy.win/relay
found nip50 relay: wss://straylight.cafe/relay
found nip50 relay: wss://nostr.noderunners.network/
found nip50 relay: wss://cobrafuma.com/relay
found nip50 relay: wss://bostr.cx.ms/
found nip50 relay: wss://relay.cxplay.org/
found nip50 relay: wss://relay.nostpy.lol/
found nip50 relay: wss://social.protest.net/relay
found nip50 relay: wss://nostr.me/relay
found nip50 relay: wss://ditto.nsnip.io/relay
found nip50 relay: wss://us.nostr.wine/
found nip50 relay: wss://relay.noswhere.com/
found nip50 relay: wss://gleasonator.dev/relay
found nip50 relay: wss://cfrelay.haorendashu.workers.dev/
found nip50 relay: wss://henhouse.social/relay
found nip50 relay: wss://slime.church/relay
found nip50 relay: wss://nostr.belgianbitcoinembassy.org/relay
found nip50 relay: wss://bostr.online/
found nip50 relay: wss://bostr.bitcointxoko.com/
found nip50 relay: wss://nostrja-kari-nip50.heguro.com/
found nip50 relay: wss://sebastix.social/relay
found nip50 relay: wss://cfrelay.snowcait.workers.dev/
found nip50 relay: wss://nostr.faust.duckdns.org/
found nip50 relay: wss://nobody.pub/relay
found nip50 relay: wss://satellite.hzrd149.com/
found nip50 relay: wss://relay.nostr.band/
found nip50 relay: wss://cfrelay.royalgarter.workers.dev/
found nip50 relay: wss://bostr.nokotaro.work/
found nip50 relay: wss://filter.nostr.wine/
found nip50 relay: wss://search.nos.today/
found nip50 relay: wss://bostr.nokotaro.com/
found nip50 relay: wss://nostr.novacisko.cz/
found nip50 relay: wss://bnc.netsec.vip/
found nip50 relay: wss://hispanostr.com/relay
found nip50 relay: wss://search.swarmstr.com/
found nip50 relay: wss://ditto.pub/relay
found nip50 relay: wss://nostr.wine/
found nip50 relay: wss://relay.bostr.online/
found nip50 relay: wss://cfrelay.puhcho.workers.dev/
found nip50 relay: wss://freespeech.social/relay
found nip50 relay: wss://prl.plus/
found nip50 relay: wss://relay.lumina.rocks/
nip66: eose, found 50 nip50 relays
wss://social.protest.net/relay: 69a5750a6207e6994844bed1fa9001c437ba6735c20ea26f71f7ec6aa385b352: false
wss://ditto.nsnip.io/relay: 858eccfc3a9212a0f35a23474315948fc52b2b25cdc8b456b30cf503e1af9ead: false
wss://nostr.me/relay: 78dc8e3ca0ac9db30d875d16a2197046388aa113c84e54e02763cd4854553b70: true
wss://nostr.belgianbitcoinembassy.org/relay: e046f558ff03e776a5d77a7d3efa222924f43f2efde66a3afc79c4b3cbff2cf3: false
wss://arab.place/relay: 78dc8e3ca0ac9db30d875d16a2197046388aa113c84e54e02763cd4854553b70: true
wss://relay.rebelbase.site/: c2d4454dc1f84bcc54c234f052444ddafd05cff26d8d66076ccfbb92d5f904fb: false
wss://rebelbase.social/relay: c2d4454dc1f84bcc54c234f052444ddafd05cff26d8d66076ccfbb92d5f904fb: false
wss://ditto.slothy.win/relay: a033ba489e65101719bb7e74ba31a3726637eb251da2cc5a173d2abba62091df: true
wss://sebastix.social/relay: a60d1c91f9e890b15c212ab8e127981f61f077cde0c0f230f083779e4a710aa8: true
NOTICE from wss://feeds.nostr.band/: error: unknown feed
wss://feeds.nostr.band/: 4babe1f0132e0e56ca3dca14267917b3b29ec85176fb83a42a669c09181b73cf: true
wss://bouncer.minibolt.info/: 98a046fd9b731a9dc8bad19a572a339930e0c5acbbfdcc70de275e061b8f9b1d: false
wss://cobrafuma.com/relay: 706698477bfca5c08034d89917a3a06184504feb76aea78c2a68169041c52c07: true
wss://nostr.novacisko.cz/: 44edd27a4aa10c0bf089c7cd9c35ce0fbcca2c053f0699c837ed0d9907e48b6a: false
NOTICE from wss://relay.noswhere.com/: internal error on filter 0
wss://cfrelay.puhcho.workers.dev/: c4e580cf0e4e2a9d6afe7ba3e7c32c97f9dbd3e6cb283ae4865e6c86d246c60a: true
wss://relay.nostr.band/: 4babe1f0132e0e56ca3dca14267917b3b29ec85176fb83a42a669c09181b73cf: true
wss://gleasonator.dev/relay: 706698477bfca5c08034d89917a3a06184504feb76aea78c2a68169041c52c07: true
wss://relay.lumina.rocks/: 4babe1f0132e0e56ca3dca14267917b3b29ec85176fb83a42a669c09181b73cf: true
wss://slime.church/relay: a60d1c91f9e890b15c212ab8e127981f61f077cde0c0f230f083779e4a710aa8: true
wss://bostr.bitcointxoko.com/: 716cfff86b95ef5b8054fea441cb883045ebac53fdb68946e1ebc51467177cdd: true
wss://henhouse.social/relay: 706698477bfca5c08034d89917a3a06184504feb76aea78c2a68169041c52c07: true
wss://prl.plus/: 277c0cbe3f62b8150a70894fb2fbe2fd15f12a53ca68accbd499174270efb846: false
wss://nobody.pub/relay: d2f5130441118bba2dc14302609a52af87cc04729d77466cb0ee80f10c10cfbb: true
wss://straylight.cafe/relay: 6033c4fe93a949af6a996176eae2403d278160fcc04f2c13835c794443368133: false
wss://nostr.wine/: f951fb520da8b997ec50afce240f5e05fcbf0994b92ce8f64b1627894ae9da94: true
wss://us.nostr.wine/: f951fb520da8b997ec50afce240f5e05fcbf0994b92ce8f64b1627894ae9da94: true
wss://ditto.pub/relay: 706698477bfca5c08034d89917a3a06184504feb76aea78c2a68169041c52c07: true
wss://search.swarmstr.com/: 431cfc563ce6df591454ad95a1eb114a12ae2acec5f004a9f1873ea109f04cf4: true
wss://satellite.hzrd149.com/: 86db15cc722cc0c7510c5f52d025d3e4ceee04a8351c2d33e0ed8e071e372259: true
wss://relay.cxplay.org/: f90ce4a585723c96dc826594660f1d5cec33cfc5bd63215b32a2b23bc3cc72e0: true
wss://hispanostr.com/relay: 0d04a58ce10f4c72e72139dc9d6a80cf032cf130538ded1053f859b637f88b2f: true
wss://search.nos.today/: f2356e645c2699eef03cee6d1dcbafd479a3eabca86bb4d0a9f93916a80126fb: true
wss://relays.diggoo.com/: 0274ef2ca2cbb5b8e8f1447ebcba1dd6b8c122f69cd7d3738e583eeaed4bf6d6: false
wss://freespeech.social/relay: b2191599f08ff7260084c202464815fa2ee4d18ca31011f77f70ab7ce6081f68: true
wss://bostr.nokotaro.work/: f2356e645c2699eef03cee6d1dcbafd479a3eabca86bb4d0a9f93916a80126fb: true
wss://bostr.nokotaro.com/: f2356e645c2699eef03cee6d1dcbafd479a3eabca86bb4d0a9f93916a80126fb: true
wss://nostr.noderunners.network/: 003af391b8c53573c91dee4de975462e0b5d4d71c47a74951734e10e18a60903: false
wss://relay.zhoushen929.com/: a033ba489e65101719bb7e74ba31a3726637eb251da2cc5a173d2abba62091df: true
wss://nostrja-kari-nip50.heguro.com/: c1632399de6892723dce6e1b3d494e68cdc68ce72f5b8f932f05978734aae87c: false
wss://cfrelay.haorendashu.workers.dev/: 463fcbc73285a8ed6bc21e0309da7d416683e741aea2e19ce628bbec05127be3: true
wss://relay.bostr.online/: 096f326ba645c18a4d521e59e97d94d24f245e6faaf80c8b9a91cde51330aa4c: true
wss://nostr.faust.duckdns.org/: c560216b0a318625494bd02011c10a2d81adc931f05b93eac5144f808ce8e5b7: true
relay wss://social.protest.net/relay returned false
relay wss://ditto.nsnip.io/relay returned false
relay wss://nostr.me/relay returned true
relay wss://nostr.belgianbitcoinembassy.org/relay returned false
relay wss://arab.place/relay returned true
relay wss://relay.rebelbase.site/ returned false
relay wss://rebelbase.social/relay returned false
relay wss://ditto.slothy.win/relay returned true
relay wss://sebastix.social/relay returned true
relay wss://feeds.nostr.band/ returned true
relay wss://bouncer.minibolt.info/ returned false
relay wss://cobrafuma.com/relay returned true
relay wss://nostr.novacisko.cz/ returned false
relay wss://cfrelay.puhcho.workers.dev/ returned true
relay wss://relay.nostr.band/ returned true
relay wss://gleasonator.dev/relay returned true
relay wss://relay.lumina.rocks/ returned true
relay wss://slime.church/relay returned true
relay wss://bostr.bitcointxoko.com/ returned true
relay wss://henhouse.social/relay returned true
relay wss://prl.plus/ returned false
relay wss://nobody.pub/relay returned true
relay wss://straylight.cafe/relay returned false
relay wss://nostr.wine/ returned true
relay wss://us.nostr.wine/ returned true
relay wss://ditto.pub/relay returned true
relay wss://search.swarmstr.com/ returned true
relay wss://satellite.hzrd149.com/ returned true
relay wss://relay.cxplay.org/ returned true
relay wss://hispanostr.com/relay returned true
relay wss://search.nos.today/ returned true
relay wss://relays.diggoo.com/ returned false
relay wss://freespeech.social/relay returned true
relay wss://bostr.nokotaro.work/ returned true
relay wss://bostr.nokotaro.com/ returned true
relay wss://nostr.noderunners.network/ returned false
relay wss://relay.zhoushen929.com/ returned true
relay wss://nostrja-kari-nip50.heguro.com/ returned false
relay wss://cfrelay.haorendashu.workers.dev/ returned true
relay wss://relay.bostr.online/ returned true
relay wss://nostr.faust.duckdns.org/ returned true
success: 29 / 50
import { SimplePool, useWebSocketImplementation } from 'nostr-tools/pool'
import { Relay, useWebSocketImplementation as useWebSocketImplementation2 } from 'nostr-tools/relay'
import WebSocket from 'ws'
useWebSocketImplementation(WebSocket)
useWebSocketImplementation2(WebSocket)
const relay66 = new SimplePool()
let relays = ['wss://relay.nostr.watch', 'wss://relaypag.es', 'wss://monitorlizard.nostr1.com']
let nip50Relays = []
let h = relay66.subscribeMany(
relays,
[
{
authors : ['9bbbb845e5b6c831c29789900769843ab43bb5047abe697870cb50b6fc9bf923', '9ba6484003e8e88600f97ebffd897b2fe82753082e8e0cd8ea19aac0ff2b712b'],
kinds: [30166],
"#N": ["50"],
since: Math.round(Date.now() / 1000) - 60 * 60 * 1.5,
},
],
{
onevent(event) {
const relay = event.tags.find(tag => tag[0] === 'd')?.[1]
if(!relay) return console.error('No relay d tag found')
console.log(`found nip50 relay: ${relay}`)
nip50Relays.push(relay)
},
oneose() {
console.log(`nip66: eose, found ${nip50Relays.length} nip50 relays`)
h.close()
testNip50()
}
}
)
let nip50Results = 0
const testNip50 = async () => {
const subs = {}
const results = {}
const search = "nostr"
const filters = [
{ search, limit: 1 }
]
const prom = []
for(const relay of nip50Relays) {
prom.push(new Promise( async (resolve) => {
const _relay = await Relay.connect(relay)
subs[relay] = _relay.subscribe(
filters,
{
onevent(event) {
console.log(`${relay}: ${event.id}: ${event.content.includes(search)}`)
results[relay] = event.content.includes(search)
},
oneose() {
subs[relay].close()
resolve()
}
}
)
}))
}
await Promise.all(prom)
Object.entries(results).forEach(([relay, result]) => {
console.log(`relay ${relay} returned ${result}`)
if(result) nip50Results++
})
console.log(`success: ${nip50Results} / ${nip50Relays.length}`)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment