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_type; // is a verification key for use a single circuit verifier (e.g. a SNARK or folding
21 // recursive verifier) or is it for an ivc verifier?
22 bool write_vk{ false }; // should we addditionally write the verification key when writing the proof
23 bool include_gates_per_opcode{ false }; // should we include gates_per_opcode in the gates command output
24 bool slow_low_memory{ false }; // use file backed memory for polynomials
25 std::string storage_budget; // storage budget for file backed memory (e.g. "500m", "2g")
26 bool update_inputs{ false }; // update inputs when check fails
27
28 bool optimized_solidity_verifier{ false }; // should we use the optimized sol verifier? (temp)
29
30 friend std::ostream& operator<<(std::ostream& os, const Flags& flags)
31 {
32 os << "flags: [\n"
33 << " verbose: " << flags.verbose << "\n"
34 << " debug: " << flags.debug << "\n"
35 << " disable_zk: " << flags.disable_zk << "\n"
36 << " crs_path: " << flags.crs_path << "\n"
37 << " ipa_accumulation: " << flags.ipa_accumulation << "\n"
38 << " scheme: " << flags.scheme << "\n"
39 << " oracle_hash_type: " << flags.oracle_hash_type << "\n"
40 << " verifier_type: " << flags.verifier_type << "\n"
41 << " write_vk " << flags.write_vk << "\n"
42 << " include_gates_per_opcode " << flags.include_gates_per_opcode << "\n"
43 << " slow_low_memory " << flags.slow_low_memory << "\n"
44 << " storage_budget " << flags.storage_budget << "\n"
45 << "]" << std::endl;
46 return os;
47 }
48 };
49
50 // TODO(https://github.com/AztecProtocol/barretenberg/issues/1256): Implement
51 virtual bool check(const Flags& flags,
52 const std::filesystem::path& bytecode_path,
53 const std::filesystem::path& witness_path) = 0;
54
55 virtual bool verify(const Flags& flags,
56 const std::filesystem::path& public_inputs_path,
57 const std::filesystem::path& proof_path,
58 const std::filesystem::path& vk_path) = 0;
59
60 virtual void write_vk(const Flags& flags,
61 const std::filesystem::path& bytecode_path,
62 const std::filesystem::path& output_path) = 0;
63
64 virtual void gates(const Flags& flags, const std::filesystem::path& bytecode_path) = 0;
65
66 virtual void write_solidity_verifier(const Flags& flags,
67 const std::filesystem::path& output_path,
68 const std::filesystem::path& vk_path) = 0;
69};
70} // 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
bool optimized_solidity_verifier
Definition api.hpp:28
friend std::ostream & operator<<(std::ostream &os, const Flags &flags)
Definition api.hpp:30
bool include_gates_per_opcode
Definition api.hpp:23
bool verbose
Definition api.hpp:11
bool write_vk
Definition api.hpp:22
bool update_inputs
Definition api.hpp:26
bool disable_zk
Definition api.hpp:13
std::string verifier_type
Definition api.hpp:20
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:25
std::string oracle_hash_type
Definition api.hpp:19
std::string scheme
Definition api.hpp:18
bool slow_low_memory
Definition api.hpp:24