The NIP (Nostrum Improvement Proposal) 22 defines how relays can limit the acceptable range of timestamps for events' creation and how clients should handle such events. It also formalizes restrictions on event timestamps as accepted by a relay and allows clients to be aware of relays that have these restrictions. The event `created_at` field is just a unix timestamp and can be set to a time in the past or future. Relays accept and share events dated to 20 years ago or 50,000 years in the future. This NIP aims to define a way for relays that do not want to store events with *any* timestamp to set their own restrictions.

Here's an example of how this could work:

```python

class Event:

def __init__(self, created_at):

self.created_at = created_at

@staticmethod

def from_timestamp(timestamp):

return Event(unix_time() - timestamp)

def is_valid_for_relay(self, relay):

if relay.accepted_range == "20

Link: https://github.com/nostr-protocol/nips/blob/master/22.md

Reply to this note

Please Login to reply.

Discussion

No replies yet.