charterhouse / pysnark Goto Github PK
View Code? Open in Web Editor NEWPython-based system for zk-SNARK based verifiable computations and smart contracts
License: Other
Python-based system for zk-SNARK based verifiable computations and smart contracts
License: Other
Hi
I'm working academic paper and I have written a prototype that utilizes Pysnark. I would like to ask if it is possible to determine some values such as the number of multiplication gates, and proof generation time
Hi,
I have a program of the following structre:
Input ciphertext y, Witness: secret key
My questions are:
I used the new version and tested again the case that I mentioned in my first comment. now during verification this is printed :
"Reading QAP vk: pysnark_vk_main
Verifying main (pysnark_vk_main) *** divisibility check failed
1"
isn't it supposed to print 0 (false) when the prover has executed a different code and as a result ,provided wrong proof and value?
why it is still printing 1(true)?
Originally posted by @Mahsa-Bastankhah in #4 (comment)
I follow "readme" and as a prover I changed the cube.py to calculate the 2*cube(in) to check if the verifier can recognize the inconsistency between third party code and prover cod.but surprisingly the verifier verified it correctly.what is the problem here?? prover can run a code diffrent from the code that third party provided and at the same time convince the verifier that he/she has done the right calculation.
Hi,
I have been trying to run the first example cube.py, but I got this error
python cube.py 3
**Traceback (most recent call last):
File "cube.py", line 40, in
inv = Var(int(sys.argv[1]), "in")
File "/usr/local/lib/python2.7/dist-packages/pysnark/runtime.py", line 93, in inited_
return fn(*args, kwargs)
File "/usr/local/lib/python2.7/dist-packages/pysnark/runtime.py", line 319, in init
vc_ctr[vc_ctx] += 1
KeyError: None
Similar to the previous issue, I wish to try out proof of ownership of hash preimage.
For starters, I wrote a mock hash function:
def mock_hash(x):
n_it = Var(100, True)
_zero = Var(0, True)
_one = Var(1, True)
_, x = x.divmod(97, 32)
p = Var(1, "True")
while True:
if n_it.equals(_zero).value == 1:
break
n_it -= _one
p *= x
_, p = p.divmod(97, 32)
return p
I was not sure how for loops work when using runtime vars, so I used the while True
.
The main is:
hx = Var(int(sys.argv[1]), "in")
x = Var(int(sys.argv[2]), "True")
out = Var(0, "True")
if hx.equals(mock_hash(x)).value == 1:
out = Var(1, "True")
print out.val("out")
The script compiles and runs fine, but during verification at first run (trusted party) I get:
Verifying main (pysnark_vk_main) *** divisibility check failed
followed, somewhat confusingly, by:
1
Verification succeeded
What is this error about? How can I fix this?
hi.
I tried to compare two integer and report the maximum and then prove to the verifier that the value I'm reporting is maximum of two integers.but I figured out that Var variables don't support comparing.in another word following code does't print True when a = 10 and b = 5
a = int(input())
b = int(input())
x = Var(a,"in1")
y = Var(b,"in2")
print x > y
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.