Skip to content

Conversation

@sant0s12
Copy link
Contributor

@sant0s12 sant0s12 commented May 25, 2024

Alright buckle up, here I come with a wacky idea that I found out through #225. When I saw it at the time I thought that it would break backwards compatibility but to my surprise I think it does not have to.

The basic idea is to have a new signing scheme that allows for arbitrary JSON fields, which IMO would make better use of the fact that nostr events are just JSON objects than using tags as is done now. The current signing scheme is still used but I propose adding a new field that holds the signature over all of the object's fields as done by Perkeep. Therefore, existing clients can continue to work the same.

I thought about doing the same thing for the Id field since it is currently also not aware of any other fields besides the ones described in NIP-01. However, I am unsure about the utility of this since it would increase the size at no clear advantage.

Please let me know your thoughts and concerns.

@vitorpamplona
Copy link
Collaborator

I am unsure about the utility of this since it would increase the size at no clear advantage.

Correct. I don't see the point of this.

There are major problems on today's hashing/signing procedure:

  1. Requires JSON parsing and serializers which are extremely slow.
  2. Requires assembling the NIP-01 array to hash, which uses a TON of memory creation and deletion just to hash it.
  3. SHA256 can process batch arrays, but batch processing is slower than a call with the complete byte array.
  4. We use Hex, which is a wasteful format for keys inside a JSON.

Those are extremely important limitations since we are expected to re-hash and verify every single event coming in. I would try to create the fastest verifier if I had a chance to re-do nostr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants