GithubHelp home page GithubHelp logo

ertosns / mpc-stark Goto Github PK

View Code? Open in Web Editor NEW

This project forked from renegade-fi/ark-mpc

0.0 0.0 0.0 595 KB

A framework for SPDZ-style maliciously-secure MPC over the STARK curve.

Home Page: https://renegade.fi

License: Apache License 2.0

Shell 0.06% Rust 99.66% Dockerfile 0.28%

mpc-stark's Introduction

MPC-Stark

Example

mpc-stark provides a malicious secure SPDZ style framework for two party secure computation. The circuit is constructed on the fly, by overloading arithmetic operators of MPC types, see the example below in which each of the parties shares a value and together they compute the product:

use mpc_stark::{
    algebra::scalar::Scalar, beaver::SharedValueSource, network::QuicTwoPartyNet, MpcFabric,
    PARTY0, PARTY1,
};
use rand::thread_rng;

#[tokio::main]
async fn main() {
    // Beaver source should be defined outside of the crate and rely on separate infrastructure
    let beaver = BeaverSource::new();

    let local_addr = "127.0.0.1:8000".parse().unwrap();
    let peer_addr = "127.0.0.1:9000".parse().unwrap();
    let network = QuicTwoPartyNet::new(PARTY0, local_addr, peer_addr);

    // MPC circuit
    let mut rng = thread_rng();
    let my_val = Scalar::random(&mut rng);
    let fabric = MpcFabric::new(network, beaver);

    let a = fabric.share_scalar(my_val, PARTY0 /* sender */); // party0 value
    let b = fabric.share_scalar(my_val, PARTY1 /* sender */); // party1 value
    let c = a * b;

    let res = c.open_authenticated().await.expect("authentication error");
    println!("a * b = {res}");
}

Tests

Unit tests for isolated parts of the library are available via

cargo test --lib --features test_helpers

The bulk of this library's testing is best done with real communication; and so most of the tests are integration tests. The integration tests can be run as

./run_integration.zsh

or more directly as

docker compose up

mpc-stark's People

Contributors

joeykraut avatar ertosns avatar github-actions[bot] 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.