Blind Diffie-Hellmann Key Exchange (BDHKE) implementation in Cairo.
scarb cairo-run --available-gas=200000000
This will run the provided Bitcoin Script in Cairo.
scarb build
This will compile all the components.
scarb test
Taken from RubenSomsen blind ecash Gist.
The goal of this protocol is for Bob to get Alice to perform a Diffie-Hellman key exchange blindly, such that when the unblinded value is returned, Alice recognizes it as her own, but can’t distinguish it from others (i.e. similar to a blind signature).
Alice:
A = a*G
return A
Bob:
Y = hash_to_curve(secret_message)
r = random blinding factor
B'= Y + r*G
return B'
Alice:
C' = a*B'
(= a*Y + a*r*G)
return C'
Bob:
C = C' - r*A
(= C' - a*r*G)
(= a*Y)
return C, secret_message
Alice:
Y = hash_to_curve(secret_message)
C == a*Y
If true, C must have originated from Alice