nips/1078.md

23 lines
1.2 KiB
Markdown
Raw Normal View History

2023-07-14 12:14:53 -04:00
# NIP-1078
## Arbitrary custom app data
`draft` `optional` `author:BlowaterNostr`
## Nostr event
2023-07-14 12:25:28 -04:00
This NIP specifies the use of event kind `1078` which is almost identical to [30078](https://github.com/nostr-protocol/nips/blob/master/78.md) except that it's not a replacible event.
2023-07-14 12:14:53 -04:00
## Some use cases
2023-07-14 12:25:28 -04:00
The reason to not having a 30078 is that some clients want to implement local state changes as [CRDTs](https://crdt.tech/), meaning support cumulative and associative mutations
2023-07-14 12:14:53 -04:00
2023-07-14 12:25:28 -04:00
Cumulative and associative means the order of applying operations doesn't change the final result as long as the same set of operations are applied.
2023-07-14 12:14:53 -04:00
2023-07-14 12:25:28 -04:00
Using regular events can reserve the event/operation history thus the client can recompute the final state easily. [Figma uses CRDT to implement their vector design system.](https://www.figma.com/blog/how-figmas-multiplayer-technology-works/)
## Implementations
2023-07-14 12:14:53 -04:00
For example, in [Blowater](https://blowater.deno.dev), Pin/Unpin Contacts is implemented as regular events to achieve better consistency.
Event set [`Pin Npub X`, `Unpin NpubX`, `Pin Npub Y`] will result in a pin list of `[Y]` no matter how the order is shifted.
Many other operations are best implemented as CRDTs as well.