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

Merged
merged 31 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d1527d3
introduction
curiecrypt Nov 11, 2024
5220e66
Apply suggestions from code review
curiecrypt Nov 11, 2024
a8c1b58
readme v0
curiecrypt Nov 11, 2024
48b3b9e
Merge branch 'curiecrypt/doc-intro' of https://github.com/cardano-sca…
curiecrypt Nov 11, 2024
58867cb
typo
curiecrypt Nov 11, 2024
9b2b540
Apply suggestions from code review v1
curiecrypt Nov 11, 2024
79303c6
addressing the review suggestions v0
curiecrypt Nov 11, 2024
822bbaa
Readme corrected
curiecrypt Nov 11, 2024
49712ea
variable mapping v0
curiecrypt Nov 12, 2024
01b8e69
variable mapping v1
curiecrypt Nov 12, 2024
e9f5d3c
readme example
curiecrypt Nov 13, 2024
a71b273
Capital letter Rust
curiecrypt Nov 13, 2024
945695a
Apply suggestions from code review
curiecrypt Nov 14, 2024
77afbea
minor corrections - review suggestions
curiecrypt Nov 14, 2024
01e001a
splitting each sentence to a single line
curiecrypt Nov 14, 2024
bea9f2a
address readme suggestions
curiecrypt Nov 21, 2024
707dde0
Apply suggestions from code review
curiecrypt Nov 25, 2024
1688bce
typos
curiecrypt Nov 25, 2024
c4beea2
intro suggestions addressed
curiecrypt Nov 25, 2024
7e21e0b
do not distinguish bounded and naive telescope
curiecrypt Nov 25, 2024
d6abccb
config for cargo doc katex header
curiecrypt Nov 26, 2024
0c39bf4
Apply suggestions from code review
curiecrypt Nov 26, 2024
be0de7e
toml updated
curiecrypt Nov 28, 2024
f6c6f01
warning symbol
curiecrypt Nov 29, 2024
e44fe45
unicode emojis
curiecrypt Nov 29, 2024
3066422
readme suggestions
curiecrypt Nov 29, 2024
0184e5f
intro suggestions
curiecrypt Nov 29, 2024
ac3eb80
Apply suggestions from code review
curiecrypt Dec 2, 2024
92918d3
review suggestions
curiecrypt Dec 2, 2024
fd7e3eb
review suggestions addressed
curiecrypt Dec 2, 2024
a14dc35
Merge branch 'main' into curiecrypt/doc-intro
curiecrypt Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 85 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,91 @@
# 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 is a cryptographic primitive that enables a prover to convince a verifier that their dataset includes at least a minimum number of elements meeting a specific condition, called a predicate, without revealing the entire dataset.
The core idea of ALBA is to efficiently prove knowledge by leveraging an *approximate lower bound*.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
This approach introduces a controlled gap between the prover's actual knowledge and the threshold required for the verifier to be convinced.
This gap not only gives ALBA its name (_Approximate Lower Bound Argument_) but also enables highly efficient algorithms for generating compact proofs.
ALBA proofs are particularly small and efficient in scenarios with significant discrepancy between the dataset size and the threshold to prove, or involving weight oracles, and are generated significantly faster than traditional SNARKs.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
Its main applications include large-scale decentralized signature schemes and other blockchain scenarios where it improves communication efficiency among multiple provers sharing a common witness.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved

> **Approximate Lower Bound Arguments**, _Pyrros Chaidos, Prof Aggelos Kiayias, Leonid Reyzin, Anatoliy Zinovyev_, May 2024, Eurocrypt'24
For example, 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 to prove a majority was reached.
Each vote can be considered an _element_ that meets a certain predicate (e.g., a valid vote for a specific 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).
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
Combining ALBA with zero-knowledge technology such as _zk-SNARKs_, we can efficiently keep individual votes private while reducing the proof size even more.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
Beyond voting, ALBA's versatility makes it suitable for various use cases requiring efficient, scalable proof systems that balance privacy, speed, and resource efficiency.

> [!IMPORTANT]
### ALBA in a Nutshell
ALBA's core construction, the _centralized telescope_, operates as follows:
The prover holds a set of $n_p$ elements (e.g. signatures, data points, or weighted items) that satisfy a predicate.
The verifier needs to be convinced that the prover knows more than $n_f$ elements, where $n_f < n_p$.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
ALBA generates a proof by choosing a subset of, potentially repeated, elements through a random walk satisfying some oracle checks at each step, outputting a tuple significantly smaller than $n_f$.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
The larger the ratio $n_p / n_f$, the smaller the proof size, making ALBA practical for scenarios involving large datasets and low thresholds.

ALBA also supports *weighted elements*, where each item has an integer weight.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
In this case the prover demonstrates possession of elements with a total weight of at least $n_p$, while convincing the verifier that the total weight exceeds $n_f$.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
In *decentralized settings*, ALBA adapts to distributed data environments.
Multiple participants play a lottery and send their elements to an aggregator accordingly, which then combines them into a single, compact proof for the verifier.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved

ALBA can seamlessly handle both *weighted/unweighted* and *centralized/decentralized* configurations.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
This flexibility is particularly valuable in applications like *proof-of-stake blockchains*, where weights represent stake amounts.
ALBA there ensures that honest participants' stakes outweigh malicious contributions, providing robust security in distributed systems.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
The *decentralized construction* of ALBA stands out for its flexibility, offering tradeoffs between proof size and communication complexity.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
This feature allows protocol designers to optimize ALBA for various decentralized applications.

### Why Use ALBA?
ALBA is an ideal choice for applications that require:
- *Fast proof generation and verification*, such as in blockchain systems or multisignature schemes.
- *Efficient decentralized collaboration*, enabling multiple participants to jointly prove knowledge.
- *Flexibility in tradeoffs*, balancing proof size and communication overhead.
Whether it's for multisignatures, proof-of-stake systems, or secure voting protocols, ALBA provides a robust, scalable, and efficient solution for proving knowledge across diverse use cases.

Check warning on line 42 in README.md

View workflow job for this annotation

GitHub Actions / build

doc list item without indentation
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved

## Implementation
The library implements ALBA schemes based on two core constructions: *Telescope* and *Lottery*.
These constructions form the foundation for the various configurations supported, including centralized and decentralized setups as well as unweighted and weighted scenarios.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved

The *Telescope* construction allows the prover to build a sequence of elements that satisfy staged hash-based conditions.
This process efficiently filters relevant elements, narrowing down the data to subsets that meet the required criteria.
By introducing bounded repetitions and constraints on the prover's search, the construction ensures scalability and efficiency for large datasets.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved

The *Lottery* construction offers a decentralized approach where participants probabilistically decide whether to share their elements with an aggregator.
The aggregator collects enough shared elements to generate a proof.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
This method is inherently decentralized and can also handle weighted scenarios by incorporating element weights into the lottery process.

Using these constructions, the library supports eight ALBA schemes, covering a wide range of configurations:
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- Centralized unweighted Telescope Bounded (Section 3.2.2)
- Decentralized unweighted Telescope Bounded (Sections 3.2.2, 4.2)
- Centralized weighted Telescope Bounded (Sections 3.2.2, 5)
- Decentralized weighted Telescope Bounded (Sections 3.2.2, 4.2, 5)
- Centralized unweighted Simple Lottery (Section 4.1)
- Decentralized unweighted Simple Lottery (Section 4.1)
- Centralized weighted Simple Lottery (Sections 4.1, 5)
- Decentralized weighted Simple Lottery (Sections 4.1, 5)


### Disclaimer
> This code is NOT fit for production, it's not been optimised, thoroughly tested, nor audited by competent cryptographers.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
> 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

### Library
Compile the library by:
```shell
cargo build --release
```

### Tests and Benchmarks
Run tests with `cargo test`. Run benchmarks with `cargo bench`.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved

👉 Checkout documentation on https://alba.cardano-scaling.org
### Documentation
Compile the documentation by:
```shell
RUSTDOCFLAGS="--html-in-header docs/assets/katex-header.html" cargo doc --no-deps --open
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
```
39 changes: 38 additions & 1 deletion docs/intro.md
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
**Telescope ALBA** documentation.
- Assume that a prover has a large collection of data. They want to convince a verifier that their set contains at least a minimum number of elements satisfying a specific condition, known as a predicate. This remains true even if the prover only shares a portion of their data.
- A trivial solution to this problem would be for the prover to provide the entire dataset or all sequence elements to the verifier. However, this approach is inefficient due to the large size of the data and communication costs.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- The Approximate Lower Bound Argument (ALBA) protocol is a new cryptographic primitive that solves this problem efficiently.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- ALBA is designed to prove knowledge efficiently by leveraging an *approximate lower bound*.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- This approach establishes a gap between the prover's actual knowledge and the threshold needed to convince the verifier.
- The gap enables compact proofs and efficient verification.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- ALBA supports both centralized and decentralized setups, as well as weighted and unweighted datasets, making it useful for applications such as blockchain protocols, voting systems, and multisignature schemes.

## Overview
- **The Protocol**
- The protocol addresses the challenge of succinctly proving knowledge of a large set of verifiable evidence.
- The prover convinces the verifier by revealing only a subset of this evidence, 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 aims to convince the verifier that the set contains more than $n_f$ elements, where $n_f$ is a threshold strictly smaller than $n_p$.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- This establishes an _approximate_ lower bound because the prover's proof guarantees the presence of more than $n_f$ elements, but the actual set size $|S_p|$ is typically greater. The term "approximate" reflects that the bound is loose rather than tight.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- $n_p$ might be smaller than $|S_p|$ for various practical reasons:
- *Uncertainty about* $|S_p|$: In scenarios like probabilistic lotteries, not all elements of the set are sent, and the actual number depends on the lottery draw.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- *Timeliness*: The prover may want to generate a proof as soon as possible without waiting to collect all elements in the dataset. Even with $n < n_p$ (and $n > n_f$), there is a chance of successfully generating a proof.
- ALBA achieves efficiency by leveraging the gap between the provable lower bound ($n_f$) and the actual set size ($|S_p|$). This gap enables compact proofs and rapid verification without compromising security. The larger the ratio $n_p / n_f$, the smaller the proof and the faster its generation.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- **Historical context**
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- 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.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- **Design goals**
- *Efficiency*: Ensure fast proof generation and verification with minimal computational and communication overhead.
- *Scalability*: Handle large datasets with low thresholds, suitable for high-throughput applications like blockchains.
- *Flexibility*: Support a range of configurations, including weighted/unweighted and centralized/decentralized setups.
- *Practical Usability*: Provide developers with an implementation that bridges theoretical concepts and real-world use cases.
- **Setup and interaction models**
- *Centralized Model*:
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- A single prover generates a proof by selecting subsets of elements that satisfy certain conditions, outputting a compact certificate for the verifier.
- *Decentralized Model*:
- Multiple participants contribute their elements to an aggregator, who combines them into a single proof.
- This model is particularly efficient in scenarios requiring distributed collaboration, such as proof-of-stake blockchains or voting protocols.
- *Weighted and Unweighted Configurations*:
- In the unweighted setting, the proof involves demonstrating possession of a minimum number of elements.
- In the weighted setting, each element has an associated integer weight, and the prover demonstrates that the total weight meets or exceeds the required threshold.
- *Proof Construction Methods*:
- *Telescope*: Filters and narrows down subsets of elements through staged conditions, optimizing for speed and size.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved
- *Lottery*: Probabilistically selects elements in decentralized environments, supporting both weighted and unweighted setups.
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.
curiecrypt marked this conversation as resolved.
Show resolved Hide resolved

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