Add tool for splitting parameters up into separate files, for Zcash

This commit is contained in:
Sean Bowe 2018-04-17 11:39:34 -06:00
parent 5c804fbfd0
commit 0df20addbf
No known key found for this signature in database
GPG Key ID: 95684257D8F8B031
2 changed files with 47 additions and 0 deletions

View File

@ -17,6 +17,9 @@ name = "compute"
[[bin]]
name = "verify_transform"
[[bin]]
name = "split_params"
[dependencies]
phase2 = "0.2.1"
pairing = "0.14"

44
src/bin/split_params.rs Normal file
View File

@ -0,0 +1,44 @@
//! This binary just splits the parameters up into separate files.
extern crate phase2;
extern crate pairing;
extern crate rand;
extern crate blake2_rfc;
use std::fs::File;
use std::io::{BufWriter, BufReader};
fn main() {
let current_params = File::open("params").expect("couldn't open `./params`");
let mut current_params = BufReader::with_capacity(1024*1024, current_params);
let sapling_spend = phase2::MPCParameters::read(&mut current_params, false)
.expect("couldn't deserialize Sapling Spend params");
let sapling_output = phase2::MPCParameters::read(&mut current_params, false)
.expect("couldn't deserialize Sapling Output params");
let sprout_joinsplit = phase2::MPCParameters::read(&mut current_params, false)
.expect("couldn't deserialize Sprout JoinSplit params");
{
let f = File::create("sapling-spend.params").expect("couldn't create `./sapling-spend.params`");
let mut f = BufWriter::with_capacity(1024*1024, f);
sapling_spend.write(&mut f)
.expect("couldn't write new Sapling Spend params");
}
{
let f = File::create("sapling-output.params").expect("couldn't create `./sapling-output.params`");
let mut f = BufWriter::with_capacity(1024*1024, f);
sapling_output.write(&mut f)
.expect("couldn't write new Sapling Output params");
}
{
let f = File::create("sprout-groth16.params").expect("couldn't create `./sapling-groth16.params`");
let mut f = BufWriter::with_capacity(1024*1024, f);
sprout_joinsplit.write(&mut f)
.expect("couldn't write new Sprout JoinSplit params");
}
}