-
Notifications
You must be signed in to change notification settings - Fork 83
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
Commit reveal #77 #184
base: main
Are you sure you want to change the base?
Commit reveal #77 #184
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation does not fully conform to the commit-reveal scheme. The hash of the "secret", let's say x
, should be computed off-chain, and the resulting hash should be used on-chain as an "attestation" that the user has committed to this value x
, noted as commitment = hash(x)
. At the time of the commitment, the value x
is kept secret while the commitment is made public.
Later, the user can reveal y
, and the contract can verify that the revealed value y
matches the committed value x
by checking that hash(y) == commitment
. This ensures that x == y
.
A simple example could be the submission of a secret message, that can be optionally revealed at a later time with the guarantee that it was written at the time of commitment.
Okay, am on it. |
@LamsyA Hello, did you have the time to review and apply the changes in the last comments? Let me know if you need help. |
Yeah, I did I will need your help to clarify something. |
Yes, what points you would like me to clarify? |
I have corrected the code;
you can now review it. |
Hi @julio4, kindly review this PR. |
Issue(s): Close #77
Description
This is an implementation of the commitment scheme in cairo.
The contract uses a commitment scheme where bidders first commit to their bids and later reveal them. This ensures bid privacy until the reveal phase.
Interface: ICommitmentRevealTrait
The ICommitmentRevealTrait interface defines two essential methods:
commit(name: felt252, amount: felt252) -> felt252: Commits a bid with a name and amount, returning a hash.
reveal(name: felt252, amount: felt252) -> bool: Reveals a previously committed bid, returning true if the commitment is valid.
Checklist
./scripts/cairo_programs_verifier.sh
successfully