tornado ceremony binary
This commit is contained in:
parent
fec9729bc9
commit
e98bd26932
@ -24,7 +24,7 @@ num-traits = "0.2.8"
|
|||||||
itertools = "0.9.0"
|
itertools = "0.9.0"
|
||||||
hex = "0.4.0"
|
hex = "0.4.0"
|
||||||
cfg-if = "0.1.10"
|
cfg-if = "0.1.10"
|
||||||
reqwest = { version = "0.10", features = ["blocking"] }
|
reqwest = { version = "0.10", features = ["blocking", "json"] }
|
||||||
bellman_ce = { path = "../bellman", default-features = false } # active features depend on build type
|
bellman_ce = { path = "../bellman", default-features = false } # active features depend on build type
|
||||||
|
|
||||||
# needed for native only but don't break wasm if present
|
# needed for native only but don't break wasm if present
|
||||||
|
@ -6,6 +6,7 @@ extern crate itertools;
|
|||||||
extern crate blake2;
|
extern crate blake2;
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
|
extern crate serde_json;
|
||||||
|
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
@ -15,13 +16,22 @@ use itertools::Itertools;
|
|||||||
use blake2::Digest;
|
use blake2::Digest;
|
||||||
use reqwest::blocking::multipart;
|
use reqwest::blocking::multipart;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use serde_json::{Map, Value};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let disallow_points_at_infinity = false;
|
//let url = "https://ceremony.tornado.cash";
|
||||||
let entropy = "qweqwe";
|
let url = "http://localhost:3000/api";
|
||||||
|
println!("Welcome to Tornado Cash Trusted Setup ceremony");
|
||||||
|
|
||||||
|
// Ask the user to provide some information for additional entropy
|
||||||
|
let mut entropy = String::new();
|
||||||
|
println!("Type some random text and press [ENTER] to provide additional entropy...");
|
||||||
|
std::io::stdin()
|
||||||
|
.read_line(&mut entropy)
|
||||||
|
.expect("expected to read some random text from the user");
|
||||||
|
|
||||||
println!("Downloading challenge...");
|
println!("Downloading challenge...");
|
||||||
let mut resp = reqwest::blocking::get("https://trustedaf.poma.in/challenge").unwrap();
|
let mut resp = reqwest::blocking::get(&*format!("{}/challenge", url)).unwrap();
|
||||||
if !resp.status().is_success() {
|
if !resp.status().is_success() {
|
||||||
println!("Cannot download challenge");
|
println!("Cannot download challenge");
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
@ -61,20 +71,21 @@ fn main() {
|
|||||||
|
|
||||||
ChaChaRng::from_seed(&seed)
|
ChaChaRng::from_seed(&seed)
|
||||||
};
|
};
|
||||||
|
let disallow_points_at_infinity = false;
|
||||||
let mut params = MPCParameters::read(&*challenge, disallow_points_at_infinity, true).expect("unable to read params");
|
let mut params = MPCParameters::read(&*challenge, disallow_points_at_infinity, true).expect("unable to read params");
|
||||||
|
|
||||||
println!("Contributing...");
|
println!("Generating contribution...");
|
||||||
let hash = params.contribute(&mut rng);
|
let hash = params.contribute(&mut rng);
|
||||||
println!("Contribution hash: 0x{:02x}", hash.iter().format(""));
|
println!("Contribution hash: 0x{:02x}", hash.iter().format(""));
|
||||||
|
|
||||||
println!("Sending parameters");
|
println!("Uploading response");
|
||||||
let mut response: Vec<u8> = vec![];
|
let mut response: Vec<u8> = vec![];
|
||||||
params.write(&mut response).expect("failed to write updated parameters");
|
params.write(&mut response).expect("failed to write updated parameters");
|
||||||
File::create("response").unwrap().write_all(&*response).unwrap();
|
File::create("response").unwrap().write_all(&*response).unwrap();
|
||||||
|
|
||||||
let part = multipart::Part::bytes(response).file_name("response").mime_str("application/octet-stream").unwrap();
|
let part = multipart::Part::bytes(response).file_name("response").mime_str("application/octet-stream").unwrap();
|
||||||
let client = reqwest::blocking::Client::new();
|
let client = reqwest::blocking::Client::new();
|
||||||
let resp = client.post("https://trustedaf.poma.in/response")
|
let resp = client.post(&*format!("{}/response", url))
|
||||||
.multipart(multipart::Form::new().part("response", part))
|
.multipart(multipart::Form::new().part("response", part))
|
||||||
.timeout(Duration::from_secs(300))
|
.timeout(Duration::from_secs(300))
|
||||||
.send()
|
.send()
|
||||||
@ -85,5 +96,9 @@ fn main() {
|
|||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("Done");
|
let resp_json: Map<String, Value> = resp.json().unwrap();
|
||||||
|
|
||||||
|
println!("Your contribution is successfully uploaded! Your contribution index: {}", resp_json["contributionIndex"]);
|
||||||
|
println!("If you want to provide additional information to your contribution (your name etc.)");
|
||||||
|
println!("Please visit the page: {}/authorize-contribution?token={}", url, resp_json["token"].as_str().unwrap());
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user