-
Notifications
You must be signed in to change notification settings - Fork 90
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
Implementing fibonacci sequence example #17
Comments
Dear osuketh, |
Thank you for your reply.
The using constraints are There are boundary constraints for
|
Hi,
You're aware that the STARK is over a binary field (characteristic 2),
which means a Fibonacci sequence will look pretty repetitive. If you start
it with a, b, and letting c:=a xor b, the sequence will be: a, b, c, a, b,
c, a, b, c,...
…On Tue, Dec 11, 2018 at 12:25 PM Osuke ***@***.***> wrote:
Thank you for your reply.
There are three registers(B00, B01, B02) for fibonacci sequence
representing B00 + B01 = B02 for each steps, so the generated witness
looks like this.
[image: img_0663]
<https://user-images.githubusercontent.com/20852667/49792902-33651c00-fd77-11e8-8ff9-684eccc31696.JPG>
The corresponding code is here.
https://github.com/LayerXcom/libSTARK/blob/macOS/simpleadd/Add_GenWitness.cpp#L18-L41
The using constraints are B00_next + B01, B01_next+B02, (B00 + B01 + B02)
* (B00 + B01) .(last one*(B00+B01) is used for first steps)
The code is here.
https://github.com/LayerXcom/libSTARK/blob/macOS/simpleadd/Add_EvalPoly.cpp#L23-L25
There are boundary constraints for B00 = 0, B01 = 0 with first step and B02
= a (private input) with last step.
https://github.com/LayerXcom/libSTARK/blob/macOS/simpleadd/Add_instance.cpp#L47-L54
./simple-add 8 21 executes the program that the witness is assumed
satisfying the constraints, but it fails.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#17 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AmDav8KYsybj6eAIOwlckXBwq9wT47a6ks5u34gugaJpZM4ZMlr7>
.
|
Ah, thank you! Once I fixed to over a binary field, then But still, it shows I think this means encoding to polynomials could be correct, but there is something wrong with generating proof or verification, right? The generating witness is
The used constraints is
|
Could you please post the printouts? It might help me figure out what is happening. |
Thank you so much. This is the printouts. |
Dear osuketh, I believe I understood what is the problem. Solution: Explanation: |
Thank you for helping me. Finally it works! |
I'm currently trying out implementing fibonacci sequence example using libstark.
see here: https://github.com/LayerXcom/libSTARK/tree/macOS/simpleadd , referring to the stark-dpm example.
I am in trouble because I cannot get it working correctly.
Both
libstark::BairWitnessChecker::verify(bair_instance, bair_witness)
andlibstark::Protocols::executeProtocol
return false.I have no idea how to fix it.
I guess there is something wrong with the constraints(Add_EvalPoly.cpp).
(I found
libstark::BairWitnessChecker::verify(bair_instance, bair_witness)
returns true if this constraint is removed, but stillexecuteProtocol
returns false.)You can execute the program with
./simple-add t a
.The first argument is
t
representing the number of iterations the sequence with public input.The second argument is
a
representing thet
th number of the fibonacci sequence with private input.So you can build
make -j8
and then execute like./simple-add 8 21
. (because the 8th fibonacci number is 21)Can you tell me how to fix it?
Thanks.
The text was updated successfully, but these errors were encountered: