|
| 1 | +# Announcement Publishing |
| 2 | + |
| 3 | +On Frequency, [Announcements](../DSNP/Announcements.md) are mapped to schemas which in turn publish Frequency Messages. |
| 4 | +Frequency Messages are either direct Graph Changes from a particular user, or a Batch Publication with a multitude of users possible. |
| 5 | + |
| 6 | +<!-- Links to https://libertydsnp.github.io/frequency should be updated with links to docs.frequency.xyz when able to be --> |
| 7 | + |
| 8 | +| Announcement Type Enum | Announcement | Batched | Schema Id Mainnet | Schema Id Rococo | Frequency Model Type | Frequency Payload Location | |
| 9 | +| --- | --- | --- | --- | --- | --- | --- | |
| 10 | +| 0 | [Tombstone](../DSNP/Types/Tombstone.md) | YES | TBD | TBD | [`Parquet`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.ModelType.html#variant.Parquet) | [`IPFS`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.PayloadLocation.html#variant.IPFS) | |
| 11 | +| 1 | [Graph Change](../DSNP/Types/GraphChange.md) | no | TBD | TBD | [`AvroBinary`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.ModelType.html#variant.AvroBinary) | [`OnChain`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.PayloadLocation.html#variant.OnChain) | |
| 12 | +| 2 | [Broadcast](../DSNP/Types/Broadcast.md) | YES | TBD | TBD | [`Parquet`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.ModelType.html#variant.Parquet) | [`IPFS`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.PayloadLocation.html#variant.IPFS) | |
| 13 | +| 3 | [Reply](../DSNP/Types/Reply.md) | YES | TBD | TBD | [`Parquet`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.ModelType.html#variant.Parquet) | [`IPFS`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.PayloadLocation.html#variant.IPFS) | |
| 14 | +| 4 | [Reaction](../DSNP/Types/Reaction.md) | YES | TBD | TBD | [`Parquet`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.ModelType.html#variant.Parquet) | [`IPFS`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.PayloadLocation.html#variant.IPFS) | |
| 15 | +| 5 | [Profile](../DSNP/Types/Profile.md) | YES | TBD | TBD | [`Parquet`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.ModelType.html#variant.Parquet) | [`IPFS`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.PayloadLocation.html#variant.IPFS) | |
| 16 | +| 6 | [Update](../DSNP/Types/Update.md) | YES | TBD | TBD | [`Parquet`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.ModelType.html#variant.Parquet) | [`IPFS`](https://libertydsnp.github.io/frequency/common_primitives/schema/enum.PayloadLocation.html#variant.IPFS) | |
| 17 | + |
| 18 | +Source code for each schema is also located in the [LibertyDSNP/schemas](https://github.com/LibertyDSNP/schemas) repository. |
| 19 | + |
| 20 | +## DSNP Non-Batched Announcements |
| 21 | + |
| 22 | +Frequency uses an on-chain data structure for storage of `GraphChange` Announcements. |
| 23 | +Each individual announcement is submitted using the [`add_onchain_message`](https://libertydsnp.github.io/frequency/pallet_messages/pallet/enum.Call.html#variant.add_onchain_message) extrinsic. |
| 24 | + |
| 25 | +## DSNP Batched Announcements |
| 26 | + |
| 27 | +Frequency uses [DSNP Batch Publications](../DSNP/BatchPublications.md) for Announcements that are batched. |
| 28 | +The parquet file is stored on [IPFS](https://ipfs.io/), but it is discovered through the Frequency Message. |
| 29 | + |
| 30 | +Frequency Messages maintain the metadata of where and when the Batch Publication was published and which Provider MSA published it. |
| 31 | +It is the publisher's responsibility to maintain the [IPFS pin](https://docs.ipfs.tech/concepts/glossary/#pinning) so that the batch file is continuously available. |
| 32 | + |
| 33 | +DSNP Batch Publications [MUST be validated](./Validation.md) upon fetching to ensure data and permission integrity. |
| 34 | + |
| 35 | +## Ordering |
| 36 | + |
| 37 | +Frequency Messages are well ordered within a Schema |
| 38 | + |
| 39 | +1. Frequency: Block number ascending |
| 40 | +2. Frequency: Block index ascending |
| 41 | +3. DSNP Standard: Order Announcements in a Batch Publication File by row appearance order |
| 42 | + |
| 43 | +### Ordering Across Schemas |
| 44 | + |
| 45 | +Frequency provides complete ordering metadata for Messages across Schemas. |
| 46 | +Block index is unique per Message within the same block. |
| 47 | + |
| 48 | +### Human Order |
| 49 | + |
| 50 | +Due to the asynchronous nature of networks and batching, it is possible that the canonical ordering of Announcements is wrong from a human viewpoint. |
| 51 | +With dependent Announcements, where one Announcement refers to another Announcement, the order may be inferred differently than the canonical ordering. |
| 52 | +It is left to user interfaces to handle these situations. |
| 53 | + |
| 54 | + |
| 55 | +## Retrieval |
| 56 | + |
| 57 | +Frequency nodes provide an RPC interface [`get_messages_by_schema`](https://libertydsnp.github.io/frequency/pallet_messages_rpc/trait.MessagesApiClient.html#method.get_messages_by_schema) with paginated responses that differ based on the Schema. |
| 58 | + |
| 59 | +Frequency nodes can provide a websocket interface that will emit an event for each block that has one or more messages of a given schema in that block. |
| 60 | +The [`MessagesStored`](https://libertydsnp.github.io/frequency/pallet_messages/pallet/enum.Event.html#variant.MessagesStored) event can be used to know when to call the RPC interface to retrieve the messages. |
| 61 | + |
| 62 | +See the [Frequency Documentation](https://libertydsnp.github.io/frequency/pallet_messages_rpc/trait.MessagesApiClient.html#method.get_messages_by_schema) for more details on Message retrieval. |
0 commit comments