A pure Go implementation of the CGGMP21 Threshold Signature Scheme (TSS) protocol.
Note: This library is currently in active development (Alpha). Do not use in production environments without a thorough security audit.
This library implements the CGGMP21 protocol (Canetti-Gennaro-Goldfeder-Makriyannis-Peled), which allows a group of parties to generate a key and sign messages without ever reconstructing the private key in a single location.
secp256k1.go get github.com/smallyu/go-cggmp-tss
The core of the library is the StateMachine pattern. Here is a high-level view of how to integrate it:
import (
"github.com/smallyu/go-cggmp-tss/pkg/tss"
"github.com/smallyu/go-cggmp-tss/internal/protocol/keygen"
)
// 1. Initialize the State Machine
state, outMsgs, err := keygen.NewStateMachine(params)
// 2. Run the Event Loop
for {
// Receive message from your network layer
msg := network.Receive()
// Update the state machine
nextState, outMsgs, err := state.Update(msg)
if err != nil {
log.Fatal(err)
}
// Send output messages to other parties
network.Broadcast(outMsgs)
// Check for completion
if nextState == nil {
result := state.Result()
// Handle result (KeyShare or Signature)
break
}
state = nextState
}
For a complete step-by-step guide, please read the Usage Documentation.
The library is structured to separate cryptographic primitives from protocol logic:
pkg/tss: Core interfaces (PartyID, Message, StateMachine).internal/crypto: Cryptographic primitives (Paillier, ZK Proofs, Commitments).internal/protocol: Protocol implementations (keygen, sign).MIT