Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
api.hpp
Go to the documentation of this file.
1#pragma once
2#include <filesystem>
3#include <iostream>
4
5namespace bb {
6
7class API {
8 public:
9 // see the setting of these flags in bb/main.cpp for more information
10 struct Flags {
11 bool verbose{ false }; // more logging
12 bool debug{ false }; // even more logging
13 bool disable_zk{ false }; // disable the zero knowledge property. this is off by default as we aim to use the
14 // zero knowledge variant of the protocol by default
15 std::filesystem::path crs_path{ "" }; // the location of reference strings for commitment schemes
16 bool recursive{ false }; // deprecated flag indicating that a circuit is to be recursively verified
17 bool ipa_accumulation{ false }; // indicate whether the command is doing IPA proof aggregation
18 std::string scheme; // the proving system or IVC scheme
19 std::string oracle_hash_type; // which hash function does the prover use as a random oracle?
20 std::string output_format; // output bytes, fields, both, or a msgpack buffer of fields
21 std::string verifier_type; // is a verification key for use a single circuit verifier (e.g. a SNARK or folding
22 // recursive verifier) or is it for an ivc verifier?
23 bool write_vk{ false }; // should we addditionally write the verification key when writing the proof
24 bool include_gates_per_opcode{ false }; // should we include gates_per_opcode in the gates command output
25 bool slow_low_memory{ false }; // use file backed memory for polynomials
26 bool update_inputs{ false }; // update inputs when check fails
27
28 friend std::ostream& operator<<(std::ostream& os, const Flags& flags)
29 {
30 os << "flags: [\n"
31 << " verbose: " << flags.verbose << "\n"
32 << " debug: " << flags.debug << "\n"
33 << " disable_zk: " << flags.disable_zk << "\n"
34 << " crs_path: " << flags.crs_path << "\n"
35 << " ipa_accumulation: " << flags.ipa_accumulation << "\n"
36 << " scheme: " << flags.scheme << "\n"
37 << " oracle_hash_type: " << flags.oracle_hash_type << "\n"
38 << " output_format: " << flags.output_format << "\n"
39 << " verifier_type: " << flags.verifier_type << "\n"
40 << " write_vk " << flags.write_vk << "\n"
41 << " include_gates_per_opcode " << flags.include_gates_per_opcode << "\n"
42 << " slow_low_memory " << flags.slow_low_memory << "\n"
43 << "]" << std::endl;
44 return os;
45 }
46 };
47
48 // TODO(https://github.com/AztecProtocol/barretenberg/issues/1256): Implement
49 virtual bool check(const Flags& flags,
50 const std::filesystem::path& bytecode_path,
51 const std::filesystem::path& witness_path) = 0;
52
53 virtual bool verify(const Flags& flags,
54 const std::filesystem::path& public_inputs_path,
55 const std::filesystem::path& proof_path,
56 const std::filesystem::path& vk_path) = 0;
57
58 virtual void write_vk(const Flags& flags,
59 const std::filesystem::path& bytecode_path,
60 const std::filesystem::path& output_path) = 0;
61
62 virtual void gates(const Flags& flags, const std::filesystem::path& bytecode_path) = 0;
63
64 virtual void write_solidity_verifier(const Flags& flags,
65 const std::filesystem::path& output_path,
66 const std::filesystem::path& vk_path) = 0;
67};
68} // namespace bb
Definition api.hpp:7
virtual void write_solidity_verifier(const Flags &flags, const std::filesystem::path &output_path, const std::filesystem::path &vk_path)=0
virtual void gates(const Flags &flags, const std::filesystem::path &bytecode_path)=0
virtual bool verify(const Flags &flags, const std::filesystem::path &public_inputs_path, const std::filesystem::path &proof_path, const std::filesystem::path &vk_path)=0
virtual bool check(const Flags &flags, const std::filesystem::path &bytecode_path, const std::filesystem::path &witness_path)=0
virtual void write_vk(const Flags &flags, const std::filesystem::path &bytecode_path, const std::filesystem::path &output_path)=0
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
friend std::ostream & operator<<(std::ostream &os, const Flags &flags)
Definition api.hpp:28
bool include_gates_per_opcode
Definition api.hpp:24
bool verbose
Definition api.hpp:11
bool write_vk
Definition api.hpp:23
bool update_inputs
Definition api.hpp:26
bool disable_zk
Definition api.hpp:13
std::string verifier_type
Definition api.hpp:21
std::filesystem::path crs_path
Definition api.hpp:15
bool debug
Definition api.hpp:12
bool recursive
Definition api.hpp:16
bool ipa_accumulation
Definition api.hpp:17
std::string oracle_hash_type
Definition api.hpp:19
std::string output_format
Definition api.hpp:20
std::string scheme
Definition api.hpp:18
bool slow_low_memory
Definition api.hpp:25