How viable would it be to implement a timestamping protocol on top of the Gossipsub router for message ordering?
The intent is to allow subscribers to receive messages in the same order without a centralized sequencer.
As a rough idea, the protocol might look like this:
- A message is posted into a topic as normal.
- Peers who receive it gossip the metadata only, including a “received on” timestamp signed with their PeerId key material.
- Peers who receive the metadata append the same data (only once) and gossip (unless the threshold is reached).
- Subscribers collect an array of timestamp, counting unique peers and verifying their signatures.
- When N-of-M unique peer timestamps are collected, the subscriber assigns the median timestamp to the now timestamped message.
To avoid race conditions, subscribers would track messages in a queue, processing each timestamped message after all earlier (based on the rolling median time) messages are cleared (waits for earlier messages who haven’t yet reached the threshold). There might be much better variations of this protocol, but I just your feedback on the concept. Does it make general sense or is Gossipsub the wrong place to do this?