Proposed HCS standard to normalize voting data in a topic ID #588
Replies: 5 comments 2 replies
-
Hey @HGraphPunks - thanks for taking the initiative here. I understand that this is of interest to you, and this seems like a small lightweight change required to make our hcs-governance software accomodate (messages/usage of which is outlined here in CGIP-4) so I'm happy to support. But could I ask for a bit of an elaboration on expected use case? If we we update our repository to accomodate this schema/structure, what do you expect to gain? Do you see a L2 network of "HCS validators" that are picking up on all topics/messages using this schema, or something similar? cc @bugbytesinc for his thoughts as the lead dev on the voting system. |
Beta Was this translation helpful? Give feedback.
-
I like this idea. Having a |
Beta Was this translation helpful? Give feedback.
-
Thinking about this and conferring with the team. It would be good to add version numbers in this standard. Also, rather than create a new JSON format, there are standard mechanisms that describe a schema like Avro or Parquet and are more efficient for big data analytics, so it may be valuable to consider these. They've done a lot of work ensuring schemas have fewer mistakes, help in migrations etc. edit:
using a draft07 json schema converter tool with versioning added, I got this
|
Beta Was this translation helpful? Give feedback.
-
It's not clear to me if we are talking only about the HCS message data or strictly the metadata for HCS messages here. Either way, I have some thoughts since they go hand-in-hand. I'm wondering if it wouldn't be better to have a separate schema registry. I can imagine how mixing the data plane and control plane could lead to edge cases that developers have to deal with. Schema RegistryIf there was a schema registry, the process could look like this:
Data FormatsMaybe we should avoid locking anyone into a given data format. HTTP has ways of doing this with its If we don't want to open it up to all types, we could start by supporting a small list of common formats. I don't think all the formats make sense as some formats such as Parquet contain all the schema metadata necessary for each file to be parsed (that's a lot of duplicate data to include in each message), but there are some formats such as JSON that can be validated with side channel mechanisms like JSON Schema or Protobuf, etc. Generally, formats such Avro and Parquet are used to aggregate messages that were transmitted via something like JSON or Protobuf in order to compress them into a chunked file. My suggestion would be not to bin anything into a specific data format as some users may wish to use a more efficient binary format (of which JSON is not an efficient binary format) and instead provide native schema registry functionality. Schema EvolutionLeft for future discussion, it seems reasonable to have safeguards in place that disallow the evolution of schemas that would break backward compatibility for downstream consumers. For example, if users were pumping their topic messages into a data lake or data warehouse, data engineers downstream would be in disfavor of schema evolution that drops a field / column that was previously defined in the schema as a non-null or required field. |
Beta Was this translation helpful? Give feedback.
-
I'd like to be able see more schema choices being available, schema - quroum (where it is just about people being present) now these could be done via choices, but they don't really need to be. also, for certain proposals, a simple 'text' field might not be sufficient for description. (imagine a 10-page budget proposal). we might need some kind of reference link (like IPFS) that could be referenced. |
Beta Was this translation helpful? Give feedback.
-
UPDATE (1/16) :
Since the initial submission of this HIP, we've discussed a lot in the Hedera DAO working group about metadata standards for HCS and have come to the conclusion that i's much more suitable for this HIP to address metadata standards for DAO / Voting use cases only.
Here is the updated proposal metadata object schemas:
Ballot Schema:
Vote Schema:
Using these two formats, here's some examples filling in data for some of the information.
Ballot Example:
This is what a vote on the ballot above could look like.
Vote Example:
Running an initial test ballot in production, these base metadata attributes I believe will help external voting audit sites to easily understand and display the outcome of the votes.
I do want to stress, that adding data to this object for certain use cases shouldn't be restricted by this HIP. The intention of this HIP is only to solidify the minimum required fields to help normalize voting and DAO voting on Hedera using HCS
Initial HIP Message is below.
Hello!
I've been working on a standardization of topic id data for a little and think it's at a place where I'd like to start officially discussing with the community about what the HIP standard should include.
Goal:
Normalize all metadata submitted to topics in a flexible way to provide easy reading ability to third parties while not constraining developers with data structures that don't concern their use case. This will allow external applications to easily read and access any topic ID information without needing to rewrite or re architect software to map to new attributes for every new topic id.
This structure will also help new developers organize the data they need submitted to the topic id without having to guess or make new JSON objects that no other application uses, fragmenting the data sets across topic ids.
Initial Proposed Idea:
First part of the proposal is a header object. This would likely be the first post on a topic id. The header object would give context to the data being logged on this topic id, along with the format of the data. The description, creator, id, and name would all be optional but can help others reading the data understand its purpose and point of origin.
The most important attributes in the header are type and format
type defines this is the header for easy reading of any application
format defines the expected JSON structure of the records contained in messages on this topic id
There will be several default formats proposed in this HIP for dao voting, farming, staking, p2p transactions, auctions, and custom. Each format will use the base attributes of the JSON object below. The root attributes that should be present on every submitted message are type, id, properties.
The configurable portions of this object will reside in the properties object. format attribute will define both the types one should expect in the topic id messages, and the properties object that will exist in each type.
Example:
format: "dao-voting" types:
The examples below use the dao-voting format in practice. This is an adaptation of the Calaxy voting format placed into the structure of the boilerplate object structure being proposed above.
Examples of voting use cases.
First a create ballot call that defines an id and contains properties set out for “create-ballot” type.
Second a cast-vote call that uses the properties set out for “cast-vote” type.
Custom format will allow the most flexibility for future use cases before a HIP defines the format formally.
If format:custom is in the header, the creator of the topic id should then submit a new message with a glossary for the properties and types that will be present in the topic id.
I'm very open to changing and adapting this format and believe it's a great time to start discussing as a community on wants / desires for object definitions inside of HCS messages.
Beta Was this translation helpful? Give feedback.
All reactions