๐Survey Commitment Protocol
YOVO (you only vote once)
Last updated
YOVO (you only vote once)
Last updated
A specific survey is indexed by the root hash of the Merkle tree of its components. Hence, the survey body (referenced by the ๐ฌ query parameter), the deadline timestamp (referenced by the โฐparameter), and the survey options (i.e. ๐ณ๏ธ1, ๐ณ๏ธ2, ...) each represent a leaf of a Merkle tree. Depending on the number of outcome choices of a survey, the number of leaves may need to be padded (with the string '0') to the next closest power of 2. This locks a survey to a specific wording, specific outcome choices, and a well defined deadline in a data structure which can be utilized in a smart contract or zero-knowledge circuit.
When a survey participant commits to a prediction, a random string is generated (often referred to as cryptographic salt). The salt is concatenated with the string content corresponding to the predicted outcome they believe is most likely and the Merkle root of the survey. This concatenated string is then hashed and serves as the prediction commitment, tying the responder to a specific prediction for a specific survey that cannot be revealed unless the salt value is known.
This prediction hash should be posted to the blockchain in a nested key-value store. The outer key should be the Merkle root of the survey, with the outer value being a key-value pair mapping an identity public key to a prediction commitment. The hash must be written before the survey deadline.
A survey responder may prove their choice at a later date by simply revealing the salt belonging to their commitment. If the survey responder would rather keep their historical choices concealed, this requires a proof of membership circuit to be run on a combination of the commitment hash and the leaf corresponding to the participants choice. This zk circuit is discussed in section Zero-Knowledge Score Verification.