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 verifier_target; // target verification environment (evm, noir-recursive, starknet, etc.)
21 bool write_vk{ false }; // should we addditionally write the verification key when writing the proof
22 bool include_gates_per_opcode{ false }; // should we include gates_per_opcode in the gates command output
23 bool slow_low_memory{ false }; // use file backed memory for polynomials
24 std::string storage_budget; // storage budget for file backed memory (e.g. "500m", "2g")
25 std::string vk_policy{ "default" }; // policy for handling VKs during IVC accumulation
26 bool use_zk_flavor{ false }; // chonk-only: compute VK against MegaZKFlavor (vs MegaFlavor)
27
28 bool optimized_solidity_verifier{ false }; // should we use the optimized sol verifier? (temp)
29
30 std::string output_format{ "binary" }; // output format for proofs/vks: "binary" or "json"
31
32 friend std::ostream& operator<<(std::ostream& os, const Flags& flags)
33 {
34 os << "flags: [\n"
35 << " verbose: " << flags.verbose << "\n"
36 << " debug: " << flags.debug << "\n"
37 << " disable_zk: " << flags.disable_zk << "\n"
38 << " crs_path: " << flags.crs_path << "\n"
39 << " ipa_accumulation: " << flags.ipa_accumulation << "\n"
40 << " scheme: " << flags.scheme << "\n"
41 << " oracle_hash_type: " << flags.oracle_hash_type << "\n"
42 << " verifier_target: " << flags.verifier_target << "\n"
43 << " write_vk " << flags.write_vk << "\n"
44 << " include_gates_per_opcode " << flags.include_gates_per_opcode << "\n"
45 << " slow_low_memory " << flags.slow_low_memory << "\n"
46 << " storage_budget " << flags.storage_budget << "\n"
47 << " vk_policy " << flags.vk_policy << "\n"
48 << " use_zk_flavor " << flags.use_zk_flavor << "\n"
49 << " output_format " << flags.output_format << "\n"
50 << "]" << std::endl;
51 return os;
52 }
53 };
54
55 // TODO(https://github.com/AztecProtocol/barretenberg/issues/1256): Implement
56 virtual bool check(const Flags& flags,
57 const std::filesystem::path& bytecode_path,
58 const std::filesystem::path& witness_path) = 0;
59
60 virtual bool verify(const Flags& flags,
61 const std::filesystem::path& public_inputs_path,
62 const std::filesystem::path& proof_path,
63 const std::filesystem::path& vk_path) = 0;
64
65 virtual void write_vk(const Flags& flags,
66 const std::filesystem::path& bytecode_path,
67 const std::filesystem::path& output_path) = 0;
68
69 virtual void gates(const Flags& flags, const std::filesystem::path& bytecode_path) = 0;
70
71 virtual void write_solidity_verifier(const Flags& flags,
72 const std::filesystem::path& output_path,
73 const std::filesystem::path& vk_path) = 0;
74};
75} // 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.
Definition api.hpp:5
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
bool optimized_solidity_verifier
Definition api.hpp:28
friend std::ostream & operator<<(std::ostream &os, const Flags &flags)
Definition api.hpp:32
bool include_gates_per_opcode
Definition api.hpp:22
bool verbose
Definition api.hpp:11
bool write_vk
Definition api.hpp:21
bool disable_zk
Definition api.hpp:13
std::string vk_policy
Definition api.hpp:25
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 storage_budget
Definition api.hpp:24
std::string verifier_target
Definition api.hpp:20
bool use_zk_flavor
Definition api.hpp:26
std::string oracle_hash_type
Definition api.hpp:19
std::string output_format
Definition api.hpp:30
std::string scheme
Definition api.hpp:18
bool slow_low_memory
Definition api.hpp:23