Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation - Intro #62

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
47 changes: 42 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,48 @@
# ALBA
This is a Rust library of _Approximate Lower Bound Arguments_ proposed in the [paper](https://iohk.io/en/research/library/papers/approximate-lower-bound-arguments/), May 2024, Eurocrypt'24 by _Pyrros Chaidos, Aggelos Kiayias, Leonid Reyzin, Anatoliy Zinovyev_.

Implementation of _Approximate Lower Bound Arguments_ from the [paper](https://iohk.io/en/research/library/papers/approximate-lower-bound-arguments/) published by IOG Research:
### Introduction
ALBA enables a prover who has a large collection of data to convince a verifier that their set includes at least a minimum number of elements that meet a specific condition, called a predicate, even though the prover only reveals a subset of the data.
By approximating a lower bound on the prover's knowledge, ALBA makes use of a controlled gap between the size of prover's actual knowledge and the threshold of the verifier checks they know.
This design results in highly efficient proofs, achieving nearly optimal proof sizes in both non-interactive and distributed environments.
ALBA's primary applications include large-scale decentralized signature schemes.
It is particularly well-suited for decentralized or blockchain scenarios, where it enhances communication efficiency among multiple provers sharing witness.

> **Approximate Lower Bound Arguments**, _Pyrros Chaidos, Prof Aggelos Kiayias, Leonid Reyzin, Anatoliy Zinovyev_, May 2024, Eurocrypt'24
In a decentralized voting system, participants (voters) submit votes that support different options or candidates.
To validate the results without revealing all individual votes, an ALBA protocol could be used.
Each voter's choice can be considered an _element_ that meets a certain predicate (e.g., a valid vote for a candidate).
Instead of tallying every vote publicly, ALBA allows an aggregator (like an election authority) to generate a compact proof showing that a sufficient number of valid votes has been cast for each candidate to meet the required threshold for a decision (such as reaching a quorum or winning a majority).
Combining ALBA with zero-knowledge technology such as _zkSNARKs_, we can efficiently keep individual votes private while enabling quick, efficient validation of the voting outcome, making it particularly useful for secure, private, and scalable voting systems where privacy and efficiency are critical.

The paper introduces various ALBA protocol constructions tailored to different needs.
The basic construction allows a prover to show possession of a large set by creating a proof sequence of elements that meet staged hash-based conditions, efficiently excluding small sets.
_Pre-hashing_ improves this by precomputing hashes to group elements into _bins_, reducing computation and enhancing performance, especially with large sets.
For smaller sets, the generalized Telescope scheme allows multiple attempts to form a proof, adjusting parameters to maintain efficiency across sizes.
Decentralized versions of ALBA include the _Simple Lottery Construction_, where each party holding an element decides to share it based on a random _lottery_ mechanism, with an aggregator forming the proof from a target number of shared elements.
The _Decentralized Telescope_ adapts the Telescope scheme for multiple parties, who individually apply it and share qualifying elements with an aggregator.
Finally, the weighted extension supports elements with integer weights, allowing the prover to meet a total weight threshold, making ALBA versatile for contexts where elements have varying significance.

The library covers the following constructions of the ALBA protocol:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that we have centralized telescope and simple lottery in all four settings: unweighted/weighted, centralized/decentralized. Right now unweighted decentralized telescope is not included in your list for example, also it's not clear for which settings the simple lottery will be.

1. Centralized Telescope
2. Simple Lottery Construction
3. Decentralized Telescope
4. Wighted-Decentralized Telescope

### Disclaimer

> [!IMPORTANT]
> This code is NOT fit for production, it's not been optimised, thoroughly tested, nor audited by competent cryptographers.
> Its one and only purpose is to help people who are more familiar with code than equations to have a better understanding of ALBAs
> Its one and only purpose is to help people who are more familiar with code than equations to prototype larger protocols using ALBA.

### Documentation
👉 We deliver comprehensive [documentation][crate::docs] aimed at connecting theory with practical implementation.

👉 Checkout website on this [link](https://alba.cardano-scaling.org).

### Compiling the library
Compile the library:
```shell
cargo build --release
```

👉 Checkout documentation on https://alba.cardano-scaling.org
### Tests and Benchmarks
Run tests with `cargo test`. Run benchmarks with `cargo bench`.
26 changes: 25 additions & 1 deletion docs/intro.md
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
**Telescope ALBA** documentation.
- Assume that, a prover, who has a large collection of data, wants to convince a verifier that their set contains at least a minimum number of elements that satisfy a specific condition, known as a predicate, even if the prover only shares a portion of it.
- The Approximate Lower Bound Argument (ALBA) protocol is a new cryptographic primitive that solves this problem efficiently.
- The protocol makes use of a small gap between the size of what the prover actually has and the threshold the verifier knows they have, enabling small proofs and short prover and verifier running times.
- ALBA also supports weighted elements, where each element has an assigned importance or weight. This allows the prover to demonstrate that the total weight of their set meets a required threshold, rather than simply the count of elements.
- ALBA supports scalable and efficient proof mechanisms in decentralized systems, i.e., voting schemes.

## Overview
- **The protocol**
- The protocol addresses the problem of succinctly proving knowledge of a large set of verifiable evidence.
- The prover convinces the verifier by revealing only a subset of this evidence, thus achieving efficiency in both proof size and communication.
- Given a large set $S_p$ that satisfies a predicate $R$ such that $|S_p| \geq n_p$, the prover wants to convince the verifier that the set contains more than $n_f$ elements, where $n_f$ is a threshold strictly smaller than $n_p$.
- This creates an _approximate_ lower bound, as the verifier is convinced that $S_p$ meets or exceeds a threshold, though the actual size might be greater.
- ALBA achieves efficiency by making use of the gap between the provable lower bound and the actual size, enabling rapid verification without compromising security. The greater the gap, the smaller the proof, and the faster its generation.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By definition the actual size might be greater. I am not sure if "approximate" refers actually to the lower bound (as in tight/loose) or the set size (n_p can be smaller than |Sp|)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a suggestion to clarify it?

- **Historical context**
- The concept builds on classic approaches in proof systems, where similar challenges in communication complexity were addressed by using probabilistic techniques or interactive protocols.
- Previous methods were largely theoretical and less efficient for practical, large-scale applications.
- **Design goals**
- ALBA aims to minimize both proof size and computational load, making it feasible for high-throughput settings like blockchain networks.
- The protocol is versatile and adaptable, supporting non-interactive proofs in both the random oracle and common reference string model as well as allowing multi-prover scenario in decentralized environments.
- This makes it of special interest for multi-party environment, such as a blockchain where many parties collectively validate transactions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could also be more concise. We could say "ALBA works in various settings: unweighted/weighted and centralized/decentralized. It also works in two different models: random oracle and common reference string.". I'm not sure "versatile and adaptable" add anything. "Non-interactive proofs" should be stated somewhere at the beginning of this file.

- **Setup and interaction models**
- Non-interactive Model:
- ALBA provides a non-interactive proof of knowledge in the random oracle model (_NIROPK_), where the verifier can extract knowledge directly from observing queries.
- Decentralized Model:
- ALBA is also adapted for decentralized, multi-prover settings, where several entities hold parts of $S_p$ and communicate over a network to jointly prove possession of evidence, achieving efficiency in both communication and computation.
27 changes: 27 additions & 0 deletions docs/varmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Variable name mapping.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an idea, why not include the short variable names in the documentation to each variable in params.rs and setup.rs instead of this file? The documentation can easily get out of date and it's harder to find, whereas it is easy to open params.rs and read the mappings there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!
I had a similar concern. For example, n_p exists in both setup and params. But, I could only link to one of them in this structure. Also, as I said in my comment, private variables and functions are not documented by the default setting.
However, having a separate page for mapping is also useful while reading the documentation. Especially, when we have more complex doc pages, the reader might need to jump to the mapping. In addition, for the private ones, a reader cannot see any definition related to them on docs.rs when we publish the crate, without cloning the code.

So, my suggestion is to keep this mapping and also have a description for each variable on its own page.

WDYT? @tolikzinovyev @rrtoledo @djetchev


In the [paper](https://iohk.io/en/research/library/papers/approximate-lower-bound-arguments/), numerous variables are represented by various letters. To enhance the simplicity and readability of our code, we have opted for descriptive names. A mapping between the variable names used in the paper and those in the code is provided for reference.


| Paper | Code |
|--------------------|--------------------------------------------------------------------------------------------------|
| $\lambda_{sec}$ | [`soundness_param`][crate::centralized_telescope::params::Params::soundness_param] |
| $\lambda_{rel}$ | [`completeness_param`][crate::centralized_telescope::params::Params::completeness_param] |
| $S_p$ | `prover_set` |
| $n_p$ | [`set_size`][crate::centralized_telescope::params::Params::set_size] |
| $n_f$ | [`lower_bound`][crate::centralized_telescope::params::Params::lower_bound] |
| $u$ | [`proof_size`][crate::centralized_telescope::setup::Setup::proof_size] |
| $r$ | [`max_retries`][crate::centralized_telescope::setup::Setup::max_retries] |
| $d$ | [`search_width`][crate::centralized_telescope::setup::Setup::search_width] |
| $q$ | [`valid_proof_probability`][crate::centralized_telescope::setup::Setup::valid_proof_probability] |
| $b$ | [`dfs_bound`][crate::centralized_telescope::setup::Setup::dfs_bound] |
| $v$ | `retry_counter` |
| $t$ | `search_counter` |
| $H_0$ | `bin_hash` |
| $H_1$ | `round_hash` |
| $H_2$ | `proof_hash` |
| $s_i$ | `Element` |
| $s_1, \ldots, s_u$ | `element_sequence` |
| $p$ | [`lottery_probability`][crate::simple_lottery::setup::Setup::lottery_probability] |
| $limit$ | `step` |

5 changes: 4 additions & 1 deletion src/docs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! Telescope-ALBA documentation
//! Approximate Lower Bound Arguments (_ALBA_) documentation.

#![doc = include_str!("../docs/intro.md")]

#[doc = include_str!("../docs/varmap.md")]
pub mod variables {}
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// #![deny(missing_docs)]
#![doc = include_str!("../README.md")]

//! An implementation of Approximate Lower Bound Arguments
//! (ALBA, <https://eprint.iacr.org/2023/1655.pdf>).
mod utils;

pub mod centralized_telescope;
Expand Down
Loading