Skip to content

Commit b408230

Browse files
committed
Update readme example
1 parent f87b0d2 commit b408230

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ $ mpcium start -n node2
166166

167167
Mpcium supports flexible client authentication through a signer interface, allowing you to use either local keys or AWS KMS for signing operations.
168168

169+
#### Client ID (Result Routing)
170+
171+
When multiple client instances connect to the same MPC cluster, each client **must** set a unique `ClientID` to avoid result routing conflicts. Without distinct client IDs, two clients requesting operations concurrently may race for the same result message, causing one client to receive the other's response.
172+
173+
- `ClientID` scopes the NATS consumer and result subject so each client only receives its own results.
174+
- Allowed characters: alphanumeric, hyphens, and underscores (e.g. `"backend-svc-1"`, `"mobile_api"`).
175+
- If you only run a single client instance, `ClientID` can be omitted (empty string).
176+
169177
#### Local Signer (Ed25519)
170178

171179
```go
@@ -193,10 +201,11 @@ func main() {
193201
logger.Fatal("Failed to create local signer", err)
194202
}
195203

196-
// Create MPC client with signer
204+
// Create MPC client with signer and a unique client ID
197205
mpcClient := client.NewMPCClient(client.Options{
198206
NatsConn: natsConn,
199207
Signer: localSigner,
208+
ClientID: "backend-svc-1", // unique per client instance
200209
})
201210

202211
// Handle wallet creation results
@@ -253,6 +262,7 @@ func main() {
253262
mpcClient := client.NewMPCClient(client.Options{
254263
NatsConn: natsConn,
255264
Signer: kmsSigner,
265+
ClientID: "kms-client-1", // unique per client instance
256266
})
257267
// ... rest of the client code
258268
}

0 commit comments

Comments
 (0)