zkSNARKs For Scaling - HackMD

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

zkSNARKs for scaling

Intro
We have a bunch of projects that try to use snarks to scale eth. We estimate we can get
between 100 and 500 transactions per second on ethereum today. We can even approch 33000
transactions per second for non custodial dapps.
its important to note that this is not just for transactions. We can build any kind of dapp that
runs in the EVM in a snark and get similar scaling benifits.
https://github.com/barryWhiteHat/roll_up_token (https://github.com/barryWhiteHat/roll_up_token) is a
good description of how these things works.
Ignis implementation by Matter Labs: https://github.com/matter-labs/matter-network
(https://github.com/matter-labs/matter-network)
Aggregate zkSNARK transactions (like roll_up) https://github.com/HarryR/ethsnarks-snasma/
(https://github.com/HarryR/ethsnarks-snasma/)
join us https://t.me/ethdenver_snarks4scaling (https://t.me/ethdenver_snarks4scaling)
General Mentorship
Following on from ethdenver we are starting to make a nice group of snark mentors. This
includes the authors of circom, ethsnarks and the matter team. As well as partipents and
winners from ethdenver.
Where to ask for help
Come and talk to us in Telegram group @ethdenver_snarks4scaling
(https://t.me/ethdenver_snarks4scaling)
Facebook public group: Zero Knowledge (https://www.facebook.com/groups/800441673459620/)
Tools
ethsnarks (https://github.com/HarryR/ethsnarks)
Ethsnarks (https://github.com/HarryR/ethsnarks) is a SDK for writing Ethereum compatible zkSNARK
circuits in C++ using the libsnark (https://github.com/scipr-lab/libsnark/) library. It includes support for
the following crypto primitives with matching Python, Solidity and C++ implementations:
Low-cost verification (~450k Gas base cost)
Low-constraint Merkle Tree
MiMC cipher and hash
Baby JubJub elliptic curve
EdDSA signatures
Pedersen hashing
Main GitHub repository: https://github.com/HarryR/ethsnarks (https://github.com/HarryR/ethsnarks)
Rudimentary knowledge of C++ and CMake is required to build circuits. Reading the source
code and example projects is the best way to get hands-on.
Examples
These example projects can be used as templates and include Truffle support with Travis
continuous-integration, or demonstrate key concepts like EdDSA signatures.
https://github.com/HarryR/ethsnarks-miximus (https://github.com/HarryR/ethsnarks-miximus) -
Anonymous coin mixer for Ethereum
https://github.com/HarryR/ethsnarks-hashpreimage (https://github.com/HarryR/ethsnarks-
hashpreimage) - Hash pre-image zero-knowledge commitment example
https://github.com/HarryR/ethsnarks-snasma (https://github.com/HarryR/ethsnarks-snasma) - Batch
transaction processing example
Community:
https://gitter.im/ethsnarks/Lobby (https://gitter.im/ethsnarks/Lobby) (text chat, ping  @HarryR )
https://meet.jit.si/ethsnarks (https://meet.jit.si/ethsnarks) (video/audio conference)
https://gitter.im/barrywhitehat/roll_up (https://gitter.im/barrywhitehat/roll_up) (related
people/projects)
Harry (the ethsnarks maintainer) is available on Telegram, Gitter (https://gitter.im/ethsnarks/Lobby) and
can do video calls (https://meet.jit.si/ethsnarks) (in GMT timezone, 7hr behind Denver). Is willing to
help with all aspects, even if not specifically related to ethsnarks.
circom (https://github.com/iden3/circom)
circom (https://github.com/iden3/circom) is a DSL language where you can design circuits to create
zeroKnowledge proof.
Those proofs can be generated/verified in the browser or in node JS via the snarkjs
(https://github.com/iden3/snarkjs) library
snarkjs (https://github.com/iden3/snarkjs) also allows to create a smart contract to verify the zero
knowledge proofs from a smart contract.
circom (https://github.com/iden3/circom) Comes together with circomlib (https://github.com/iden3/circomlib)
In this library, you can find some basic components that you can use in your project. This
includes.
Examples
The best way to get started to create a zero knowlage proof circuit is this tutorial
(https://github.com/iden3/circom/blob/master/TUTORIAL.md)
There is a roll_up specific tutorial https://github.com/GuthL/roll_up_circom_tutorial
(https://github.com/GuthL/roll_up_circom_tutorial)
iden3 telegram group: https://t.me/iden3io (https://t.me/iden3io)
Bellman (https://github.com/matter-labs/bellman)
zkSNARK library for community with Ethereumʼs BN256 support
Bellman (https://github.com/matter-labs/bellman) is a fork of the original implementation by Sean Bowe
from Zcash that is now maintained with code comments, extension for Ethereum compatible
curve (and more curves in a future) and other proof systems (GM17, SONIC). It should be used
with a gadget library sapling-crypto (https://github.com/matter-labs/sapling-crypto) to produce actual
circuits. The best part of Bellman is convenience and speed simultaneously - witness
calculation is defined “in-place”, and Rust is as fast as C++.
Examples
Edcon2019 material (code example + workshop record) (https://github.com/matter-
labs/Edcon2019_material)
Simple circuit that will be used for an EDCON 2019 webcast
Implementation of non-inclusion proof for Plasma Cash (https://github.com/matter-
labs/PlasmaCashHistorySnark-iOS)

Original code from ETHSignapore that gave a start for Ignis (https://github.com/matter-
labs/plasma_winter)
The Plasma Winter repository also contains verifying contract and utils that can export
verification keys as Solidity smart-contracts.
Igorʼs example: https://github.com/snjax/bellman_cube (https://github.com/snjax/bellman_cube)
Links
https://github.com/barryWhiteHat/roll_up_token (https://github.com/barryWhiteHat/roll_up_token)
barryWhitehat devcon presentation (https://www.youtube.com/watch?v=lv6iK9qezBY)
telegram group: ethdenver_snarks4scaling (https://t.me/ethdenver_snarks4scaling)
gitter (https://gitter.im/barrywhitehat/roll_up)
https://blog.decentriq.ch/zk-snarks-primer-part-one/ (https://blog.decentriq.ch/zk-snarks-primer-part-
one/)
Educational links:
Snarks for mixing, signaling and scaling
by Barry Whitehat (https://slideslive.com/38911801/snarks-for-mixing-signaling-and-scaling)
A good article which gives an overview of the current state of things
(https://medium.com/qed-it/diving-into-the-snarks-setup-phase-b7660242a0d7)

You might also like