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

Commit 13725f2

Browse files
authored
Merge pull request #6 from ZKStats/fix-3
Add client cli doc
2 parents 1ab4012 + 234b9a3 commit 13725f2

File tree

9 files changed

+174
-2
lines changed

9 files changed

+174
-2
lines changed

docs/getting-started/deployment/_category_.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"label": "Depolying the Infrastructure",
2+
"label": "Deploying the Infrastructure",
33
"link": {
44
"type": "generated-index"
55
}
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
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+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"label": "Servers",
3+
"link": {
4+
"type": "generated-index"
5+
}
6+
}
7+

docs/getting-started/deployment/local/_category_.json renamed to docs/getting-started/deployment/servers/local/_category_.json

File renamed without changes.
File renamed without changes.

docs/getting-started/deployment/local/using_docker.md renamed to docs/getting-started/deployment/servers/local/using_docker.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,12 @@ sidebar_position: 1
1515
docker-compose up --build
1616
```
1717

18+
## Troubleshooting
19+
If you encounter any issues, try running the following commands to clean up your Docker environment:
20+
21+
```bash
22+
docker system prune -a --volumes
23+
docker rm -f $(docker ps -aq)
24+
docker volume prune -a -f
25+
docker image prune -f
26+
```

docs/getting-started/deployment/remote/_category_.json renamed to docs/getting-started/deployment/servers/remote/_category_.json

File renamed without changes.

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

File renamed without changes.

docs/getting-started/deployment/remote/using_docker.md renamed to docs/getting-started/deployment/servers/remote/using_docker.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Ensure that you are at the repository root before proceeding.
7171
docker run --init -it -v party-data:/root/MP-SPDZ/ -p 8000-8100:8000-8100 -e PARTY_ID=${PARTY_ID} party
7272
```
7373

74-
## Deploying the Data Consumer API Servers
74+
## Deploying the Data Consumer API Server
7575
Ensure that you are at the repository root before proceeding.
7676

7777
1. Change the `PARTY_HOSTS` in `mpc_demo_infra/coordination_server/docker/.env.coord` to:
@@ -103,3 +103,12 @@ docker build --build-arg NOTARY_IP=%NOTARY_IP% -t notary -f ./mpc_demo_infra/not
103103
docker run --init -it -p 8003:8003 notary
104104
```
105105

106+
## Troubleshooting
107+
If you encounter any issues, try running the following commands to clean up your Docker environment:
108+
109+
```bash
110+
docker system prune -a --volumes
111+
docker rm -f $(docker ps -aq)
112+
docker volume prune -a -f
113+
docker image prune -f
114+
```

0 commit comments

Comments
 (0)