@@ -41,232 +41,13 @@ go install ./cmd/mpcium-cli
4141
4242---
4343
44- ## Running NATS and Consul (Development Only)
45-
46- > ⚠️ This setup is insecure and should only be used for development. For production, use a secure cluster environment with TLS certificates.
47-
48- ### Docker Compose Configuration
49-
50- Create a ` docker-compose.yaml ` file:
51-
52- ``` yaml
53- version : " 3"
54-
55- services :
56- nats-server :
57- image : nats:latest
58- container_name : nats-server
59- command : -js --http_port 8222
60- ports :
61- - " 4222:4222"
62- - " 8222:8222"
63- - " 6222:6222"
64- tty : true
65- restart : always
66-
67- consul :
68- image : consul:1.15.4
69- container_name : consul
70- ports :
71- - " 8500:8500"
72- - " 8601:8600/udp"
73- command : " agent -server -ui -node=server-1 -bootstrap-expect=1 -client=0.0.0.0"
74- restart : always
75- ` ` `
76-
77- ### Start the Services
78-
79- ` ` ` bash
80- docker compose up -d
81- ```
82-
83- ---
84-
85- ## Generate Peer Configuration
86-
87- ``` bash
88- mpcium-cli generate-peers -n 3
89- ```
90-
91- Example output:
92-
93- ``` json
94- {
95- "node0" : " 12345678-1234-1234-1234-123456789abc" ,
96- "node1" : " 23456789-2345-2345-2345-23456789abcd" ,
97- "node2" : " 34567890-3456-3456-3456-3456789abcde"
98- }
99- ```
100-
101- ---
102-
103- ## Cluster Configuration
104-
105- ### 1. Create and Update ` config.yaml `
106-
107- ``` bash
108- cp config.yaml.template config.yaml
109- ```
110-
111- Edit ` config.yaml ` :
112-
113- ``` yaml
114- nats :
115- url : nats://127.0.0.1:4222
116- consul :
117- address : localhost:8500
118-
119- mpc_threshold : 2
120- environment : development
121- badger_password : " your_badger_password"
122- event_initiator_pubkey : " your_event_initiator_pubkey"
123- ` ` `
124-
125- ### Generate a Strong Password (Recommended)
126-
127- ` ` ` bash
128- < /dev/urandom tr -dc 'A-Za-z0-9!@#$^&*()-_=+[]{}|;:,.<>?/~' | head -c 16; echo
129- ```
130-
131- Example:
132-
133- ``` yaml
134- badger_password : " F))ysJp?E]ol&I;^"
135- ` ` `
136-
137- ### 2. Register Peers to Consul
138-
139- ` ` ` bash
140- mpcium-cli register-peers
141- ```
142-
143- ---
144-
145- ## Event Initiator Setup
146-
147- ### Generate the Initiator
148-
149- ``` bash
150- mpcium-cli generate-initiator
151- ```
152-
153- > 💡 Use ` --encrypt ` in production.
154-
155- ### Add Public Key to ` config.yaml `
156-
157- From ` event_initiator.identity.json ` :
158-
159- ``` json
160- {
161- "public_key" : " 09be5d070816aadaa1b6638cad33e819a8aed7101626f6bf1e0b427412c3408a"
162- }
163- ```
164-
165- Update ` config.yaml ` :
166-
167- ``` yaml
168- event_initiator_pubkey : " 09be5d070816aadaa1b6638cad33e819a8aed7101626f6bf1e0b427412c3408a"
169- ` ` `
170-
171- ---
172-
173- ## Configure Node Identities
174-
175- ### 1. Create Node Folders
176-
177- ` ` ` bash
178- mkdir node{0..2}
179- for dir in node{0..2}; do
180- cp config.yaml peers.json "$dir/"
181- mkdir -p "$dir/identity"
182- done
183- ```
184-
185- ### 2. Generate Identity for Each Node
186-
187- Example for ` node0 ` :
188-
189- ``` bash
190- cd node0
191- mpcium-cli generate-identity --node node0
192- ```
193-
194- > 💡 For production, use encryption:
195- >
196- > ``` bash
197- > mpcium-cli generate-identity --node node0 --encrypt
198- > ` ` `
199-
200- # ## Generate Strong Password for Encryption
201-
202- ` ` ` bash
203- < /dev/urandom tr -dc ' A-Za-z0-9!@#$^&*()-_=+[]{}|;:,.<>?/~' | head -c 16; echo
204- ```
205-
206- ### 3. Distribute Identity Files to All Nodes
207-
208- ``` bash
209- cp identity/node0_identity.json ../node1/identity/node0_identity.json
210- cp identity/node0_identity.json ../node2/identity/node0_identity.json
211- ```
212-
213- Repeat this for ` node1 ` and ` node2 ` .
214-
215- ### Folder Structure Example
216-
217- ```
218- ├── node0
219- │ ├── config.yaml
220- │ ├── identity
221- │ │ ├── node0_identity.json
222- │ │ ├── node0_private.key
223- │ │ ├── node1_identity.json
224- │ │ └── node2_identity.json
225- │ └── peers.json
226- ├── node1
227- │ ├── config.yaml
228- │ ├── identity
229- │ │ ├── node0_identity.json
230- │ │ ├── node1_identity.json
231- │ │ ├── node1_private.key
232- │ │ └── node2_identity.json
233- │ └── peers.json
234- ├── node2
235- │ ├── config.yaml
236- │ ├── identity
237- │ │ ├── node0_identity.json
238- │ │ ├── node1_identity.json
239- │ │ ├── node2_identity.json
240- │ │ └── node2_private.key
241- │ └── peers.json
242- ```
243-
244- ---
245-
246- ## Start Mpcium Nodes
247-
248- Start each node:
249-
250- ``` bash
251- cd node0
252- mpcium start -n node0
253- ```
254-
255- ``` bash
256- cd node1
257- mpcium start -n node1
258- ```
44+ ### Set everything up in one go
25945
26046``` bash
261- cd node2
262- mpcium start -n node2
47+ . setup.sh
26348```
26449
265- > 💡 In production, avoid hardcoded passwords:
266- >
267- > ``` bash
268- > mpcium start -n node0 --prompt-credentials
269- > ` ` `
50+ Detailed steps can be found in [ SETUP.md] ( SETUP.md ) .
27051
27152---
27253
0 commit comments