Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit 8420505

Browse files
authored
Merge pull request #20 from ZKStats/update-2
Update Client CLI doc
2 parents 72db203 + dbfd969 commit 8420505

File tree

2 files changed

+77
-75
lines changed

2 files changed

+77
-75
lines changed

docs/getting-started/deployment/client.md

Lines changed: 76 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,49 @@ title: "Client"
33
sidebar_position: 1
44
---
55

6-
# Client CLI Deployment
6+
# Client CLI
7+
Client CLI provides the following functionalities:
78

8-
## Assumptions
9-
Below instructions assume that the servers have been installed on:
10-
- `192.168.0.100` (Coordination Server)
11-
- `192.168.0.101` (Computation Party Server 0)
12-
- `192.168.0.102` (Computation Party Server 1)
13-
- `192.168.0.103` (Computation Party Server 2)
9+
- Sharing ETH Balance
10+
You can anonymously share your ETH balance at Binance as follows:
11+
12+
- Query Computation
13+
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:
14+
15+
## Configuration
16+
To configure the `Client CLI`, create a `.env.client_cli` file in the configuration directory.
17+
18+
### Default Configuration (Single-Server, Local HTTP)
19+
```
20+
COORDINATION_SERVER_URL=http://localhost:8005
21+
PARTY_HOSTS=["localhost", "localhost", "localhost"]
22+
PARTY_PORTS=[8006,8007,8008]
23+
PARTY_WEB_PROTOCOL=http
24+
```
25+
26+
- If using HTTPS
27+
1. Set PARTY_WEB_PROTOCOL=https and update COORDINATION_SERVER_URL to use https.
28+
1. 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.
29+
30+
- If using multiple servers, update both COORDINATION_SERVER_URL and PARTY_HOSTS with the appropriate IP addresses.
1431

1532
## Installation
1633
There are three ways to install the client CLI:
1734

18-
### 1. Using Pre-Built Binaries
19-
This method relies on trusting pre-compiled binaries. It is the least secure but the simplest and fastest way to install the client.
35+
### 1. Using Pre-Built Binary
36+
This method relies on trusting pre-compiled binary. It is the least secure but the simplest and fastest way to install the client.
2037

2138
- Bandwidth requirement: Low
2239
- Downloads a shell script and two binaries (less than 50MB).
2340

2441
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.
2542

26-
2743
#### Steps
28-
1. Execute the following:
44+
1. Download the script to fetch and execute appropriate binary
2945
```
30-
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>
46+
curl -L -o share-data.sh https://github.com/ZKStats/mpc-demo-infra/releases/latest/download/share-data.sh
3147
```
48+
1. Follow the instructions in Client CLI Configuration to create an appropriate `.env.client_cli` file in the current directory.
3249

3350
### 2. Using Docker
3451
This method builds the client in an isolated environment using publicly available images, providing moderate security.
@@ -41,11 +58,22 @@ Note: The Dockerfile used for building the client is included in this repository
4158
#### Steps
4259
1. Install `Docker` by following the instructions [here](https://docs.docker.com/engine/install/).
4360

44-
1. Execute the following:
45-
```
61+
1. Clone the repository and cd to the repository root:
62+
```bash
4663
git clone https://github.com/ZKStats/mpc-demo-infra.git
64+
cd mpc-demo-infra
65+
```
66+
67+
1. Follow the instructions in Client CLI Configuration to create a `.env.client_cli` in `./mpc_demo_infra/client_cli/docker/` directory
68+
69+
1. Build Docker image
70+
```
4771
cd mpc-demo-infra/mpc_demo_infra/client_cli/docker
4872
./build.sh
73+
```
74+
75+
1. Execute `Client CLI`:
76+
```
4977
./share-data.sh <eth-address> <binance-api-key> <binance-api-secret>
5078
```
5179

@@ -57,88 +85,62 @@ This method involves building the client entirely from the source code, offering
5785
- 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.
5886

5987
#### Steps
60-
1. Clone the `mpc-demo-infra` repository and cd to the repository root:
88+
1. Clone the repository and cd to the repository root:
6189
```bash
6290
git clone https://github.com/ZKStats/mpc-demo-infra.git
6391
cd mpc-demo-infra
6492
```
6593

66-
2. Install Rust
67-
```
68-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
69-
```
70-
71-
3. Install Binance Prover
72-
73-
Make sure you are in the repository root before proceeding.
74-
```
75-
cd tlsn/tlsn
76-
cargo build --release --example binance_prover
77-
```
94+
1. Set up the environment:
7895

79-
4. Install Python3
80-
- Ubuntu 24.04
81-
```
82-
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
96+
```bash
97+
./setup_env.sh --client
8398
```
8499

85-
- MacOS (Intel/Apple Silicon)
100+
1. Follow the instructions in Client CLI Configuration to create a `.env.client_cli` in the repository root directory
86101

87-
```
88-
brew install python
89-
```
90-
91-
5. Install Poetry
92-
```
93-
python3 -m venv venv
94-
source venv/bin/activate
95-
venv/bin/pip install -U pip setuptools
96-
venv/bin/pip install poetry
97-
```
102+
1. Execute `Client CLI`:
103+
```bash
104+
poetry run client-share-data <eth-address> <binance-api-key> <binance-api-secret>
105+
```
98106

99-
6. Install the MPC demo infrastructure
107+
## Execution
100108

101-
Make sure that you are at the repository root before proceeding.
102-
```
103-
poetry install
104-
```
109+
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)
105110

106-
## Configuration
107-
1. Create a `.env.client_cli` file at the repository root with the following contents:
108-
```
109-
COORDINATION_SERVER_URL=http://192.168.0.100:8005
110-
PARTY_HOSTS=["192.168.0.101","192.168.0.102","192.168.0.103"]
111-
PARTY_PORTS=[8006,8007,8008]
112-
PARTY_WEB_PROTOCOL=http
111+
1. Get a voucher from the Coordination Server
112+
```bash
113+
poetry run get-api-key
113114
```
114-
2. If you intend to use HTTPS, also:
115-
1. Set `PARTY_WEB_PROTOCOL=https` in the `.env.client_cli` file.
116-
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.
117115

118-
3. Move `.env.client_cli` to the appropriate location based on your installation method:
119-
- Pre-built binaries: The directory where the binaries were downloaded
120-
- Docker: Under `./mpc_demo_infra/client_cli/docker/` directory
121-
- Source code: The repository root directory
116+
### Sharing ETH Balance
117+
1. Share your ETH balance at Binance with the voucher:
122118

123-
## Using Client CLI
124-
Client CLI provides two main functionalities: sharing data and querying computation.
119+
- Using Pre-Built Binary
120+
```
121+
chmod +x share-data.sh
122+
./share-data.sh <eth-address> <binance-api-key> <binance-api-secret>
123+
```
125124
126-
### Share Data
127-
You can anonymously share your ETH balance at Binance as follows:
125+
- Using Docker
126+
Make sure that you are at the repository root before proceeding.
128127
129-
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)
128+
```
129+
cd ./mpc_demo_infra/client_cli/docker/
130+
./share-data.sh <eth-address> <binance-api-key> <binance-api-secret>
131+
```
130132
131-
1. Get a voucher from the Coordination Server
133+
- Using Source Code
132134
133-
1. Share your ETH balance at Binance with the voucher:
134-
135-
```bash
136-
poetry run client-share-data <eth_address> <binance_api_key> <binance_api_secret>
137-
```
135+
Make sure that you are at the repository root before proceeding.
136+
```bash
137+
poetry run client-share-data <eth_address> <binance_api_key> <binance_api_secret>
138+
```
138139
139140
### Query Computation
140-
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:
141+
Make sure that you are at the repository root before proceeding.
141142
142143
```bash
143144
poetry run client-query
144145
```
146+

docs/getting-started/deployment/servers/remote/manually.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Follow the steps below on each server before deploying:
2424
```
2525

2626
## `setup_env.sh` Options
27-
The `setup_env.sh` script can take multiple options to set up the environment for running multiple servers. For example, if you intend to run `Coordination Server`, `Data Compumer API Server` and `Notary Server` on one server, you can execute the following:
27+
The `setup_env.sh` script can take multiple options to set up an environment for running multiple servers. For example, if you intend to run `Coordination Server`, `Data Compumer API Server` and `Notary Server` on one server, you can execute the following:
2828
```
2929
./setup_env.sh --coord --consumer --notary
3030
```

0 commit comments

Comments
 (0)