Files
mpc/scripts/setup_identities.sh
zeekay 19b49809fd Implement threshold MPC signing with CGGMP21, FROST, and LSS protocols
This commit adds complete multi-party computation (MPC) threshold signing
for multiple cryptographic protocols:

CGGMP21 (ECDSA/secp256k1):
- Key generation for Bitcoin/Ethereum/EVM chains
- Threshold signing with t-of-n security
- Recovery byte calculation for Ethereum compatibility

FROST/Taproot (EdDSA/BIP-340):
- EdDSA key generation for Solana/Sui/Polkadot
- BIP-340 compatible Schnorr signatures (64 bytes)
- CBOR serialization for TaprootConfig crypto types

LSS (Linear Secret Sharing):
- Dynamic resharing support (change participants)
- ECDSA signing with blinding protocol
- Protocol adapter for unified interface

Key fixes:
- Use MarshalBinary/UnmarshalBinary for protocol messages
- CBOR serialization for FROST TaprootConfig (not JSON)
- Correct type assertion for taproot.Signature ([]byte)
- Sorted party IDs for deterministic ordering

E2E tests pass for both ECDSA and EdDSA signing.
2026-01-24 23:41:43 -08:00

60 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# Number of nodes to create (default is 3)
NUM_NODES=3
echo "🚀 Setting up Node Identities..."
# Create node directories and copy config files
echo "📁 Creating node directories..."
for i in $(seq 0 $((NUM_NODES-1))); do
mkdir -p "node$i/identity"
if [ ! -f "node$i/config.yaml" ]; then
cp config.yaml "node$i/"
fi
if [ ! -f "node$i/peers.json" ]; then
cp peers.json "node$i/"
fi
done
# Generate identity for each node
echo "🔑 Generating identities for each node..."
for i in $(seq 0 $((NUM_NODES-1))); do
echo "📝 Generating identity for node$i..."
cd "node$i"
lux-mpc-cli generate-identity --node "node$i"
cd ..
done
# Distribute identity files to all nodes
echo "🔄 Distributing identity files across nodes..."
for i in $(seq 0 $((NUM_NODES-1))); do
for j in $(seq 0 $((NUM_NODES-1))); do
if [ $i != $j ]; then
echo "📋 Copying node${i}_identity.json to node$j..."
cp "node$i/identity/node${i}_identity.json" "node$j/identity/"
fi
done
done
echo "✨ Node identities setup complete!"
echo
echo "📂 Created folder structure:"
echo "├── node0"
echo "│ ├── config.yaml"
echo "│ ├── identity/"
echo "│ └── peers.json"
echo "├── node1"
echo "│ ├── config.yaml"
echo "│ ├── identity/"
echo "│ └── peers.json"
echo "└── node2"
echo " ├── config.yaml"
echo " ├── identity/"
echo " └── peers.json"
echo
echo "✅ You can now start your nodes with:"
echo "cd node0 && lux-mpc start -n node0"
echo "cd node1 && lux-mpc start -n node1"
echo "cd node2 && lux-mpc start -n node2"