Skip to content

exfinen/mpc-demo-infra

 
 

Repository files navigation

mpc-demo-infra

A demonstration infrastructure for Multi-Party Computation (MPC) using TLSN and MP-SPDZ.

Table of Contents

DevCon 2024

To participate in our demo ETH Inequality @ DevCon 2024 and win some prizes, please refer to the README for the entire process.

Dependencies

  • python 3
  • poetry
  • cargo
  • TLSN
    • branch: mpspdz-compat
    • clone it as ../tlsn
  • MP-SPDZ (only required for computation party server)
    • branch: demo_client
    • clone it as ../MP-SPDZ
    • need to add MOD = -DGFP_MOD_SZ=5 -DRING_SIZE=257 to CONFIG.mine
    • install: make setup
    • build vm: make replicated-ring-party.x

Getting Started

Run it using tests folder

poetry run pytest -s tests/test_integration.py

Run it locally

Note: This section is for running the MPC demo locally. For cloud deployment, you'll need to adjust network configurations.

The demo consists of three main components:

  1. Coordination Server: Coordinates the MPC process.
  2. Computation Party Servers: Run by 3 trusted parties and perform the actual MPC computations.
  3. Client CLI: Used by data provider to share data and query results.

Install dependencies:

./setup_env.sh --setup-mpspdz

Default ports:

  • 8005: coordination server
  • 80068008: computation party server 02
  • 8010~8100: ports used by MPC servers during sharing data and querying results

Please make sure these ports are not used by other services.

Setup coordination server:

In a terminal, run coordination server:

poetry run coord-run

Setup computation party server:

In a terminal, run party 0:

PORT=8006 PARTY_ID=0 poetry run party-run

In another terminal, run party 1:

PORT=8007 PARTY_ID=1 poetry run party-run

In another terminal, run party 2:

PORT=8008 PARTY_ID=2 poetry run party-run

Data provider share data with a generated voucher.

poetry run client-share-data <eth_address> <binance_api_key> <binance_api_secret>

Query computation result

poetry run client-query

Configurations

See available configs in

You can use .env.xxx to override the default configs.

Troubleshooting

If you encounter issues:

  1. Ensure all dependencies are correctly installed.
  2. Check that the required ports (8005-8008, 8010-8100) are not in use.
  3. Verify that TLSN and MP-SPDZ are cloned in the correct locations (../tlsn and ../MP-SPDZ).
  4. For MP-SPDZ issues, ensure
  • you've added MOD = -DGFP_MOD_SZ=5 to CONFIG.mine.
  • you've generated certificates for computation parties. If not, run Scripts/setup-ssl.sh under ../MP-SPDZ.
  • you've rebuilt the VM. If not, run make replicated-ring-party.x under ../MP-SPDZ.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 89.7%
  • Shell 6.0%
  • Dockerfile 4.3%