Files
mpc/scripts/setup_initiator.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

42 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
echo "🚀 Setting up Event Initiator..."
# Generate the event initiator
echo "📝 Generating event initiator..."
lux-mpc-cli generate-initiator
# Extract the public key from the generated file
if [ -f "event_initiator.identity.json" ]; then
PUBLIC_KEY=$(grep -o '"public_key": *"[^"]*"' event_initiator.identity.json | cut -d'"' -f4)
if [ -n "$PUBLIC_KEY" ]; then
echo "🔑 Found public key: $PUBLIC_KEY"
# Update config.yaml
if [ -f "config.yaml" ]; then
echo "📝 Updating config.yaml..."
# Check if event_initiator_pubkey already exists
if grep -q "event_initiator_pubkey:" config.yaml; then
# Replace existing line
sed -i "s/event_initiator_pubkey: .*/event_initiator_pubkey: \"$PUBLIC_KEY\"/" config.yaml
else
# Add new line
echo "event_initiator_pubkey: \"$PUBLIC_KEY\"" >> config.yaml
fi
echo "✅ Successfully updated config.yaml"
else
echo "❌ Error: config.yaml not found. Please create it first."
exit 1
fi
else
echo "❌ Error: Could not extract public key from event_initiator.identity.json"
exit 1
fi
else
echo "❌ Error: event_initiator.identity.json not found"
exit 1
fi
echo "✨ Event Initiator setup complete!"