Before starting, ensure you have:
- Go 1.25.0+ installed: Install Go here
- NATS server running
- Consul server running
git clone https://github.com/fystack/mpcium.git
cd mpciumWith Make:
makeOr with Go:
go install ./cmd/mpcium
go install ./cmd/mpcium-climpcium: Start an MPCium nodempcium-cli: CLI utility for peer, identity, and initiator configuration
For detailed step-by-step instructions, see SETUP.md.
First, generate the peers configuration file:
mpcium-cli generate-peers -n 3This creates a peers.json file with 3 peer nodes (node0, node1, node2). Adjust -n for a different number of nodes.
./setup_initiator.shThis generates the event initiator identity used to authorize MPC operations.
./setup_identities.shThis script:
- Creates node directories (node0, node1, node2)
- Generates identities for each node
- Distributes identity files across nodes
- Configures chain_code for all nodes
Note: This script requires peers.json to exist. If you see an error about missing peers.json, run step 1 first.
The chain_code is a cryptographic parameter used for Hierarchical Deterministic (HD) wallet functionality. It enables mpcium to derive child keys from a parent key, allowing you to generate multiple wallet addresses from a single master key.
Important Requirements:
- All nodes in your MPC cluster MUST use the identical chain_code value
- Must be a 32-byte value represented as a 64-character hexadecimal string
- Should be generated once and stored securely
- Without a valid chain_code, mpcium nodes will fail to start
Generate one 32-byte hex chain code and set it in all node configurations:
# Navigate to your mpcium directory
cd /path/to/mpcium
# Generate a random 32-byte chain code and save it
CC=$(openssl rand -hex 32) && echo "$CC" > .chain_code
# Apply to main config
sed -i -E "s|^([[:space:]]*chain_code:).*|\1 \"$CC\"|" config.yaml
# Apply to all node configs
for n in node0 node1 node2; do
sed -i -E "s|^([[:space:]]*chain_code:).*|\1 \"$CC\"|" "$n/config.yaml"
done
# Verify it was set correctly
echo "Chain code configured: $CC"Example config.yaml entry:
chain_code: "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2"Start nodes normally:
cd node0 && mpcium start -n node0Repeat for node1 and node2. The value must be exactly 64 hex chars (32 bytes).
- Use production-grade NATS and Consul clusters.
- Enable TLS certificates on all endpoints.
- Encrypt all keys:
mpcium-cli generate-initiator --encrypt mpcium-cli generate-identity --node node0 --encrypt
- Use
--prompt-credentialsto securely input Badger passwords (avoid hardcoding inconfig.yaml).
age --decrypt -o event_initiator.key event_initiator.key.age
