Skip to content

Platon based private contract virtual machine for security multi-party computation

License

Notifications You must be signed in to change notification settings

kelvinskk/private-contract-vm

 
 

Repository files navigation

PlatON mpc vm

Directory Structure

Overview

Supported on each platfrom:

Platform IDE/Compiler mpc-libs(relic) mpc-libs(miracl) mpc-jit plang
Debug Release Debug Release Debug Release Debug Release
window 10 Win32 VS 2017 OK(1) OK OK OK OK OK OK OK
window 10 x64 VS 2017 OK OK OK OK OK OK OK OK
Ubuntu 16.04.5 LTS amd64 gcc 5.4 OK OK OK OK OK OK OK OK
Centos 7.5 amd64 gcc 4.9.2 OK OK OK OK OK OK OK OK

OK(1): Compile OK but run.

Building & Installing

On Ubuntu 16.04 TLS.

sudo apt install gcc g++ cmake git zlib1g-dev libssl-dev bzip2 libexpat1-dev libdb++-dev libgmp-dev libcurl4-openssl-dev libboost-all-dev

On CentOS 7.5.1804

sudo yum install gcc g++ cmake git zlib-devel openssl-devel bzip2 expat-devel libdb-cxx-devel gmp-devel libcurl-devel boost-devel

In general,

  1. Install dependencies.
  2. Config ./config/mpc_service_config.h.in.
  3. Run follow command.

Note: cmake version should be not less than 3.0.2

Here are the detail commands:

  • install related dependencies:

    > bash install_deps.sh
    
  • instlall the platon mpc core

    > mkdir build
    > cd build
    > cmake .. -DOPENSSL_ROOT_DIR=/path/to/openssl -DBOOST_INCLUDEDIR=/path/to/boost/include
    > make
    > sudo make install
    

Also, you can ref libcopy & libpublish.

Dependencies

PlatON MPC depends on several modules, these modules can be installed simple with: bash install_deps.sh.

These modules are listed below:

miracl

Default supported on windows.

If you want to test miracl,

> cd test/miracl-test
> ./gen_test.sh

On windows, use relic, usage:

-DOT_NP_USE_RELIC_WIN=1

relic

Default supported on linux.

The relic is not originly ont support on window, currently it only supported on linux.

Here are the intructions to install the relic:

> cd third-code/relic
> rm -rf build && mkdir build && cd build && cmake -DALIGN=16 -DARCH=X64 -DARITH=curve2251-sse -DCHECK=off -DFB_POLYN=251 -DFB_METHD="INTEG;INTEG;QUICK;QUICK;QUICK;QUICK;LOWER;SLIDE;QUICK" -DFB_PRECO=on -DFB_SQRTF=off -DEB_METHD="PROJC;LODAH;COMBD;INTER" -DEC_METHD="CHAR2" -DCOMP="-O3 -funroll-loops -fomit-frame-pointer -march=native -msse4.2 -mpclmul" -DTIMER=CYCLE -DWITH="MD;DV;BN;FB;EB;EC" -DWSIZE=64 ..
> make && make install

Some useful issues: how to support for Visual Studio 2015+.

If you want to use miracl instead of relic, usage:

-DOT_NP_USE_MIRACL=1

openssl

If Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR, such as:

-DOPENSSL_ROOT_DIR=/path/to/openssl

boost

Boost libraries are required. On Ubuntu:

sudo apt install libboost-all-dev

On CentOS:

sudo yum install boost-devel

Note: On CentOS the version of boost installed by yum is almost lower than 1.66.0, so you may have to upgrade the boost to 1.66.0.

Especially On Windows, cmake should run with macro define:

    -DBOOST_ROOT=/path/to/boost
OR
    -DBOOST_INCLUDEDIR=/path/to/boost/include

zeroc-ice

In order to be compatible, use v3.6.x.

For C++, compile on windows, please readme.

To install the zeroc-ice pre-built version 3.6, you should visit

After install the zeroc-ice, the system variable ICE_ROOT should be well configured to where the zeror-ice installed .


On windows, when you attend to compile mpc_* projects in both Win32 and x64(Win32-Debug|Win32-Release|x64-Debug|x64-Release), you should produce both 32-bit(Debug|Release) and 64-bit(Debug|Release) binaries, and then combine them. The directory structure looks like this:

.
|   
+---bin
|   |   *.dll
|   |   *d.dll
|   |   *.exe
|   |   
|   \---x64
|           *.dll
|           *d.dll
|           *.exe
|       
+---include/*.h
|           
+---lib
|   |   *.lib
|   |   *d.lib
|   |   
|   \---x64
|           *.lib
|           *d.lib

Here are some other deps in submodules

Here are some other deps in special

  • secp256k1 from aleth.
  • eth-simplest.

Here are some other deps in alone

You can install them alone, or run install_deps.sh on linux.

About

Platon based private contract virtual machine for security multi-party computation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 48.3%
  • C++ 38.8%
  • Assembly 6.8%
  • Java 2.9%
  • CMake 1.0%
  • Smarty 0.4%
  • Other 1.8%