|
| 1 | +--- |
| 2 | +Title: Jörmungandr Voting Transaction (Historical) |
| 3 | +Authors: |
| 4 | + - Alex Pozhylenkov <[email protected]> |
| 5 | +Created: 2024-10-24 |
| 6 | +License: [CC-BY-4.0] |
| 7 | +--- |
| 8 | + |
| 9 | +## Abstract |
| 10 | + |
| 11 | +This document describes a definition of the original Jörmungandr `VoteCast` transaction. |
| 12 | +It's documented here for its historical context and to provide more information with regard to the |
| 13 | +basis of the construction of the ballot documents in this specification only. |
| 14 | + |
| 15 | +## Motivation |
| 16 | + |
| 17 | +## Specification |
| 18 | + |
| 19 | +An original Jörmungandr blockchain's `VoteCast` transaction structure. |
| 20 | + |
| 21 | +<!-- markdownlint-disable max-one-sentence-per-line code-block-style --> |
| 22 | +??? note "V1 transaction definition: `jorm.abnf`" |
| 23 | + |
| 24 | + ```abnf |
| 25 | + VOTE-TX = SIZE-BYTES-32BIT %x00 %x0b VOTE-PAYLOAD |
| 26 | + |
| 27 | + VOTE-PAYLOAD = CAST-CERT IOW |
| 28 | + CAST-CERT = VOTE-PLAN-ID PROPOSAL-INDEX CAST-PAYLOAD |
| 29 | + |
| 30 | + VOTE-PLAN-ID = SIZE-BYTES-32BYTE ; Jörmungandr specific vote plan identifier, Blake2b hash of the vote plan bytes |
| 31 | + PROPOSAL-INDEX = U8 ; Jörmungandr specific proposal identifier |
| 32 | + CAST-PAYLOAD = %x01 CHOICE ; Public payload |
| 33 | + / %x02 ENCRYPTED-VOTE PROOF-VOTE ; Private payload |
| 34 | + |
| 35 | + CHOICE = U8 |
| 36 | + ENCRYPTED-VOTE = SIZE-BYTES-8BIT *CIPHERTEXT |
| 37 | + PROOF-VOTE = SIZE-BYTES-8BIT *ANNOUNCEMENT *CIPHERTEXT *R-RESPONSE SCALAR ; size of the *ANNOUNCEMENT, *CIPHERTEXT, *R-RESPONSE are equal to SIZE-BYTES-8BIT value |
| 38 | + |
| 39 | + CIPHERTEXT = E1 E2 |
| 40 | + ANNOUNCEMENT = I A B |
| 41 | + R-RESPONSE = 3 * SCALAR |
| 42 | + I = GROUP-ELEMENT |
| 43 | + A = GROUP-ELEMENT |
| 44 | + B = GROUP-ELEMENT |
| 45 | + E1 = GROUP-ELEMENT |
| 46 | + E2 = GROUP-ELEMENT |
| 47 | + |
| 48 | + ; #################### |
| 49 | + ; IOW stand for Inputs-Outputs-Witnesses |
| 50 | + ; #################### |
| 51 | + |
| 52 | + IOW = BLOCK-DATE |
| 53 | + %x01 ; number of inputs and witness |
| 54 | + %x00 ; number of outputs |
| 55 | + INPUT ; one input |
| 56 | + WITNESS ; one witness |
| 57 | + |
| 58 | + INPUT = %xff |
| 59 | + VALUE |
| 60 | + ED25519-PUBLICKEY |
| 61 | + |
| 62 | + WITNESS = %x02 |
| 63 | + NONCE |
| 64 | + ED25519-SIGNATURE |
| 65 | + |
| 66 | + VALUE = U64 ; could be anything, not processed anymore, recommended set to zero |
| 67 | + NONCE = U32 ; could be anything, not processed anymore, recommended set to zero |
| 68 | + BLOCK-DATE = BLOCK-EPOCH BLOCK-SLOT ; expiration date, could be anything, not processed anymore, recommended set to zeros |
| 69 | + BLOCK-EPOCH = U32 |
| 70 | + BLOCK-SLOT = U32 |
| 71 | + |
| 72 | + ; #################### |
| 73 | + ; CRYPTO |
| 74 | + ; #################### |
| 75 | + |
| 76 | + ED25519-PUBLICKEY = SIZE-BYTES-32BYTE |
| 77 | + ED25519-SIGNATURE = SIZE-BYTES-64BYTE |
| 78 | + |
| 79 | + ; #################### |
| 80 | + ; PRIMITIVES |
| 81 | + ; #################### |
| 82 | + |
| 83 | + SIZE-BYTES-8BIT = U8 ; size in elements (8 bits) |
| 84 | + SIZE-BYTES-16BIT = U16 ; size in bytes (16 bits) |
| 85 | + SIZE-BYTES-32BIT = U32 ; size in bytes (32 bits) |
| 86 | + U8 = OCTET ; unsigned integer 8 bit |
| 87 | + U16 = 2OCTET ; unsigned integer 16 bit (BE) |
| 88 | + U32 = 4OCTET ; unsigned integer 32 bit (BE) |
| 89 | + U64 = 8OCTET ; unsigned integer 64 bit (BE) |
| 90 | + SIZE-BYTES-32BYTE = 32OCTET ; unsigned integer 256 bit (32 bytes) (BE) |
| 91 | + SIZE-BYTES-64BYTE = 64OCTET ; unsigned integer 512 bit (64 bytes) (BE) |
| 92 | + SIZE-BYTES-65BYTE = 65OCTET ; unsigned integer 520 bit (65 bytes) (BE) |
| 93 | + SCALAR = SIZE-BYTES-32BYTE |
| 94 | + GROUP-ELEMENT = SIZE-BYTES-32BYTE ; ristretto255 group element |
| 95 | + ``` |
| 96 | +<!-- markdownlint-enable max-one-sentence-per-line code-block-style --> |
| 97 | + |
| 98 | +### Example |
| 99 | + |
| 100 | +V1 transaction representation in hex: |
| 101 | + |
| 102 | +<!-- markdownlint-disable code-block-style --> |
| 103 | +```hex |
| 104 | +0000037e000b36ad42885189a0ac3438cdb57bc8ac7f6542e05a59d1f2e4d1d38194c9d4ac7b00 |
| 105 | +0203f6639bdbc9235103825a9f025eae5cff3bd9c9dcc0f5a4b286909744746c8b6fb0018773d3 |
| 106 | +b4308344d2e90599cd03749658561787eab714b542a5ccaf078846f6639bdbc9235103825a9f02 |
| 107 | +5eae5cff3bd9c9dcc0f5a4b286909744746c8b6fc8f58976fc0e951ba284a24f3fc190d914ae53 |
| 108 | +aebcc523e7a4a330c8655b4908f6639bdbc9235103825a9f025eae5cff3bd9c9dcc0f5a4b28690 |
| 109 | +9744746c8b6fb0018773d3b4308344d2e90599cd03749658561787eab714b542a5ccaf07884602 |
| 110 | +1c76d0a50054ef7205cb95c1fd3f928f224fab8a8d70feaf4f5db90630c3845a06df2f11c881e3 |
| 111 | +96318bd8f9e9f135c2477e923c3decfd6be5466d6166fb3c702edd0d1d0a201fb8c51a91d01328 |
| 112 | +da257971ca78cc566d4b518cb2cd261f96644067a7359a745fe239db8e73059883aece4d506be7 |
| 113 | +1c1262b137e295ce5f8a0aac22c1d8d343e5c8b5be652573b85cba8f4dcb46cfa4aafd8d59974e |
| 114 | +2eb65f480cf85ab522e23203c4f2faa9f95ebc0cd75b04f04fef5d4001d349d1307bb5570af4a9 |
| 115 | +1d8af4a489297a3f5255c1e12948787271275c50386ab2ef3980d882228e5f3c82d386e6a4ccf7 |
| 116 | +663df5f6bbd9cbbadd6b2fea2668a8bf5603be29546152902a35fc44aae80d9dcd85fad6cde5b4 |
| 117 | +7a6bdc6257c5937f8de877d5ca0356ee9f12a061e03b99ab9dfea56295485cb5ce38cd37f56c39 |
| 118 | +6949f58b0627f455d26e4c5ff0bc61ab0ff05ffa07880d0e5c540bc45b527e8e85bb1da469935e |
| 119 | +0d3ada75d7d41d785d67d1d0732d7d6cbb12b23bfc21dfb4bbe3d933eaa1e5190a85d6e028706a |
| 120 | +b18d262375dd22a7c1a0e7efa11851ea29b4c92739aaabfee40353453ece16bda2f4a2c2f86e6b |
| 121 | +37f6de92dc45dba2eb811413c4af2c89f5fc0859718d7cd9888cd8d813da2e93726484ea5ce5be |
| 122 | +8ecf1e1490b874bd897ccd0cbc33db0a1751f813683724b7f5cf750f2497953607d1e82fb5d142 |
| 123 | +9cbfd7a40ccbdba04fb648203c91e0809e497e80e9fad7895b844ba6da6ac690c7ce49c10e0000 |
| 124 | +0000000000000100ff00000000000000036d2ac8ddbf6eaac95401f91baca7f068e3c237386d7c |
| 125 | +9a271f5187ed909155870200000000e6c8aa48925e37fdab75db13aca7c4f39068e12eeb3af8fd |
| 126 | +1f342005cae5ab9a1ef5344fab2374e9436a67f57041899693d333610dfe785d32998873679795 |
| 127 | +0d |
| 128 | +``` |
| 129 | +<!-- markdownlint-enable code-block-style --> |
| 130 | + |
| 131 | +<!-- markdownlint-disable line-length code-block-style --> |
| 132 | +1. Transaction size (u32): `0000037e` |
| 133 | +2. Jörmungandr specific tag (u8): `00` |
| 134 | +3. Jörmungandr specific tag (u8): `0b` |
| 135 | +4. Vote plan id (32 byte hash): `36ad42885189a0ac3438cdb57bc8ac7f6542e05a59d1f2e4d1d38194c9d4ac7b` |
| 136 | +5. Proposal index (u8): `00` |
| 137 | +6. Payload type tag (u8): `02` |
| 138 | +7. Encrypted vote: |
| 139 | +`03|f6639bdbc9235103825a9f025eae5cff3bd9c9dcc0f5a4b286909744746c8b6f|b0018773d3b4308344d2e90599cd03749658561787eab714b542a5ccaf078846|f6639bdbc9235103825a9f025eae5cff3bd9c9dcc0f5a4b286909744746c8b6f|c8f58976fc0e951ba284a24f3fc190d914ae53aebcc523e7a4a330c8655b4908|f6639bdbc9235103825a9f025eae5cff3bd9c9dcc0f5a4b286909744746c8b6f|b0018773d3b4308344d2e90599cd03749658561787eab714b542a5ccaf078846` |
| 140 | + * size (u8): `03` |
| 141 | + * ciphertext (group element (32 byte), group element (32 byte)): `f6639bdbc9235103825a9f025eae5cff3bd9c9dcc0f5a4b286909744746c8b6f|b0018773d3b4308344d2e90599cd03749658561787eab714b542a5ccaf078846|f6639bdbc9235103825a9f025eae5cff3bd9c9dcc0f5a4b286909744746c8b6f|c8f58976fc0e951ba284a24f3fc190d914ae53aebcc523e7a4a330c8655b4908|f6639bdbc9235103825a9f025eae5cff3bd9c9dcc0f5a4b286909744746c8b6f|b0018773d3b4308344d2e90599cd03749658561787eab714b542a5ccaf078846` |
| 142 | +8. Proof: `02|1c76d0a50054ef7205cb95c1fd3f928f224fab8a8d70feaf4f5db90630c3845a|06df2f11c881e396318bd8f9e9f135c2477e923c3decfd6be5466d6166fb3c70|2edd0d1d0a201fb8c51a91d01328da257971ca78cc566d4b518cb2cd261f9664|4067a7359a745fe239db8e73059883aece4d506be71c1262b137e295ce5f8a0a|ac22c1d8d343e5c8b5be652573b85cba8f4dcb46cfa4aafd8d59974e2eb65f48|0cf85ab522e23203c4f2faa9f95ebc0cd75b04f04fef5d4001d349d1307bb557|0af4a91d8af4a489297a3f5255c1e12948787271275c50386ab2ef3980d88222|8e5f3c82d386e6a4ccf7663df5f6bbd9cbbadd6b2fea2668a8bf5603be295461|52902a35fc44aae80d9dcd85fad6cde5b47a6bdc6257c5937f8de877d5ca0356|ee9f12a061e03b99ab9dfea56295485cb5ce38cd37f56c396949f58b0627f455|d26e4c5ff0bc61ab0ff05ffa07880d0e5c540bc45b527e8e85bb1da469935e0d|3ada75d7d41d785d67d1d0732d7d6cbb12b23bfc21dfb4bbe3d933eaa1e5190a|85d6e028706ab18d262375dd22a7c1a0e7efa11851ea29b4c92739aaabfee403|53453ece16bda2f4a2c2f86e6b37f6de92dc45dba2eb811413c4af2c89f5fc08|59718d7cd9888cd8d813da2e93726484ea5ce5be8ecf1e1490b874bd897ccd0c|bc33db0a1751f813683724b7f5cf750f2497953607d1e82fb5d1429cbfd7a40c|cbdba04fb648203c91e0809e497e80e9fad7895b844ba6da6ac690c7ce49c10e` |
| 143 | + * size (u8): `02` |
| 144 | + * announcements (group element (32 byte), group element (32 byte), group element (32 byte)): `1c76d0a50054ef7205cb95c1fd3f928f224fab8a8d70feaf4f5db90630c3845a|06df2f11c881e396318bd8f9e9f135c2477e923c3decfd6be5466d6166fb3c70|2edd0d1d0a201fb8c51a91d01328da257971ca78cc566d4b518cb2cd261f9664|4067a7359a745fe239db8e73059883aece4d506be71c1262b137e295ce5f8a0a|ac22c1d8d343e5c8b5be652573b85cba8f4dcb46cfa4aafd8d59974e2eb65f48|0cf85ab522e23203c4f2faa9f95ebc0cd75b04f04fef5d4001d349d1307bb557` |
| 145 | + * ciphertext (group element (32 byte), group element (32 byte)): `0af4a91d8af4a489297a3f5255c1e12948787271275c50386ab2ef3980d88222|8e5f3c82d386e6a4ccf7663df5f6bbd9cbbadd6b2fea2668a8bf5603be295461|52902a35fc44aae80d9dcd85fad6cde5b47a6bdc6257c5937f8de877d5ca0356|ee9f12a061e03b99ab9dfea56295485cb5ce38cd37f56c396949f58b0627f455` |
| 146 | + * response randomness (scalar (32 byte), scalar (32 byte), scalar (32 byte)): `d26e4c5ff0bc61ab0ff05ffa07880d0e5c540bc45b527e8e85bb1da469935e0d|3ada75d7d41d785d67d1d0732d7d6cbb12b23bfc21dfb4bbe3d933eaa1e5190a|85d6e028706ab18d262375dd22a7c1a0e7efa11851ea29b4c92739aaabfee403|53453ece16bda2f4a2c2f86e6b37f6de92dc45dba2eb811413c4af2c89f5fc08|59718d7cd9888cd8d813da2e93726484ea5ce5be8ecf1e1490b874bd897ccd0c|bc33db0a1751f813683724b7f5cf750f2497953607d1e82fb5d1429cbfd7a40c` |
| 147 | + * scalar (32 byte): `cbdba04fb648203c91e0809e497e80e9fad7895b844ba6da6ac690c7ce49c10e` |
| 148 | +9. `IOW` stand for Inputs-Outputs-Witnesses: `00000000000000000100ff00000000000000036d2ac8ddbf6eaac95401f91baca7f068e3c237386d7c9a271f5187ed909155870200000000e6c8aa48925e37fdab75db13aca7c4f39068e12eeb3af8fd1f342005cae5ab9a1ef5344fab2374e9436a67f57041899693d333610dfe785d329988736797950d` |
| 149 | + * Jörmungandr specific block date (epoch (u32), slot (u32)) |
| 150 | + (*could be anything, not processed anymore*): `00000000|00000000` |
| 151 | + * number of inputs and witnesses (u8) (**always** `1`): `01` |
| 152 | + * number of outputs (u8) (**always** `0`): `00` |
| 153 | + * Inputs |
| 154 | + 1. |
| 155 | + * Jörmungandr specific tag: `ff` |
| 156 | + * Jörmungandr specific value (u64) (*could be anything, not processed anymore*): `0000000000000003` |
| 157 | + * input pointer (32 byte): `6d2ac8ddbf6eaac95401f91baca7f068e3c237386d7c9a271f5187ed90915587` |
| 158 | + * Witnesses |
| 159 | + 1. |
| 160 | + * Jörmungandr specific tag (u8): `02` |
| 161 | + * Jörmungandr specific nonce (u32) (*could be anything, not processed anymore*): `00000000` |
| 162 | + * legacy signature (64 byte): `e6c8aa48925e37fdab75db13aca7c4f39068e12eeb3af8fd1f342005cae5ab9a1ef5344fab2374e9436a67f57041899693d333610dfe785d329988736797950d` |
| 163 | +<!-- markdownlint-enable max-one-sentence-per-line code-block-style --> |
| 164 | + |
| 165 | +### Vote generation |
| 166 | + |
| 167 | +To generate a cryptographically secured `ENCRYPTED-VOTE` and `PROOF-VOTE` parts you can follow this [spec](./crypto.md#vote). |
| 168 | +Important to note, |
| 169 | +that as part of [*initial setup*](./crypto.md#initial-setup) of the voting procedure, |
| 170 | +the following properties are used: |
| 171 | + |
| 172 | +1. Each proposal, defined by the `VOTE-PLAN-ID` and `PROPOSAL-INDEX`, defines a number of possible options. |
| 173 | +2. [ristretto255] as a backend cryptographic group. |
| 174 | +3. A commitment key $ck$ defined as a [BLAKE2b-512] hash of the `VOTE-PLAN-ID` bytes. |
| 175 | + |
| 176 | +### Signing (witness generation) |
| 177 | + |
| 178 | +Signature generated from the [BLAKE2b-256] hashed `VOTE-PAYLOAD` bytes except of the `WITNESS` part |
| 179 | +(the last part from the bytes array): |
| 180 | + |
| 181 | +1. `CAST-CERT` bytes |
| 182 | +2. `BLOCK-DATE` bytes |
| 183 | +3. `%x01` |
| 184 | +4. `%x00` |
| 185 | +5. `INPUT` bytes |
| 186 | + |
| 187 | +Based on the on the transaction example, data to sign: |
| 188 | + |
| 189 | +<!-- markdownlint-disable code-block-style --> |
| 190 | +```hex |
| 191 | +36ad42885189a0ac3438cdb57bc8ac7f6542e05a59d1f2e4d1d38194c9d4ac7b000203f6639bdbc9235103825a9f025eae5cff3bd9c9dcc0f5a4b286909744746c8b6fb0018773d3b4308344d2e90599cd03749658561787eab714b542a5ccaf078846f6639bdbc9235103825a9f025eae5cff3bd9c9dcc0f5a4b286909744746c8b6fc8f58976fc0e951ba284a24f3fc190d914ae53aebcc523e7a4a330c8655b4908f6639bdbc9235103825a9f025eae5cff3bd9c9dcc0f5a4b286909744746c8b6fb0018773d3b4308344d2e90599cd03749658561787eab714b542a5ccaf078846021c76d0a50054ef7205cb95c1fd3f928f224fab8a8d70feaf4f5db90630c3845a06df2f11c881e396318bd8f9e9f135c2477e923c3decfd6be5466d6166fb3c702edd0d1d0a201fb8c51a91d01328da257971ca78cc566d4b518cb2cd261f96644067a7359a745fe239db8e73059883aece4d506be71c1262b137e295ce5f8a0aac22c1d8d343e5c8b5be652573b85cba8f4dcb46cfa4aafd8d59974e2eb65f480cf85ab522e23203c4f2faa9f95ebc0cd75b04f04fef5d4001d349d1307bb5570af4a91d8af4a489297a3f5255c1e12948787271275c50386ab2ef3980d882228e5f3c82d386e6a4ccf7663df5f6bbd9cbbadd6b2fea2668a8bf5603be29546152902a35fc44aae80d9dcd85fad6cde5b47a6bdc6257c5937f8de877d5ca0356ee9f12a061e03b99ab9dfea56295485cb5ce38cd37f56c396949f58b0627f455d26e4c5ff0bc61ab0ff05ffa07880d0e5c540bc45b527e8e85bb1da469935e0d3ada75d7d41d785d67d1d0732d7d6cbb12b23bfc21dfb4bbe3d933eaa1e5190a85d6e028706ab18d262375dd22a7c1a0e7efa11851ea29b4c92739aaabfee40353453ece16bda2f4a2c2f86e6b37f6de92dc45dba2eb811413c4af2c89f5fc0859718d7cd9888cd8d813da2e93726484ea5ce5be8ecf1e1490b874bd897ccd0cbc33db0a1751f813683724b7f5cf750f2497953607d1e82fb5d1429cbfd7a40ccbdba04fb648203c91e0809e497e80e9fad7895b844ba6da6ac690c7ce49c10e00000000000000000100ff00000000000000036d2ac8ddbf6eaac95401f91baca7f068e3c237386d7c9a271f5187ed90915587 |
| 192 | +``` |
| 193 | +<!-- markdownlint-enable code-block-style --> |
| 194 | + |
| 195 | +[BLAKE2b-256] hash of the transaction data to sign equals to `f51473df863be3e0383ce5a8da79c7ff51b3d98dadbbefbf9f042e8601901269` |
| 196 | + |
| 197 | +Expected witness (includes signature) |
| 198 | + |
| 199 | +<!-- markdownlint-disable code-block-style --> |
| 200 | +```hex |
| 201 | +0200000000e6c8aa48925e37fdab75db13aca7c4f39068e12eeb3af8fd1f342005cae5ab9a1ef5344fab2374e9436a67f57041899693d333610dfe785d329988736797950d |
| 202 | +``` |
| 203 | +<!-- markdownlint-enable code-block-style --> |
| 204 | + |
| 205 | +## Rationale |
| 206 | + |
| 207 | +## Path to Active |
| 208 | + |
| 209 | +### Acceptance Criteria |
| 210 | +<!-- Describes what are the acceptance criteria whereby a proposal becomes 'Active' --> |
| 211 | + |
| 212 | +### Implementation Plan |
| 213 | +<!-- A plan to meet those criteria or `N/A` if an implementation plan is not applicable. --> |
| 214 | + |
| 215 | +<!-- OPTIONAL SECTIONS: see CIP-0001 > Document > Structure table --> |
| 216 | + |
| 217 | +[BLAKE2b-256]: https://www.blake2.net/blake2.pdf |
| 218 | +[BLAKE2b-512]: https://www.blake2.net/blake2.pdf |
| 219 | +[ristretto255]: https://ristretto.group |
0 commit comments