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

Feature request: init librustzcash without sprout-groth16 #85

Closed
leto opened this issue Jun 19, 2019 · 3 comments · Fixed by #98
Closed

Feature request: init librustzcash without sprout-groth16 #85

leto opened this issue Jun 19, 2019 · 3 comments · Fixed by #98
Milestone

Comments

@leto
Copy link

leto commented Jun 19, 2019

According to #41 there is a stated goal to

2. Separate components so that hardware wallets, light wallets etc. can use lightweight, portable implementations of the pieces that they need.

and this issue aligns directly with that goal. Currently all 3 of these parameter files are needed to init librustzcash:

3.8M	sapling-output.params
 46M	sapling-spend.params
692M	sprout-groth16.params

There now exist multiple Zcash source code forks (at least Hush and Pirate) that no longer use Sprout param files. Recently I was able to make it so Hush does not download 900MB of sprout files, since the new Hush mainnet has never had a Sprout transaction. It was a completely wasteful download: wasteful of user time+bandwidth and also costly in terms of Amazon CloudFront costs.

I looked into the Rust code to see if it was possible to initialize librustzcash without sprout-groth16.params, but it seems baked in deep. Is the librustzcash willing to support this use case or does it fall outside your support realm?

What I am looking for are versions oflibrustzcash_init_zksnark_params that do not take sprout-groth16 file as parameter, or perhaps will not fail if null values are given for sprout-groth16:

https://github.com/zcash/librustzcash/blob/master/librustzcash/src/rustzcash.rs#L123

If you can make your library more flexible, I imagine many thousands of dollars per year can be saved in Amazon Cloudfront costs, by not having every full node of various other coins downloading files that they don't actually need.

@str4d str4d changed the title Feature request: init librustzcash without groth16 Feature request: init librustzcash without sprout-groth16 Jul 3, 2019
@str4d
Copy link
Contributor

str4d commented Jul 3, 2019

The core Rust changes for this were made in #65, so all that is necessary is to enable librustzcash_init_zksnark_params() to be called without the Sprout parameters. It should be doable by interpreting a null pointer for the Sprout parameter path as "we don't want this one loaded".

At the same time, we should internalise the hashes instead of passing them in, because they aren't ever going to change (passing them through was only beneficial during development prior to the MPC). This would simplify the librustzcash_init_zksnark_params() API to just be the paths.

@str4d
Copy link
Contributor

str4d commented Aug 16, 2019

Opened #106 for internalising the hashes.

@leto
Copy link
Author

leto commented Aug 16, 2019

FYI, HUSH maintains a trivial patch on top of the stock librustzcash to prevent the need for sprout-groth16, so our itch is scratched:

https://github.com/MyHush/hush3/blob/master/depends/patches/librustzcash/no-groth16.patch

@str4d str4d added this to the v0.1.0 milestone Aug 22, 2019
@str4d str4d closed this as completed in #98 Aug 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants