CryptoDrew on Nostr: Nostr Dev Question: When serializing an event to generate the hash ID, how should ...
Nostr Dev Question:
When serializing an event to generate the hash ID, how should tags be ordered?
I cannot find anything under NIP-01 for this.
Currently, I am storing metadata external to the event to keep track of the tag order respective of how it was received, but that doesn't seem optimal.
Is there a recommended standard? Maybe alphabetical based on the UTF8 serialized strings of each tag? Although, that is certainly less optimal since that would require individual serialization of each tag plus a string compare sort.
#nostrdev #nostrdevs #devstr #nip01 #asknostr
Published at
2024-01-16 14:14:36Event JSON
{
"id": "c5aca501aa42e9258dca050ddb4c99405ad9cadf0f4bc782468d68696d067ab1",
"pubkey": "81e80c46b9bd0b7c564f59864527fa5f1cc94ea68a07f286858984a341b0a2e8",
"created_at": 1705414476,
"kind": 1,
"tags": [
[
"t",
"nostrdev"
],
[
"t",
"nostrdev"
],
[
"t",
"nostrdevs"
],
[
"t",
"nostrdevs"
],
[
"t",
"devstr"
],
[
"t",
"devstr"
],
[
"t",
"nip01"
],
[
"t",
"nip01"
],
[
"t",
"asknostr"
],
[
"t",
"asknostr"
]
],
"content": "Nostr Dev Question:\n\nWhen serializing an event to generate the hash ID, how should tags be ordered?\n\nI cannot find anything under NIP-01 for this.\n\nCurrently, I am storing metadata external to the event to keep track of the tag order respective of how it was received, but that doesn't seem optimal.\n\nIs there a recommended standard? Maybe alphabetical based on the UTF8 serialized strings of each tag? Although, that is certainly less optimal since that would require individual serialization of each tag plus a string compare sort.\n\n#nostrdev #nostrdevs #devstr #nip01 #asknostr",
"sig": "952d728f6927d6585c0ebe0da51d95633f50915e392962627604c91e65a2c5ff16308ee060ce0d61830fc675cd213f0d140032c2cfac5205bc8f7fc369ccabe0"
}