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 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 std::string storage_budget; // storage budget for file backed memory (e.g. "500m", "2g")
27 std::string vk_policy{ "default" }; // policy for handling VKs during IVC accumulation
28
29 bool optimized_solidity_verifier{ false }; // should we use the optimized sol verifier? (temp)
30
31 friend std::ostream& operator<<(std::ostream& os, const Flags& flags)
32 {
33 os << "flags: [\n"
34 << " verbose: " << flags.verbose << "\n"
35 << " debug: " << flags.debug << "\n"
36 << " disable_zk: " << flags.disable_zk << "\n"
37 << " crs_path: " << flags.crs_path << "\n"
38 << " ipa_accumulation: " << flags.ipa_accumulation << "\n"
39 << " scheme: " << flags.scheme << "\n"
40 << " oracle_hash_type: " << flags.oracle_hash_type << "\n"
41 << " verifier_target: " << flags.verifier_target << "\n"
42 << " verifier_type: " << flags.verifier_type << "\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 << "]" << std::endl;
49 return os;
50 }
51 };
52
53 // TODO(https://github.com/AztecProtocol/barretenberg/issues/1256): Implement
54 virtual bool check(const Flags& flags,
55 const std::filesystem::path& bytecode_path,
56 const std::filesystem::path& witness_path) = 0;
57
58 virtual bool verify(const Flags& flags,
59 const std::filesystem::path& public_inputs_path,
60 const std::filesystem::path& proof_path,
61 const std::filesystem::path& vk_path) = 0;
62
63 virtual void write_vk(const Flags& flags,
64 const std::filesystem::path& bytecode_path,
65 const std::filesystem::path& output_path) = 0;
66
67 virtual void gates(const Flags& flags, const std::filesystem::path& bytecode_path) = 0;
68
69 virtual void write_solidity_verifier(const Flags& flags,
70 const std::filesystem::path& output_path,
71 const std::filesystem::path& vk_path) = 0;
72};
73} // 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:29
friend std::ostream & operator<<(std::ostream &os, const Flags &flags)
Definition api.hpp:31
bool include_gates_per_opcode
Definition api.hpp:24
bool verbose
Definition api.hpp:11
bool write_vk
Definition api.hpp:23
bool disable_zk
Definition api.hpp:13
std::string verifier_type
Definition api.hpp:21
std::string vk_policy
Definition api.hpp:27
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:26
std::string verifier_target
Definition api.hpp:20
std::string oracle_hash_type
Definition api.hpp:19
std::string scheme
Definition api.hpp:18
bool slow_low_memory
Definition api.hpp:25