Fair Math VM
FHE Virtual Machine

FairMath Virtual Machine
The FairMath Virtual Machine (fairmath-vm) is running on the actor side, responsible for executing instructions received from the Orchestration Layer through Order Book.
We have implemented the virtual machine based on OpenFHE, but the specification allows actors to implement it using other libraries, providing flexibility to developers.
FMVM executes compiled FHE applications or their parts and returns the execution results. It operates solely with local files, with all necessary data prepared in advance.
Required Input Data:
Instructions: A file containing the instructions to execute.
Execution Context: A file with precomputed variables (possibly generated on another actor). The execution context allows splitting the application into blocks and running these blocks across multiple actors.
This approach is explained in detail in our Whitepaper.
FMVM requires no additional configuration, making it simple and efficient to use.
How To Build
Install CMake 3.22(or above), gcc or clang
Install OpenMP(this is not necessary but highly recommended)
Clone vcpkg repo and install binary
$ git clone https://github.com/microsoft/vcpkg.git
$ cd vcpkg && ./bootstrap-vcpkg.sh
Add the following env vars
$ export VCPKG_ROOT=/path/to/cloned/vcpkg/repo
$ export PATH=$VCPKG_ROOT:$PATH
You may also to add these variables to your .bashrc
file for convenience.
Clone
fairmath-vm
repository
$ git clone https://github.com/fairmath/fairmath-vm
Configure cmake and build the project. You should specify vcpkg path, build type and directory for cmake generated file.
$ VCPKG_ROOT=/path/to/cloned/vcpkg/repo BUILD_TYPE=Release BIN_DIR=rel cmake --preset=base && cmake --build BUILD/rel
All files will be located in BUILD
directory. You can omit VCPKG_ROOT variable if the one was defined previously(e.g. in the .bashrc
file) Also it is possible to create user defined presets for CMake. Just create the following file in the root of the repository CMakeUserPresets.json:
{
"version": 2,
"configurePresets": [
{
"name": "dbg",
"inherits": "base",
"environment": {
"VCPKG_ROOT": "/path/to/cloned/vcpkg/repo",
"BUILD_TYPE": "Debug",
"BIN_DIR": "dbg"
}
},
{
"name": "rel",
"inherits": "base",
"environment": {
"VCPKG_ROOT": "/path/to/cloned/vcpkg/repo",
"BUILD_TYPE": "Release",
"BIN_DIR": "rel"
}
}
]
}
Since that you are able to run the following command to build release configuration
$ cmake --preset=rel && cmake --build BUILD/rel
Change rel to dbg to build a debug configuration.
The very first build could take a time because of vcpkg will build 3rd party libraries for this project. NExt builds will be mush faster since 3rd party libraries will be already built and cached.
Installation Run cmake install to gather all binary files related to the build.
$ cmake --install BUILD/rel
If you are using provided CMakeUserPresets.json
then build will be installed to the BUILD/install
directory.
Last updated