Skip to content

luosword/MPC-Platform

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MPC Platform

The Multi-Party Computation Verify Platform.

Build & Start

Prepare

Ensure that you have downloaded the server, sharer, and verifier from the release and placed them in the run-dir directory. We have provided the compiled programs for the Linux amd64 system in the release. If your platform is different, you can also enter the components folder to compile these three executable programs separately and place them in the run-dir directory.

If you want to compile them by yourself, please make sure that you have installed go 1.21+, gcc 11+, and cmake 3.16+, as well as the SCI library of EzPC. For the compilation of the SCI library, please refer to the official manual. After compiling the SCI library, please set the following two lines in components/shr_based/CMakeLists.txt to the address of your compiled SCI library:

set(SCI_DIR "/path/to/SCI/install/dir/lib/cmake/SCI")
include_directories("/path/to/SCI/install/dir/include")

Then, execute the following commands to compile the verifier and sharer:

cd components/shr_based
mkdir build && cd build
cmake ..
cmake --build .

The compiled verifier and sharer are located in the components/shr_based/build folder. Next is the compilation of the scheduler server. Execute the following commands:

cd components/server
go mod tidy
go mod vendor
go build -ldflags="-s -w"

The compiled server is located in the components/server folder. After all the above compilations are completed, place the server, sharer, and verifier in the run-dir directory to complete the preparation work of the core programs.

Next, please ensure that you have installed python and pip (or a conda virtual environment), and the python version should be 3.10+; at the same time, nodejs and yarn are also necessary, and the nodejs version should be 18.16+. The following commands are used to install the dependencies of python and nodejs:

cd app-front-end
yarn

cd app-back-end
pip install -r requirements.txt

Then the preparation is finished.

Run

Front-End. The front-end of this application is developed based on React and Antd. To start the front-end, open a new terminal screen (you can use tools like screen or tmux in a Linux environment), and then execute the following:

# In a new screen
cd app-front-end
yarn start

Back-End. The back-end of this application is powered by FastAPI and Uvicorn. To start the back-end, open another new terminal screen, and then execute the following:

# In a new screen
cd app-back-end
python main.py

Scheduler. The scheduler is built using Gin. To start the scheduler, open another new terminal screen, and then execute the following:

# In a new screen
cd run-dir
./server

Finishing. If these components are not all deployed on the local machine, you can modify the scheduler IP in app-back-end/main.py and the back-end IP in app-front-end/src/config.ts. After making these adjustments, you can access the system page by navigating to [front-end IP]:3000 in your browser. If the port 3000 is occupied, the application will be accessible at [front-end IP]:3001.

Test Outlines

You can certainly use the script to test the system, including the back-end and the scheduler. Following the stage like this:

#!/bin/bash

for N in 1000000 10000000 100000000
do
    echo "Running with data length: $N"

    python ../scripts/gen.py -n $N -f partyA_data.csv
    python ../scripts/look.py -f partyA_data.csv
    python ../scripts/look.py -f partyA_data.csv -l 10

    python ../scripts/gen.py -n $N -f partyB_data.csv
    python ../scripts/look.py -f partyB_data.csv
    python ../scripts/look.py -f partyB_data.csv -l 10

    for O in add sub mul div exp
    do
        echo "Running with operation: $O"

        python ../scripts/cal.py -a partyA_data.csv -b partyB_data.csv -f result_data.csv -o $O
        python ../scripts/look.py -f result_data.csv
        python ../scripts/look.py -f result_data.csv -l 10

        python ../scripts/run.py -a partyA_data.csv -b partyB_data.csv -r result_data.csv -c checked_result.csv -o $O -n 0 -w 8
        wc -l checked_result.csv
        head -n 10 checked_result.csv

        python ../scripts/break.py -f result_data.csv -b 0.1
        python ../scripts/run.py -a partyA_data.csv -b partyB_data.csv -r result_data.csv -c checked_result.csv -o $O -n 0 -w 8
        wc -l checked_result.csv
        head -n 10 checked_result.csv
    done
done

The commands can also be found in scripts/tldr.sh.

About

MPC(Multi-Party Computation) all in one.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 32.4%
  • C++ 27.3%
  • TypeScript 18.7%
  • Go 17.6%
  • CMake 1.7%
  • HTML 1.3%
  • Shell 1.0%