Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

0xTCG/sequre-mhe

Repository files navigation

Sequre-MHE

Sequre-MHE is an end-to-end, statically compiled and performance engineered, Pythonic framework for building efficient secure multiparty computation (MPC), homomorphic encryption (HE), and multiparty homomorphic encryption (MHE) pipelines in bioinformatics.

Installation

Note: Sequre runs only on Linux at the moment.

Install Codon first:

mkdir $HOME/.codon && curl -L https://github.com/0xTCG/sequre-mhe/releases/download/v0.0.2-alpha/codon-$(uname -s | awk '{print tolower($0)}')-$(uname -m).tar.gz | tar zxvf - -C $HOME/.codon --strip-components=1

Then install Sequre:

curl -L https://github.com/0xTCG/sequre-mhe/releases/download/v0.0.4-alpha/sequre-$(uname -s | awk '{print tolower($0)}')-$(uname -m).tar.gz | tar zxvf - -C $HOME/.codon/lib/codon/plugins

Afterwards, add alias for sequre command:

alias sequre="find . -name 'sock.*' -exec rm {} \; && $HOME/.codon/bin/codon run -plugin sequre -plugin seq"

Finally, you can run Sequre as:

sequre examples/local_run.codon

Examples

Check the code in the examples for quick insight into Sequre.

Online run

At each party run:

sequre examples/online_run.codon <pid>

where <pid> denotes the ID of an underlying party.

For example, in a two-party setup with a trusted dealer, run:

sequre examples/online_run.codon 0

at a trusted dealer (CP0).

sequre examples/online_run.codon 1

at the first party (CP1).

sequre examples/online_run.codon 2

at the second party (CP2).

Local run

To simulate the run on a single machine over multiple processes run:

sequre examples/local_run.codon --skip-mhe-setup

This will simulate the run in a two-party setup with a trusted dealer.

Note: --skip-mhe-setup flag disables the homomorphic encryption setup since playground.codon does not require homomorphic encryption.

Release mode

For (much) better performance but without debugging features such as backtrace, add -release flag immediatelly after sequre command:

sequre -release examples/local_run.codon --skip-mhe-setup

Sequre's network config

Sequre can operate in two network modes:

  • Local: using the inter-process communication (AF_UNIX) sockets.
  • Online: using the TCP (AF_INET) sockets.

If using the online mode, make sure to configure the network within Sequre's settings file at each machine separately.

Example network configuration (stdlib/sequre/settings.codon --- the IP addresses are fictional):

# IPs
TRUSTED_DEALER = '8.8.8.8'  # Trusted dealer
COMPUTING_PARTIES = [
    '9.9.9.9',  # First computing party (CP1)
    '10.10.10.10'  # Second computing party (CP2)
    ]

Note: Make sure to set the same network settings (IP addresses) at each computing party.