Skip to content
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

Explore nesting STARK proofs inside SNARK proofs #328

Open
vimwitch opened this issue Feb 17, 2023 · 0 comments
Open

Explore nesting STARK proofs inside SNARK proofs #328

vimwitch opened this issue Feb 17, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@vimwitch
Copy link
Member

vimwitch commented Feb 17, 2023

For the build ordered tree circuit we need to scale to (ideally) hundreds of thousands of inputs. Right now we do this in a SNARK. This requires a long proving time because the proving time scales roughly linearly with number of operations. The advantage is a constant size proof/verification time suitable for onchain verification.

A STARK can make the same proof as a SNARK, but ~10x faster.

1 image

So we can generate a cheap STARK proof building the tree, then generate a SNARK proof using the STARK. The SNARK proof is then verified onchain.

--

This might be a viable approach for all our proofs. We can use a pattern where the user makes STARK proofs in browser and gives those proofs to a relay that wraps them in SNARKS before putting them onchain. The browser proving time would be reduced by ~10x at the cost of the relay having to do more computation. STARK proofs don't require a trusted setup or proving keys, so the user won't have to download large files.

STARK proofs are slightly larger than SNARK proofs, but small enough that moving proofs over http should be instant. We can use FFLONK SNARK proofs to wrap the STARK proofs. By doing so the system doesn't need a phase 2 trusted setup.

2
image

If the user is making STARK proofs we could potentially run a system configured like:

{
  EPOCH_TREE_ARITY: 2
  EPOCH_TREE_DEPTH: 32
  STATE_TREE_DEPTH: 32

  FIELD_COUNT: 200

  EPK_NONCE_PER_EPOCH: 10
}

This would store 5 kb of data for each user, and give each user 10 identities per epoch. As we expand the data storage we will eventually be able to build a ZK database for each user (abstracting the uint[] away).

--

I think we can yoink the engine out of this and build a recursive prover for generic STARK circuits. This would solidify the user/relay separation by shifting the cost of gas and compute to the relay. They're also looking for input on selecting a license.

@vivianjeng vivianjeng added the enhancement New feature or request label May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Issues
Development

No branches or pull requests

2 participants