Merge pull request #55 from cashubtc/comments/add

comments
This commit is contained in:
calle
2022-11-26 01:58:20 +01:00
committed by GitHub
4 changed files with 19 additions and 6 deletions

View File

@@ -2,23 +2,28 @@
"""
Implementation of https://gist.github.com/RubenSomsen/be7a4760dd4596d06963d67baf140406
Alice:
Alice (Client):
A = a*G
return A
Bob:
Bob (Mint):
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

View File

@@ -14,7 +14,9 @@ class P2SHScript(BaseModel):
class Proof(BaseModel):
id: Union[None, str] = ""
id: Union[
None, str
] = "" # NOTE: None for backwards compatibility of old clients < 0.3
amount: int = 0
secret: str = ""
C: str = ""

View File

@@ -4,8 +4,12 @@ from secp256k1 import PublicKey
def hash_to_point_pre_0_3_3(secret_msg):
"""Generates x coordinate from the message hash and checks if the point lies on the curve.
If it does not, it tries computing again a new x coordinate from the hash of the coordinate."""
"""
NOTE: Clients pre 0.3.3 used a different hash_to_curve
Generates x coordinate from the message hash and checks if the point lies on the curve.
If it does not, it tries computing again a new x coordinate from the hash of the coordinate.
"""
point = None
msg = secret_msg
while point is None:

View File

@@ -104,8 +104,10 @@ async def split(
"""
proofs = payload.proofs
amount = payload.amount
# NOTE: backwards compatibility with clients < v0.2.2
outputs = payload.outputs.blinded_messages if payload.outputs else None
# backwards compatibility with clients < v0.2.2
assert outputs, Exception("no outputs provided.")
try:
split_return = await ledger.split(proofs, amount, outputs)