Git Product home page Git Product logo

mastic's Introduction

Mastic: Private Weighted Heavy-Hitters and Attribute-Based Metrics

How to cite this work

The preprint can be accessed here; you can cite this work as follows:

@Misc{EPRINT:MPDST24,
  author =       "Dimitris Mouris and
                  Christopher Patton and
                  Hannah Davis and
                  Pratik Sarkar and
                  Nektarios Georgios Tsoutsos",
  title =        "{Mastic: Private Weighted Heavy-Hitters and Attribute-Based Metrics}",
  year =         2024,
  howpublished = "Cryptology ePrint Archive, Report 2024/221",
  note =         "\url{https://eprint.iacr.org/2024/221}",
}

Build & Run With Docker Compose

The following runs two aggregators and the leader each in a different container for weighted heavy hitters:

❯❯ CONFIG=weighted-heavy-hitters.toml docker compose up

Similarly, for the two other modes that Mastic supports:

❯❯ CONFIG=attribute-based-metrics.toml docker compose up
❯❯ CONFIG=plain-metrics.toml docker compose up

Building

First, make sure that you have a working Rust installation:

❯❯ rustc --version
rustc 1.74.0
❯❯ cargo --version
cargo 1.74.0

Next, build from sources using:

❯❯ cargo build --release

Running

The config file

The client and servers use a common configuration file, which contains the parameters for the system. The config file is also used to choose between the different modes of operation. Here, we show the basic structure of the config file. Each mode (Weighted Heavy Hitters, Attribute-Based Metrics, and Plain Metrics with Prio) uses a different config. The contents that are shared between all the config files are shown below:

data_bits = 8                       # Number of bits of each string.
hist_buckets = 2                    # Number of each histogram buckets

# [mode]                            # Mode of operation, one of:
# mode.weighted_heavy_hitters.threshold = 0.01
# mode.attribute_based_metrics.num_attributes = 10
# mode = "plain_metrics"

server_0 = "0.0.0.0:8000"           # The `IP:port` for server 0.
server_1 = "0.0.0.0:8001"           # The `IP:port` for server 1.

add_report_share_batch_size = 1000  # Size of RPC requests for transmitting keys.
query_flp_batch_size = 100000       # Size of RPC requests for transmitting FLPs.

zipf_unique_buckets = 1000          # Zipf parameter
zipf_exponent = 1.03                # Zipf exponent

1. Weighted Heavy Hitters

weighted-heavy-hitters.toml

# ...
mode.weighted_heavy_hitters.threshold = 0.01
# ...

Weighted Heavy Hitters: Aggregators

Run the aggregators in two separate shells. They will wait and be ready to process client requests.

cargo run --release --bin server -- --config src/configs/weighted-heavy-hitters.toml --server_id 0
cargo run --release --bin server -- --config src/configs/weighted-heavy-hitters.toml --server_id 1

Weighted Heavy Hitters: Clients

In another shell, send 100 client requests to the Aggregators:

cargo run --release --bin driver -- --config src/configs/weighted-heavy-hitters.toml -n 100

To run with the presence of malicious clients include the --malicious flag followed by the percentage of malicious clients to generate ([0.0, 0.9]). For instance, to run with 5% malicious clients use:

cargo run --release --bin driver -- --config src/configs/weighted-heavy-hitters.toml -n 100 --malicious 0.05

2. Attribute-Based Metrics

attribute-based-metrics.toml

# ...
mode.attribute_based_metrics.num_attributes = 10
# ...

Attribute-Based Metrics: Aggregators

Run the aggregators in two separate shells. They will wait and be ready to process client requests.

cargo run --release --bin server -- --config src/configs/attribute-based-metrics.toml --server_id 0
cargo run --release --bin server -- --config src/configs/attribute-based-metrics.toml --server_id 1

Attribute-Based Metrics: Clients

In another shell, send 100 client requests to the Aggregators:

cargo run --release --bin driver -- --config src/configs/attribute-based-metrics.toml -n 100

To run with the presence of malicious clients include the --malicious flag followed by the percentage of malicious clients to generate ([0.0, 0.9]). For instance, to run with 5% malicious clients use:

cargo run --release --bin driver -- --config src/configs/attribute-based-metrics.toml -n 100 --malicious 0.05

3. Plain Metrics with Prio

plain-metrics.toml

# ...
mode = "plain_metrics"
# ...

Plain Metrics with Prios: Aggregators

Run the aggregators in two separate shells. They will wait and be ready to process client requests.

cargo run --release --bin server -- --config src/configs/plain-metrics.toml --server_id 0
cargo run --release --bin server -- --config src/configs/plain-metrics.toml --server_id 1

Plain Metrics with Prio: Clients

In another shell, send 100 client requests to the servers:

cargo run --release --bin driver -- --config src/configs/plain-metrics.toml -n 100

To run with the presence of malicious clients include the --malicious flag followed by the percentage of malicious clients to generate ([0.0, 0.9]). For instance, to run with 5% malicious clients use:

cargo run --release --bin driver -- --config src/configs/plain-metrics.toml -n 100 --malicious 0.05

4. Plain Heavy Hitters with Mastic

This branch can do Plain Heavy Hitters by setting the histogram size to 1, but a more efficient implementation uses the Count circuit and is in the Count branch.

Disclaimer

This is software for a research prototype and not production-ready code. This repository builds upon plasma, heavy-hitters, and libprio-rs.

This is a Rust implementation of the ideas presented in Mastic Verifiable Distributed Aggregation Function (VDAF) individual Internet-Draft. You can read the draft on the Datatracker Page.

mastic's People

Contributors

jimouris avatar cjpatton avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.