Skip to content

Commit b0efaa8

Browse files
committed
add new tx v2 spec
1 parent 29a4988 commit b0efaa8

File tree

3 files changed

+51
-8
lines changed

3 files changed

+51
-8
lines changed

docs/src/architecture/08_concepts/catalyst_voting/crypto.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ Before any voting will start an initial setup procedure should be performed.
6565
* As most of the crypto algorithms are group dependent
6666
(more about this you can read in [appendix A](#a-group-definition)),
6767
it is needed to specifically define which cryptographically secure group would be used.
68-
* Define a hash function which will be used by the underlying crypto algorithms.
6968
* Define a commitment key $ck$,
7069
which will be used during the voter proof generation and verification procedures.
7170

@@ -502,7 +501,7 @@ To compute it, prover needs to perform the next steps:
502501
* $A_l = g^{i_l * \beta_l} \circ ck^{\delta_l}, A_l \in \mathbb{G}$.
503502
5. Calculate a first verifier challenge
504503
$ch_1 = H(ck, pk, \{c_j\}, \{I_l\}, \{B_l\}, \{A_l\})$,
505-
where $H$ is a hash function,
504+
where $H$ is [BLAKE2b-512] hash function,
506505
$j \in [0, \ldots, N-1]$
507506
and $l \in [0, \ldots, log_2(N)-1]$.
508507
6. For $j \in [0, \ldots, N-1]$ calculate polynomials
@@ -518,7 +517,7 @@ To compute it, prover needs to perform the next steps:
518517
and $p_{j,l}$ - corresponding coefficients of the polynomial $p_j(x)$ calculated on step `7`.
519518
9. Calculate a second verifier challenge
520519
$ch_2 = H(ch_1, \{D_l\})$,
521-
where $H$ is a hash function
520+
where $H$ is [BLAKE2b-512] hash function
522521
and $l \in [0, \ldots, log_2(N)-1]$.
523522
10. For $l \in [0, \ldots, log_2(N)-1]$ calculate:
524523
* $z_l = i_l * ch_2 + \beta_l, z_l \in \mathbb{Z}_q$.
@@ -558,12 +557,12 @@ verifier needs to perform the next steps:
558557
So the resulted $\mathbf{c} = (c_1, \ldots, c_M, \{c_j\})$.
559558
2. Calculate the first verifier challenge
560559
$ch_1 = H(ck, pk, \{c_j\}, \{I_l\}, \{B_l\}, \{A_l\})$,
561-
where $H$ is a hash function,
560+
where $H$ is [BLAKE2b-512] hash function,
562561
$j \in [0, \ldots, N-1]$
563562
and $l \in [0, \ldots, log_2(N)-1]$.
564563
3. Calculate a second verifier challenge
565564
$ch_2 = H(ch_1, \{D_l\})$,
566-
where $H$ is a hash function
565+
where $H$ is [BLAKE2b-512] hash function
567566
and $l \in [0, \ldots, log_2(N)-1]$.
568567
4. For $l \in [0, \ldots, log_2(N)-1]$ verify that the following statements are `true`,
569568
where $g$ is the group generator:
@@ -683,3 +682,4 @@ If step `6` returns `true` so the final result is `true` otherwise return `false
683682
[treasury_system_paper]: https://eprint.iacr.org/2018/435.pdf
684683
[treasury_system_spec]: https://github.com/input-output-hk/treasury-crypto/blob/master/docs/voting_protocol_spec/Treasury_voting_protocol_spec.pdf
685684
[crypto_book]: https://gnanavelrec.wordpress.com/wp-content/uploads/2019/06/2.understanding-cryptography-by-christof-paar-.pdf
685+
[BLAKE2b-512]: https://www.blake2.net/blake2.pdf

docs/src/architecture/08_concepts/catalyst_voting/transaction.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Transaction
1+
# Transactions
22

33
---
44

5-
Title: Voting Transaction
5+
Title: Voting Transactions
66

77
Status: Proposed
88

@@ -87,7 +87,6 @@ the following properties are used:
8787

8888
1. Each proposal, defined by the "Vote plan id" and "Proposal index", defines a number of possible options.
8989
2. [ristretto255] as a backend cryptographic group.
90-
3. [BLAKE2b-512] hash function.
9190
4. A commitment key $ck$ defined as a [BLAKE2b-512] hash of the "Vote plan id" bytes.
9291

9392
#### Transaction signing (witness generation)
@@ -119,6 +118,16 @@ Expected witness (includes signature)
119118
```
120119
<!-- markdownlint-enable code-block-style -->
121120

121+
### v2
122+
123+
<!-- markdownlint-disable max-one-sentence-per-line code-block-style -->
124+
??? note "V2 vote transaction definition: `tx_v1.abnf`"
125+
126+
```CDDL
127+
{{ include_file('src/architecture/08_concepts/catalyst_voting/tx_v2.cddl', indent=4) }}
128+
```
129+
<!-- markdownlint-enable max-one-sentence-per-line code-block-style -->
130+
122131
## Rationale
123132

124133
## Path to Active
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
vote_tx = [
2+
network_id: UUID, ; e.g. Midnight, Catalyst etc.
3+
campaign_id: UUID, ; e.g. Fund 1, Fund 2 etc.
4+
challenge_info,
5+
votes,
6+
]
7+
8+
challenge_info = [
9+
challenge_id: UUID,
10+
proposals: ? [+ UUID],
11+
]
12+
13+
votes = [+ vote]
14+
vote = (public_vote / private_vote)
15+
16+
public_vote = [2* bool]
17+
; public_vote = [2* scalar]
18+
; public_vote = [2* bytes]
19+
private_vote = [2* (encrypted_vote, vote_proof)]
20+
21+
encrypted_vote = ciphertext
22+
vote_proof = ( [2* (announcement, ciphertext, r_response)], scalar)
23+
24+
ciphertext = (group_element, group_element)
25+
announcement = (group_element, group_element, group_element)
26+
r_response = (scalar, scalar, scalar)
27+
28+
; encrypted_vote = bytes
29+
; vote_proof = bytes
30+
31+
scalar = (bytes .size 32)
32+
group_element = (bytes .size 32)
33+
34+
UUID = #6.37(bytes) ; UUID type

0 commit comments

Comments
 (0)