Clearmatics Libsnark  0.1
C++ library for zkSNARK proofs
Functions
demo_ram_ppzksnark_prover.cpp File Reference
#include <fstream>
#include <iostream>
#include <boost/program_options.hpp>
#include <libsnark/common/default_types/tinyram_ppzksnark_pp.hpp>
#include <libsnark/relations/ram_computations/rams/tinyram/tinyram_params.hpp>
#include <libsnark/zk_proof_systems/ppzksnark/ram_ppzksnark/ram_ppzksnark.hpp>
Include dependency graph for demo_ram_ppzksnark_prover.cpp:

Go to the source code of this file.

Functions

bool process_prover_command_line (const int argc, const char **argv, std::string &processed_assembly_fn, std::string &proving_key_fn, std::string &primary_input_fn, std::string &auxiliary_input_fn, std::string &proof_fn)
 
int main (int argc, const char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
const char *  argv[] 
)

Definition at line 61 of file demo_ram_ppzksnark_prover.cpp.

62 {
63  default_tinyram_ppzksnark_pp::init_public_params();
64 
65 #ifdef MINDEPS
66  std::string processed_assembly_fn = "processed.txt";
67  std::string proving_key_fn = "proving_key.txt";
68  std::string primary_input_fn = "primary_input.txt";
69  std::string auxiliary_input_fn = "auxiliary_input.txt";
70  std::string proof_fn = "proof.txt";
71 #else
72  std::string processed_assembly_fn;
73  std::string proving_key_fn;
74  std::string primary_input_fn;
75  std::string auxiliary_input_fn;
76  std::string proof_fn;
77 
79  argc,
80  argv,
81  processed_assembly_fn,
82  proving_key_fn,
83  primary_input_fn,
84  auxiliary_input_fn,
85  proof_fn)) {
86  return 1;
87  }
88 #endif
89  libff::start_profiling();
90 
91  /* load everything */
93  std::ifstream pk_file(proving_key_fn);
94  pk_file >> pk;
95  pk_file.close();
96 
97  std::ifstream processed(processed_assembly_fn);
98  tinyram_program program = load_preprocessed_program(pk.ap, processed);
99 
100  std::ifstream f_primary_input(primary_input_fn);
101  std::ifstream f_auxiliary_input(auxiliary_input_fn);
102  tinyram_input_tape primary_input = load_tape(f_primary_input);
103  tinyram_input_tape auxiliary_input = load_tape(f_auxiliary_input);
104 
107  pk.ap, pk.primary_input_size_bound, program, primary_input);
109  ram_ppzksnark_prover<default_tinyram_ppzksnark_pp>(
110  pk, boot_trace, auxiliary_input);
111 
112  std::ofstream proof_file(proof_fn);
113  proof_file << proof;
114  proof_file.close();
115 }
Here is the call graph for this function:

◆ process_prover_command_line()

bool process_prover_command_line ( const int  argc,
const char **  argv,
std::string &  processed_assembly_fn,
std::string &  proving_key_fn,
std::string &  primary_input_fn,
std::string &  auxiliary_input_fn,
std::string &  proof_fn 
)
Author
This file is part of libsnark, developed by SCIPR Lab and contributors (see AUTHORS).

Definition at line 20 of file demo_ram_ppzksnark_prover.cpp.

28 {
29  try {
30  po::options_description desc("Usage");
31  desc.add_options()("help", "print this help message")(
32  "processed_assembly",
33  po::value<std::string>(&processed_assembly_fn)->required())(
34  "proving_key", po::value<std::string>(&proving_key_fn)->required())(
35  "primary_input",
36  po::value<std::string>(&primary_input_fn)->required())(
37  "auxiliary_input",
38  po::value<std::string>(&auxiliary_input_fn)->required())(
39  "proof", po::value<std::string>(&proof_fn)->required());
40 
41  po::variables_map vm;
42  po::store(po::parse_command_line(argc, argv, desc), vm);
43 
44  if (vm.count("help")) {
45  std::cout << desc << "\n";
46  return false;
47  }
48 
49  po::notify(vm);
50  } catch (std::exception &e) {
51  std::cerr << "Error: " << e.what() << "\n";
52  return false;
53  }
54 
55  return true;
56 }
Here is the caller graph for this function:
libsnark::load_preprocessed_program
tinyram_program load_preprocessed_program(const tinyram_architecture_params &ap, std::istream &preprocessed)
Definition: tinyram_aux.cpp:312
libsnark::tinyram_input_tape
std::vector< size_t > tinyram_input_tape
Definition: tinyram_aux.hpp:122
libsnark::r1cs_ppzksnark_proof
Definition: r1cs_ppzksnark.hpp:298
libsnark::memory_store_trace
Definition: memory_store_trace.hpp:29
process_prover_command_line
bool process_prover_command_line(const int argc, const char **argv, std::string &processed_assembly_fn, std::string &proving_key_fn, std::string &primary_input_fn, std::string &auxiliary_input_fn, std::string &proof_fn)
Definition: demo_ram_ppzksnark_prover.cpp:20
libsnark::ram_ppzksnark_proving_key
Definition: ram_ppzksnark.hpp:60
libsnark::load_tape
tinyram_input_tape load_tape(std::istream &tape)
Definition: tinyram_aux.cpp:369
libsnark::tinyram_boot_trace_from_program_and_input
memory_store_trace tinyram_boot_trace_from_program_and_input(const tinyram_architecture_params &ap, const size_t boot_trace_size_bound, const tinyram_program &program, const tinyram_input_tape &primary_input)
Definition: tinyram_aux.cpp:338
libsnark::tinyram_program
Definition: tinyram_aux.hpp:200