ebfull / lightning_circuit

MIT License
79 stars 36 forks source link

This simple SNARK application was made in response to a lightning-dev forum post, https://lists.linuxfoundation.org/pipermail/lightning-dev/2015-November/000309.html where AJ Towns suggested using SNARKs to implement a variant of the lightning protocol. The exact application doesn't matter too much, but in the thread there was an initial attempt at benchmarking, which seemed to suggest ridiculous numbers, like 100+MB for a proof about a single hash. So, this project was made to set the record straight about what performance could be expected.

This is a SNARK implementation using libsnark for the following:

ZkPoK{ (R1, R2): H1 = sha256(R1) and H2 = sha256(R2) and R1 = R2 ^ X }

Read: given H1, H2, and X, prove you know R1 and R2 such that R1 is the preimage of H1, R2 is the preimage of H2, and R1 is R2 xor X.

performance

on my computer (Intel(R) Core(TM) i7-3770S CPU @ 3.10GHz):

howto

./get-libsnark && make && ./test

anatomy