Mazin @mazin - 1y
Reminder: many nostr clients do not validate event signatures. Choose your relays carefully. Good morning.
What client are you using?
Sure. A nostr event is structured like this: {"pubkey":"3d842afecd5e293f28b6627933704a3fb8ce153aa91d790ab11f6a752d44a42d","content":"Reminder: many nostr clients do not validate event signatures. Choose your relays carefully.\n\nGood morning.","id":"4507934f647958e934f3b67fff32c7b5a4b9e5f42042cf98f2f10ba0159db6bb","created_at":1695042973,"sig":"7cc63f85f2b7956280a7124aca7add92741c9f26b78843a082a2c65c79aa4510e7fb097f5c3d3c1f97e4a445e2673c5b955f19ab02d5630b4d1189cfdf4d4652","kind":1,"tags":[]} The “sig” field is used to validate that my private key signed the note. Most (all?) relays validate these signatures as the event comes in before storing it. Most clients do NOT validate the signature when receiving events from relays. The risk of not validating is that a relay could alter a users notes without detection.
For sure, and it’s going to be a necessary tradeoff in many clients, particularly mobile ones. I do think they should still validate SOME events (like profile updates) though. I do think it’s important to point out that lots of our security/trustlessness is actually smoke and mirrors (for now).
Fabian @Fabian - 1y
I think I might turn it on by default again in Nostur, I had it disabled because I assumed it would be a big performance hit, but after your post I decided to do an actual measurement and it doesn’t seem that bad actually. I will do some more testing to be sure.
Very cool! For what it’s worth, I totally understand not having it on by default and think having the option is great. I think Nostur is one of the few mobile clients that even has the option.
nobody @nobody - 1y
It did seem to hurt it perceptually on my phone. Totally anecdotal though.
Correct, it’s a performance trade off. Some clients like Nostur (made by nostr:npub1n0sturny6w9zn2wwexju3m6asu7zh7jnv2jt2kx6tlmfhs7thq0qnflahe) have a toggle to turn validation on and off.
Perhaps there could be an option to validate some randomly sampled events across a given relay set to keep them honest without necessarily needing to validate every event. I think profile updates are perhaps the most important to validate as it would be trivial for relay operators to steal money by replacing zap addresses.
It’s a race condition with other relays of course so perhaps trivial is unfair but it’s something to think about.
Will @jb55 - 1y
btw Damus now validates all events! nostrdb is does this using its non-blocking multithreaded ingester so its fast enough and doesn’t have any perf impact in the UI. Once damus switches over to use nostrdb for its event cache (soon), this will make damus full validating for all notes. nostr:note1g5rexnmy09vwjd8nkell7vk8kkjtne05yppvlx8j7y96q9vak6asjp9u8g
also gm
06b78 - 1y
Yields! Do all relays validate event signatures?
*Yikes! Damn autocorrect
Dan Wedge @WedgeSocial - 1y
Gm Will may the sun shine on you & fam today
damien @damien - 1y
GM! Will 💜
Extremely cool and gm
The Fishcake🐶🐾 @The Fishcake🐶🐾 - 1y
GM🐶🐾🫂☕️
I can’t speak for every relay implementation on the planet, but every one that I know of does validate.
indeed it is. strfry does the same so i stole its design but I made further optimizations for mobile like not re-validating or re-parsing if we already have the event. gm.
Thanks. That’s what I thought. But it is possible for a rogue relay to send out invalid events, so clients need to validate.
Indeed, you got it! I think as clients optimize you’ll see more of them add validation. They all wanted to include it from the beginning but ran in to performance issues. The most important thing to validate is profile updates since those include LN payment addresses. nostr:note1yvnw45cd7frkkx7ca4mnwqqjvranne045vgynf7w986n2jnkp45qwan0ts
Dan @Dan - 1y
nostr:npub1gcxzte5zlkncx26j68ez60fzkvtkm9e0vrwdcvsjakxf9mu9qewqlfnj5z which events does #amethyst validate?
Vitor Pamplona @Vitor Pamplona - 1y
All of them. Even push notifications are individually verified.
jack @jack - 1y
🫂 nostr:note1f95x75mdf7pljrtx4axq43lekvpkxrmjjfapug0ch4f76dcwgy8qmz6xjf
5c4bf - 1y
Probably some clients don't even verify that events match the filter...
Hey nostr:npub1xtscya34g58tk0z605fvr788k263gsu6cy9x0mhnm87echrgufzsevkk5s just curious, have you done any benchmarking on energy use before/after adding this? Damus is lightning fast, so mission accomplished, but I am curious if the background processing will increase energy usage, or if it’s efficient enough it never ramps up the cores.
I haven’t, it should be much more efficient as a whole but its also doing lots of signature validation now which is trading it off a bit. There are also many more optimizations to be made and lots of low hanging fruit, so energy use will get much better as I switch over more stuff to use nostrdb
Awesome. Thanks for the explainer. I haven’t had any indication it’s a problem or anything. Damus is rubbing lightning fast on test flight. Thanks for scratching that itch. 😄