|
| 1 | +--- |
| 2 | +title: "Client" |
| 3 | +--- |
| 4 | + |
| 5 | +# Client CLI Deployment |
| 6 | + |
| 7 | +## Assumptions |
| 8 | +Below instructions assume that the servers have been installed on: |
| 9 | +- `192.168.0.100` (Coordination Server) |
| 10 | +- `192.168.0.101` (Computation Party Server 0) |
| 11 | +- `192.168.0.102` (Computation Party Server 1) |
| 12 | +- `192.168.0.103` (Computation Party Server 2) |
| 13 | + |
| 14 | +## Installation |
| 15 | +There are three ways to install the client CLI: |
| 16 | + |
| 17 | +### 1. Using Pre-Built Binaries |
| 18 | +This method relies on trusting pre-compiled binaries. It is the least secure but the simplest and fastest way to install the client. |
| 19 | + |
| 20 | +- Bandwidth requirement: Low |
| 21 | +- Downloads a shell script and two binaries (less than 50MB). |
| 22 | + |
| 23 | +Note: The binaries are built directly from the source code using public GitHub workflows, defined and available in this repository. This ensures participants can verify the process and confirm binary integrity. |
| 24 | + |
| 25 | + |
| 26 | +#### Steps |
| 27 | +1. Execute the following: |
| 28 | + ``` |
| 29 | + curl -L https://github.com/ZKStats/mpc-demo-infra/releases/latest/download/share-data.sh | bash -s -- <eth-address> <binance-api-key> <binance-api-secret> |
| 30 | + ``` |
| 31 | + |
| 32 | +### 2. Using Docker |
| 33 | +This method builds the client in an isolated environment using publicly available images, providing moderate security. |
| 34 | + |
| 35 | +- Bandwidth requirement: Very High |
| 36 | +- Downloads dependent Docker images (more than 6GB) and Docker itself if not already installed. |
| 37 | + |
| 38 | +Note: The Dockerfile used for building the client is included in this repository, ensuring transparency. |
| 39 | + |
| 40 | +#### Steps |
| 41 | +1. Install `Docker` by following the instructions [here](https://docs.docker.com/engine/install/). |
| 42 | + |
| 43 | +1. Execute the following: |
| 44 | + ``` |
| 45 | + git clone https://github.com/ZKStats/mpc-demo-infra.git |
| 46 | + cd mpc-demo-infra/mpc_demo_infra/client_cli/docker |
| 47 | + ./build.sh |
| 48 | + ./share-data.sh <eth-address> <binance-api-key> <binance-api-secret> |
| 49 | + ``` |
| 50 | + |
| 51 | +### 3. From Source Code |
| 52 | + |
| 53 | +This method involves building the client entirely from the source code, offering the most security through full transparency and control. |
| 54 | + |
| 55 | +- Bandwidth requirement: Moderate |
| 56 | +- Downloads one repository and dependencies for a Rust executable and a Python3 script. Additionally, it may require downloading Rust, Python3, and Poetry if not already installed. |
| 57 | + |
| 58 | +#### Steps |
| 59 | +1. Clone the `mpc-demo-infra` repository and cd to the repository root: |
| 60 | + ```bash |
| 61 | + git clone https://github.com/ZKStats/mpc-demo-infra.git |
| 62 | + cd mpc-demo-infra |
| 63 | + ``` |
| 64 | + |
| 65 | +2. Install Rust |
| 66 | + ``` |
| 67 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 68 | + ``` |
| 69 | + |
| 70 | +3. Install Binance Prover |
| 71 | + |
| 72 | + Ensure that you are at the repository root before proceeding. |
| 73 | + ``` |
| 74 | + cd tlsn/tlsn |
| 75 | + cargo build --release --example binance_prover |
| 76 | + ``` |
| 77 | + |
| 78 | +4. Install Python3 |
| 79 | + - Ubuntu 24.04 |
| 80 | + ``` |
| 81 | + apt-get update && apt-get install -y python3 python3-venv python3-pip curl pipx git automake build-essential clang cmake git libboost-dev libboost-iostreams-dev libboost-thread-dev libgmp-dev libntl-dev libsodium-dev libssl-dev libtool pkg-config libmpfr-dev libmpc-dev && apt-get clean |
| 82 | + ``` |
| 83 | + |
| 84 | + - MacOS (Intel/Apple Silicon) |
| 85 | + |
| 86 | + ``` |
| 87 | + brew install python |
| 88 | + ``` |
| 89 | + |
| 90 | +5. Install Poetry |
| 91 | + ``` |
| 92 | + python3 -m venv venv |
| 93 | + source venv/bin/activate |
| 94 | + venv/bin/pip install -U pip setuptools |
| 95 | + venv/bin/pip install poetry |
| 96 | + ``` |
| 97 | + |
| 98 | +6. Install the MPC demo infrastructure |
| 99 | + |
| 100 | + Ensure that you are at the repository root before proceeding. |
| 101 | + ``` |
| 102 | + poetry install |
| 103 | + ``` |
| 104 | + |
| 105 | +## Configuration |
| 106 | +1. Create a `.env.client_cli` file at the repository root with the following contents |
| 107 | + ``` |
| 108 | + COORDINATION_SERVER_URL=http://192.168.0.100:8005 |
| 109 | + PARTY_HOSTS=["192.168.0.101","192.168.0.102","192.168.0.103"] |
| 110 | + PARTY_PORTS=[8006,8007,8008] |
| 111 | + PARTY_WEB_PROTOCOL=http |
| 112 | + ``` |
| 113 | +2. If you intend to use HTTPS, also: |
| 114 | + 1. Set `PARTY_WEB_PROTOCOL=https` in the `.env.client_cli` file. |
| 115 | + 2. Rename the private key and certificate files of your domain as `privkey.pem` and `fullchain.pem` respectively and add them to `ssl_certs` directory at the repository root. |
| 116 | + |
| 117 | +3. Move `.env.client_cli` to the appropriate location based on your installation method: |
| 118 | + - Pre-built binaries: The directory where the binaries were downloaded |
| 119 | + - Docker: Under `./mpc_demo_infra/client_cli/docker/` directory |
| 120 | + - Source code: The repository root directory |
| 121 | + |
| 122 | +## Using Client CLI |
| 123 | +Client CLI provides two main functionalities: sharing data and querying computation. |
| 124 | + |
| 125 | +### Share Data |
| 126 | +You can anonymously share your ETH balance at Binance as follows: |
| 127 | + |
| 128 | +1. Get the Binance API key and secret, following the instructions in [Get Your Binance API Key](https://github.com/ZKStats/mpc-demo-infra/blob/main/mpc_demo_infra/client_cli/docker/README.md#step-1-get-your-binance-api-key) |
| 129 | + |
| 130 | +1. Get a voucher from the Coordination Server |
| 131 | + |
| 132 | +1. Share your ETH balance at Binance with the voucher: |
| 133 | + |
| 134 | + ```bash |
| 135 | + poetry run client-share-data <eth_address> <binance_api_key> <binance_api_secret> |
| 136 | + ``` |
| 137 | + |
| 138 | +### Query Computation |
| 139 | +You can retrieve statistical metrics such as mean, median, max, min, and Gini coefficient based on users’ historical ETH balance contributions with the following command: |
| 140 | + |
| 141 | +```bash |
| 142 | +poetry run client-query |
| 143 | +``` |
| 144 | + |
| 145 | +## Troubleshooting and Support |
| 146 | +If you encounter any issues during installation, feel free to open an issue in our [GitHub repository](https://github.com/ZKStats/mpc-demo-infra). |
| 147 | + |
0 commit comments