{"id":13546168,"url":"https://github.com/sine-fdn/tandem","last_synced_at":"2025-04-02T17:32:39.334Z","repository":{"id":63896818,"uuid":"565905050","full_name":"sine-fdn/tandem","owner":"sine-fdn","description":"A maliciously secure two-party computation engine which is embeddable and accessible","archived":false,"fork":false,"pushed_at":"2025-03-25T16:00:50.000Z","size":1804,"stargazers_count":185,"open_issues_count":10,"forks_count":17,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-28T20:14:04.242Z","etag":null,"topics":["garbled-circuits","mpc","multi-party-computation","rust","secure-multi-party-computation","smpc"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sine-fdn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-14T15:15:49.000Z","updated_at":"2025-03-17T02:09:28.000Z","dependencies_parsed_at":"2023-12-19T18:18:32.057Z","dependency_job_id":"3978cbb8-9686-4319-b3c6-dfac662dd0bc","html_url":"https://github.com/sine-fdn/tandem","commit_stats":{"total_commits":97,"total_committers":5,"mean_commits":19.4,"dds":0.4948453608247423,"last_synced_commit":"fdf5a299d866d311c2bec5f6f37b01f026b2f3f5"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sine-fdn%2Ftandem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sine-fdn%2Ftandem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sine-fdn%2Ftandem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sine-fdn%2Ftandem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sine-fdn","download_url":"https://codeload.github.com/sine-fdn/tandem/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246860284,"owners_count":20845637,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["garbled-circuits","mpc","multi-party-computation","rust","secure-multi-party-computation","smpc"],"created_at":"2024-08-01T12:00:32.820Z","updated_at":"2025-04-02T17:32:38.874Z","avatar_url":"https://github.com/sine-fdn.png","language":"Rust","funding_links":[],"categories":["Cryptography","Software"],"sub_categories":["Frameworks","Retired software"],"readme":"# Tandem\n\n\u003cimg alt=\"SINE Logo\" height=\"150\" align=\"right\" src=\"https://user-images.githubusercontent.com/358580/204315360-9e4916df-5080-4e7c-bd5b-7e002309b9db.png\"\u003e\n\n[Secure Multi-Party Computation (SMPC)](https://sine.foundation/library/002-smpc) is a cryptographic field with the goal of allowing two or more parties to cooperatively compute a result while keeping their inputs private.\n\nOur aim at SINE is to make advanced technology, such as SMPC, available to as many companies as possible. We are especially keen to apply [SMPC for the exchange of sustainability data](https://sine.foundation/library/sine-is-partnering-with-wbcsd-to-decarbonise-the-economy).\n\nTandem, our SMPC engine, aims at fulfilling our vision by providing an easy to use framework to apply this technology wherever there is a need to share data privately, without a third-party trustee.\n\n## Encryptle - Tandem in Action\n\nTandem is fast enough to be used for practical applications. Check out Encryptle, a Wordle clone that runs entirely over SMPC:\n\nhttps://encryptle.sine.foundation/\n\n## Quick Start\n\nThe easiest way to try out Tandem is by using our demo server, either by using our online playground or by connecting to it from your local machine using our command line client:\n\n### Online Playground\n\nGo to \u003chttps://playground.sine.foundation/\u003e, where you can execute programs written in [Garble](https://github.com/sine-fdn/garble-lang). The demo server will use the plaintext metadata that is passed in on the playground as its own \"private\" input. Of course this defeats the purpose of using Multi-Party Computation, but it is a quick and easy way to try out the engine.\n\nTry the following inputs for the example program provided, which adds two signed 32 bit integers, 3 and 7, and then prints `10i32` as the result:\n\n  - Function to Execute: `main`\n  - Metadata (Plaintext): `3i32`\n  - Input (Kept Private): `7i32`\n\n### Command Line Client\n\nYou can also connect to the server using the command line client. To do so, install the client binary, create a file containing the garble program and then run the client:\n\n```sh\ncargo install --features=\"bin\" tandem_http_client\necho \"pub fn main(x: u8, y: u8) -\u003e u8 { x + y }\" \u003e add.garble.rs\ntandem_http_client --function main --input 3u8 --metadata 7u8 add.garble.rs\n```\n\n## Overview\n\nThis repository consists of four crates:\n\n#### [`tandem`](tandem/)\n\nThis crate includes SINE's Secure Multi-Party Computation engine, Tandem. It is a Rust library, implementing [WRK17](https://acmccs.github.io/papers/p21-wangA.pdf) as a non-blocking [Finite State Machine](https://en.wikipedia.org/wiki/Finite-state_machine) (FSM).\n\nPlease note that, for the time being, Tandem only supports __two-party__ computation.\n\n#### [`tandem_garble_interop`](tandem_garble_interop/)\n\nThe Tandem engine runs [Garbled Circuits](https://en.wikipedia.org/wiki/Garbled_circuit). As these are cumbersome to write, SINE provides a higher-level programming language: [Garble](https://github.com/sine-fdn/garble-lang). This crate provides helper functions for translating between the Tandem MPC engine circuit representation and the Garble language circuit representation and types.\n\n#### [`tandem_http_client`](tandem_http_client/)\n\nThis crate provides an HTTP client to use the Tandem engine (against a running `tandem_http_server` server). This crate includes a CLI client, functions targetting WebAssembly and an [interactive notebook](https://mpc-notebook.fly.dev) to test Garble programs during development.\n\n#### [`tandem_http_server`](tandem_http_server/)\n\nThis crate provides an HTTP server to use the Tandem engine (with some client). This crate can be used as either a library to construct a server with custom logic or as a binary to run a sample server based on [Rocket](https://rocket.rs/).\n\n## Usage\n\n### Basics\n\nEvery SMPC session run by the Tandem engine depends on the following data:\n\n1. An MPC program, known to both client and server in plaintext;\n2. The name of the function in the MPC program to be executed;\n3. The _contributor_'s input, known only to the server (the first argument of the function);\n4. The _evaluator_'s input, known only to the client (the second argument of the function).\n\nThe Tandem engine runs [Garbled Circuits](https://en.wikipedia.org/wiki/Garbled_circuit) and is agnostic as to what their source is. However, we recommend that all of the above be written in [Garble](https://github.com/sine-fdn/garble-lang), SINE's programming language, developed specifically for this end. To learn more about Garble and its syntax, take the [Language Tour](https://github.com/sine-fdn/garble/blob/main/language_tour.md).\n\nIn order for the Tandem engine to run, both a server and a client must already be set up and running. Please refer to the documentation on the [`tandem_http_server`](tandem_http_server/) and [`tandem_http_client`](tandem_http_client) crates to set them up according to your needs.\n\n### Demo\n\nThe following is a demonstration of how to run Tandem with a simple function and inputs using the CLI provided by the `tandem_http_client` crate. Please follow these instructions in order.\n\n#### 1. Starting the Server\n\nUse the commands below to build, install and run the sample server provided by the `tandem_http_server` crate on `localhost:8000`:\n\n```sh\ncargo install --features=\"bin\" tandem_http_server\ntandem_http_server\n```\n\nThis server acts as a simple 'echo server', which expects the contributor's input to be supplied by the client (as plaintext metadata). While not appropriate in any practical setting, this can be used to test different programs without having to re-deploy servers. This server will accept and execute all MPC programs sent by the client.\n\nTo know how to start a server with static configuration, refer to the [`tandem_http_server` documentation](tandem_http_server/README.md).\n\n#### 2. Installing the Client's CLI\n\nOn a different terminal tab, use the commands below to install and run the CLI app provided by the `tandem_http_client` crate:\n\n```sh\ncargo install --features=\"bin\" tandem_http_client\ntandem_http_client \u003cPROGRAM\u003e \\\n  [OPTIONS] \\\n  --function \u003cFUNCTION\u003e \\\n  --input \u003cINPUT\u003e \\\n  --metadata \u003cMETADATA\u003e\n```\n\nThe `[OPTIONS]` include the flag `--url`, allowing us to set the URL of the HTTP server to use. If none is provided, it defaults to the 'echo server' deployed by SINE: https://echo-server.sine.dev. (Run `tandem_http_client --help` for more information.)\n\n#### 3. Running the Tandem Engine\n\nWe are now ready to gather the four pieces of data needed to run the Tandem engine. Below are the data to be used in this demonstration:\n\n##### MPC Program\n\nThe following Garble program takes two unsigned `8 bit` numbers and outputs their sum:\n\n```Rust\npub fn main(x: u8, y: u8) -\u003e u8 {\n    x + y\n}\n```\n\nThis program is stored in `tandem_http_client/tests/.add.garble.rs`.\n\n##### Name of the Function\n\nThe function we want to call is `main`.\n\n##### Contributor's Input\n\nIn this case, the contributor's input will be `110u8` (an unsigned 8-bit integer with a value of 110).\n\n##### Evaluator's Input\n\nIn this case, the evaluator's input will be `57u8` (an unsigned 8-bit integer with a value of 57).\n\n##### Running Tandem\n\nUse the following command to run the Tandem engine:\n\n```sh\ntandem_http_client tests/.add.garble.rs \\\n  --function main \\\n  --url http://localhost:8000/ \\\n  --input 110u8 \\\n  --metadata 57u8\n```\n\nOnce Tandem has finished computing, the result will be printed in your terminal:\n\n```sh\n167u8\n```\n\n(If for some reason this is not what you see, please repeat the steps above and make sure nothing is missing. If that does not work, please reach out.)\n\n## Contributions\n\nAll contributions and suggestions are welcomed! Please open issues for that effect.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsine-fdn%2Ftandem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsine-fdn%2Ftandem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsine-fdn%2Ftandem/lists"}