Skip to content
Haris Smajlović edited this page Dec 17, 2022 · 6 revisions

Welcome to the Sequre wiki!

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


Quick-start

Install

Sequre can only be built from source at the moment. To install Sequre, first clone the repository:

git clone [email protected]:0xTCG/sequre.git && cd sequre

And then run the install script:

scripts/install.sh

This will:

  • Clone and install a version of Seq that contains Sequre-related intermediate representation (IR) transformations.
  • Build the source for both Seq and Sequre.

Test run

Execute

scripts/run.sh playground --local

to run the sample code from playground.codon that contains the benchmarks from Hastings et al..

This run will execute the code in a local, single machine, environment over inter-process communication channels (AF_UNIX). For running the codebase in a different environment, see run instructions.

Run instructions

Use ./sequre script to execute Sequre both on server and client end.

Server run command: (<pid> denotes the ID of the computing party: 0, 1, 2, 3, ...)

./sequre foo.codon <pid>

Client run command:

./sequre bar.codon

See the example for a sample run at the localhost.

Running the example

The example folder contains the running example of a typical multiparty computation use-case in Sequre. It implements a secure variant of PlassClass---a binary classification tool for distinguishing whether a genomic sequence originates from a plasmid sequence or a chromosomal segment.

Folder contains:

  • client.codon - Local source code executed by each client (data owner) locally. It contains a data processing step, followed by a secret sharing routine that initiates secure computing on the servers.
  • server.codon - Online source code executed by each untrusted computing party. It contains a data pooling routine that gathers the secret-shared data from the clients and conducts secure training of a linear support vector machine on top of it.

Localhost run

To run the example locally, execute example/server.codon in a separate terminal for each computing party <pid>:

./sequre example/server.codon <pid>

Finally, initiate the secret sharing of the data and, consequentially, secure training on top of it by running the client's code:

./sequre example/client.codon

Example (condensed into a single terminal for simplicity):

./sequre example/server.codon 0 & \
./sequre example/server.codon 1 & \
./sequre example/server.codon 2 & \
./sequre example/client.codon

Note: Expect obfuscated output (and possibly some minor warning messages) if running in a single terminal. Each party will output the results into the same terminal.

Online run

To run the same procedure on multiple machines, install Sequre and reconfigure the network within Sequre's settings file at each machine separately.

Example network configuration (dsl/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)
    ]

Then at 8.8.8.8 run

./sequre example/server.codon 0

At 9.9.9.9 run:

./sequre example/server.codon 1

At 10.10.10.10 run:

./sequre example/server.codon 2

And finally, at your client's machine, run:

./sequre example/client.codon

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

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 (dsl/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: ./sequre command operates only in an online setup at the moment.

Running playground, tests, and benchmarks

For running tests, benchmarks, and playground, we recommend using the scripts/run.sh script:

srcipts/run.sh <program> [<pid>] [--local] [--use-ring] [--unit]

where:

  • <program> is either tests, benchmarks, or playground.
  • <pid> is optional ID of computing party if the run is online.
  • --local flag triggers the local run, intead of online, using the inter-process communication instead of TCP. Note: <pid> is ignored if the --local flag is present.
  • --use-ring flag coerces usage of $2^k$ rings for MPC subroutines that are generally faster but introduce a slight inaccuracy ( $\pm 1/2^{20}$ ) to the fixed-point arithmetic. Without the flag, Sequre defaults to a finite field instead. Note: --use-ring is ignored while running tests. Tests are executed on both rings and fields.
  • --unit flag restricts the tests to unit test only. By default, both unit and end-to-end tests of applications (GWAS, DTI, Opal, and Ganon) are executed.

Example invocation of unit tests in a localhost in an online network environment: (use multiple terminals for clear output)

srcipts/run.sh tests --unit 0 & \
srcipts/run.sh tests --unit 1 & \
srcipts/run.sh tests --unit 2

Note: Each run bellow is executed in a local setup. Online run is also possible. See example above for a step-by-step guide and/or Sequre's network config for details.

Running playground

Playground contains the three MPC benchmarks from Hastings et al.. Use it to quickly explore Sequre and its features.

Example invocation:

scripts/run.sh playground --local --use-ring

Running tests

To run all unit tests execute:

scripts/run.sh tests --unit --local

This will execute all unit tests locally, on a single machine.

Drop the --unit flag to include the end-to-end tests for genome-wide association study, drug-target interaction inference, and metagenomic classifiers as well:

scripts/run.sh tests --local

Running benchmarks

To benchmark all applications run:

scripts/run.sh benchmarks --local

Include --use-ring flag to re-run all benchmarks on rings instead of fields:

scripts/run.sh benchmarks --local --use-ring

This will benchmark the following applications in Sequre:

  • Sequre's linear algebra subroutines
  • Genome-wide association study on top of a toy dataset from Cho et al..
  • Drug-target inference on top of a reduced STITCH dataset from Hie et al..
  • Opal (metagenomic binning) with 0.1x and 15x coverage of the complete Opal dataset from Yu et al.
  • Ganon (metagenomic binning) on top of a single read from the complete Opal dataset from Yu et al.

Benchmark results are stored in the results folder.