Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIP374: Discrete Log Equality Proofs (DLEQ) #1689

Merged
merged 24 commits into from
Dec 27, 2024
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4f5d87a
Bip Draft: DLEQ
andrewtoth Oct 24, 2024
0c7e54d
BIP-DLEQ: add reference implementation for secp256k1
theStack Nov 18, 2024
cc7bb12
Add optional message to DLEQ
andrewtoth Dec 9, 2024
ed98dc7
Add some more commentary
andrewtoth Dec 9, 2024
b5d47df
add theStack as co-author
andrewtoth Dec 9, 2024
597004a
Lowercase secp
andrewtoth Dec 11, 2024
e4f1d7b
Remove cbytes wrapper from m'
andrewtoth Dec 11, 2024
b838696
Remove cbytes wrapper from m'
andrewtoth Dec 11, 2024
dab5571
bugfix: respect message m in DLEQ proof generation/verification
theStack Dec 21, 2024
6b16952
Add test vectors for DLEQ proof generation/verification
theStack Dec 20, 2024
1f875a3
Add note about generating and running test vectors
andrewtoth Dec 21, 2024
687198d
Fail if any point is infinity when verifying
andrewtoth Dec 21, 2024
f5d1c12
Add acknowledgements
andrewtoth Dec 21, 2024
fd60d8e
Add description of proof
andrewtoth Dec 21, 2024
90e7027
Remove changelog
andrewtoth Dec 21, 2024
0b590d0
Add footnote recommending using fresh randomness for each proof
andrewtoth Dec 21, 2024
a0d8aad
Fix typo
andrewtoth Dec 21, 2024
5799659
Update bip-DLEQ.mediawiki
andrewtoth Dec 26, 2024
b533b92
Update bip-DLEQ.mediawiki
andrewtoth Dec 26, 2024
1350bc4
BIP374
andrewtoth Dec 26, 2024
9d6dc6b
Update README table, post-history, and comments-uri
andrewtoth Dec 26, 2024
1842120
Clarify restraints on given points
andrewtoth Dec 26, 2024
cb3afee
Move test vectors to bip-0374 directory, add tests for G
andrewtoth Dec 26, 2024
248540e
fix typo
andrewtoth Dec 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions bip-DLEQ.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ All conventions and notations are used as defined in [https://github.com/bitcoin

=== DLEQ Proof Generation ===

The following generates a proof that the result of ''a⋅B'' and the result of ''a⋅G'' are both generated from the same scalar ''a'' without having to reveal ''a''.

Input:
* The secret key ''a'': a 256-bit unsigned integer
* The public key ''B'': a point on the curve
* The generator point ''G'': a point on the curve
* Auxiliary random data ''r'': a 32-byte array
andrewtoth marked this conversation as resolved.
Show resolved Hide resolved
* An optional message ''m'': a 32-byte array
* The generator point ''G'': a point on the curve<ref name="why_include_G"> ''' Why include the generator point G as an input?''' While all other BIPs have used the generator point from Secp256k1, passing it as an input here lets this algorithm be used for other curves.</ref>
andrewtoth marked this conversation as resolved.
Show resolved Hide resolved
* An optional message ''m'': a 32-byte array<ref name="why_include_a_message"> ''' Why include a message as an input?''' This could be useful for protocols that want to authorize on a compound statement, not just knowledge of a scalar. This allows the protocol to combine knowledge of the scalar and the statement.</ref>

The algorithm ''GenerateProof(a, B, r)'' is defined as:
The algorithm ''GenerateProof(a, B, r, G, m)'' is defined as:
* Fail if ''a = 0'' or ''a &ge; n''.
* Fail if ''is_infinite(B)''.
* Let ''A = a⋅G''.
Expand All @@ -60,15 +62,17 @@ The algorithm ''GenerateProof(a, B, r)'' is defined as:

=== DLEQ Proof Verification ===

The following verifies the proof generated in the previous section. If the following algorithm succeeds, the points ''A'' and ''C'' were both generated from the same scalar. The former from multiplying by ''G'', and the latter from multiplying by ''B''.

Input:
* The public key of the secret key used in the proof generation ''A'': a point on the curve
* The public key used in the proof generation ''B'': a point on the curve
* The result of multiplying the secret and public keys used in the proof generation ''C'': a point on the curve
* The generator point used in the proof generation ''G'': a point on the curve
* A proof ''proof'': a 64-byte array
* An optional message ''m'': a 32-byte array
* The generator point used in the proof generation ''G'': a point on the curve<ref name="why_include_G"> ''' Why include the generator point G as an input?''' While all other BIPs have used the generator point from Secp256k1, passing it as an input here lets this algorithm be used for other curves.</ref>
* An optional message ''m'': a 32-byte array<ref name="why_include_a_message"> ''' Why include a message as an input?''' This could be useful for protocols that want to authorize on a compound statement, not just knowledge of a scalar. This allows the protocol to combine knowledge of the scalar and the statement.</ref>

The algorithm ''VerifyProof(A, B, C, G, proof)'' is defined as:
The algorithm ''VerifyProof(A, B, C, proof, G, m)'' is defined as:
* Let ''e = int(proof[0:32])''.
* Let ''s = int(proof[32:64])''; fail if ''s &ge; n''.
* Let ''R<sub>1</sub> = s⋅G - e⋅A''.
Expand All @@ -79,9 +83,13 @@ The algorithm ''VerifyProof(A, B, C, G, proof)'' is defined as:
* Fail if ''e ≠ int(hash<sub>BIP0???/challenge</sub>(cbytes(A) || cbytes(B) || cbytes(C) || cbytes(G) || cbytes(R<sub>1</sub>) || cbytes(R<sub>2</sub>) || cbytes(m')))''.
* Return success iff no failure occurred before reaching this point.

==Backwards Compatibility==

This proposal is compatible with all older clients.

== Test Vectors and Reference Code ==

TBD
A reference python implementation is included [./bip-DLEQ/reference.py here].

== Changelog ==
andrewtoth marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
Loading