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

How to export params to JSON file #34

Open
drbh opened this issue Feb 12, 2019 · 1 comment
Open

How to export params to JSON file #34

drbh opened this issue Feb 12, 2019 · 1 comment

Comments

@drbh
Copy link

drbh commented Feb 12, 2019

I am a bit confused about saving the params, proofs and pvk as JSON files so I can move them between machines.

I've followed the example repo at https://github.com/arcalinea/bellman-examples/blob/master/src/cube.rs#L154 and also see a write implementation on the proof structure here: https://github.com/zkcrypto/bellman/blob/master/src/groth16/mod.rs#L43

Can someone help me export these variables?

@drewstone
Copy link

drewstone commented Feb 20, 2019

Not JSON but mayne this helps? Use whatever circuit instead of what I've provided.

use std::fs;
let params = generate_random_parameters::<Bn256, _, _>(
    MerkleTreeCircuit {
        params: j_params,
        nullifier: None,
        secret: None,
        proof: vec![],
    },
    rng,
)?;

let mut v = vec![];
params.write(&mut v)?;

fs::write("test/test.params", hex::encode(&v[..]).unwrap();

str4d pushed a commit that referenced this issue Aug 25, 2020
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

No branches or pull requests

2 participants