The blockchain-mpc-crypto library is a standard C++ dynamic library, which is compatible with any C++ compiler.
This repository includes build projects and scripts for common platforms as described below.
The blockchain-mpc-crypto library has the following dependencies:
- C++ version "-std=c++0x" or newer
- OpenSSL version 1.0.1 or newer
- Java version 1.7 or newer (Optional - use if you need JNI)
- Python version 2.7 or newer (Optional - only for using Python)
Building your target requires having the required OpenSSL version and optionally having Java if JNI is required.
Note: If you are using JNI, you must define the JAVA_HOME environment variable. It is used in the makefile.
Note: If you do not need JNI (the library will not be used from Java), you can disable JNI code generation and build dependency on Java header files by defining MPC_CRYPTO_NO_JNI
(add the flag -DMPC_CRYPTO_NO_JNI
to CPP).
The following sections provide build instructions for the various platforms.
The repository includes a simple makefile for building in Linux.
- Install the openssl-dev package.
- Install Java if required.
- Review the makefile and modify as needed for your environment.
- Run make.
For example, on Ubuntu Linux, use the following:
sudo apt-get update
sudo apt-get install oracle-java8-installer
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/
sudo apt install make
sudo apt install make-guile
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install openssl
sudo apt-get install libssl-dev
git clone https://github.com/unbound-tech/blockchain-crypto-mpc.git
cd blockchain-crypto-mpc
make
export LD_LIBRARY_PATH=.
The repository includes a Visual Studio solution.
- Download and build OpenSSL using its built-in scripts. See OpenSSL on GitHub.
- Set the environment variable OPENSSL_DEV_HOME to the directory where openssl was built.
- If you are building JNI, make sure JAVA_HOME is set properly.
- Open the solution and compile.
This repository includes a macOS Xcode project (in the macos folder).
- Install OpenSSL.
- The Xcode project looks for OpenSSL in /usr/local/opt/openssl.
- If needed, install OpenSSL using HomeBrew:
brew install openssl
- Use the project for building the library.
The repository includes an Android Studio project for building (in the android folder).
TBD
The repository includes a Java build project (in the Java folder).
The Java code is a wrapper over the basic native library.
- Build the native library (including JNI support) for your platform (see relevant platform instructions).
- You can then build the and use the Java code.
The python module is based on the native library (ctypes).
- Build the native library for your platform (see relevant platform instructions).
- The python library can then be used with mpc_crypto.py.
See mpc_demo.py for an actual implementation of client server communication executing different operations.
JNI Error:
fatal error: jni.h: No such file or directory
If you receive this error, then you need to define the JAVA_HOME environment variable. It is used in the makefile.