Skip to main content
Version: v2.x

Commands and Messages

Command

A command represents an action that a user may take, such as casting a vote in a poll or changing their public key if bribed. It is made up of the following parameters:

SymbolNameSizeDescription
cmicm_iState index50State leaf index where the signing key is located
cmpxcm_{p_{x}}Public key x-coordinate253If no change is necessary this parameter should reflect the current public key's x-coordinate
cmpycm_{p_{y}}Public key y-coordinate253If no change is necessary this parameter should reflect the current public key's y-coordinate
cmivcm_{i_{v}}Vote option index50Option state leaf index of preference to assign the vote for
cmwcm_wVoting weight50Voice credit balance allocation, this is an arbitrary value dependent on a user's available credits
cmncm_nNonce50State leaf's index of actions committed plus one
cmidcm_{id}Poll id50The poll's identifier to cast in regard to
cmscm_sSalt253An entropy value to inhibit brute force attacks

Message

A message is an encrypted command using the shared key ksk_s between the voter and the coordinator. The plaintext tt is computed as such:

t=[p,cmpx,cmpy,cms,R8[0],R8[1],S]t = [p, cm_{p_{x}}, cm_{p_{y}}, cm_s, R8[0], R8[1], S]

While the message can be computed with the formula below:

MM = poseidonEncrypt(ks[0],ks[1],cmn,7,t){poseidonEncrypt}(k_s[0], k_s[1], cm_n, 7, t)

Decrypting a message

To decrypt a message using ksk_s we have the following:

[p,R8[0],R8[1],cms][p, R8[0], R8[1], cm_s] = poseidonDecrypt(M,ks[0],ks[1],cmn,7){poseidonDecrypt}(M, k_s[0], k_s[1], cm_n, 7)

To unpack pp to its original five parameters, it must be separated into 50 bit values from the parent 250 bit value. To extract 50 bits at byte nn, we:

  1. initialise 50 bits
  2. shift left by nn bits
  3. bitwise AND with pp
  4. shift right by nn bits