Documentation
¶
Overview ¶
Package lss implements the actual LSS dynamic resharing protocol as described in the paper "LSS MPC ECDSA: A Pragmatic Framework for Dynamic and Resilient Threshold Signatures" by Vishnu J. Seesahai
Package lss - Unified LSS factory for all blockchains ¶
Package lss implements the LSS MPC ECDSA protocol.
Based on the paper: "LSS MPC ECDSA: A Pragmatic Framework for Dynamic and Resilient Threshold Signatures" by Vishnu J. Seesahai
This implementation provides: - Dynamic resharing without reconstructing the master key - Resilient threshold signatures with fault tolerance - Support for adding/removing parties without downtime - Rollback capability for failed signing attempts
Package lss provides dynamic resharing extensions for CMP and FROST protocols.
Package lss provides dynamic resharing extensions for FROST protocols.
Package lss provides a unified suite for threshold signature protocols.
Index ¶
- func ConvertFromLSSConfig(lssConfig *Config) *keygen.Config
- func DynamicReshareCMP(oldConfigs map[party.ID]*config.Config, newPartyIDs []party.ID, ...) (map[party.ID]*config.Config, error)
- func DynamicReshareFROST(oldConfigs map[party.ID]*keygen.Config, newPartyIDs []party.ID, ...) (map[party.ID]*keygen.Config, error)
- func EmptyConfig(group curve.Curve) *config.Config
- func EvictAndRollback(cfg *config.Config, evictedParties []party.ID) (*config.Config, error)
- func IsCompatibleForSigning(c1, c2 *config.Config) bool
- func IsEVMChain(chain Chain) bool
- func IsEdDSAChain(chain Chain) bool
- func Keygen(group curve.Curve, selfID party.ID, participants []party.ID, threshold int, ...) protocol.StartFunc
- func Refresh(c *config.Config, pl *pool.Pool) protocol.StartFunc
- func Reshare(c *config.Config, newParticipants []party.ID, newThreshold int, pl *pool.Pool) protocol.StartFunc
- func Rollback(cfg *config.Config, targetGeneration uint64) (*config.Config, error)
- func RollbackOnFailure(cfg *config.Config, failureThreshold int) (*config.Config, error)
- func RunKeygen(t *testing.T, group curve.Curve, partyIDs []party.ID, threshold int) map[party.ID]*config.Config
- func RunProtocols(t *testing.T, protocols map[party.ID]protocol.StartFunc, sessionID []byte) (map[party.ID]interface{}, error)
- func RunReshare(t *testing.T, oldConfigs map[party.ID]*config.Config, newPartyIDs []party.ID, ...) map[party.ID]*config.Config
- func RunSign(t *testing.T, configs map[party.ID]*config.Config, signers []party.ID, ...) *ecdsa.Signature
- func Sign(c *config.Config, signers []party.ID, messageHash []byte, pl *pool.Pool) protocol.StartFunc
- func SignWithBlinding(c *config.Config, signers []party.ID, messageHash []byte, ...) protocol.StartFunc
- func VerifyConfig(c *config.Config) error
- func VerifySignature(sig *ecdsa.Signature, publicKey curve.Point, messageHash []byte) bool
- func WrapConfig(result interface{}) protocol.ThresholdConfig
- type BlindingProtocol
- type CMP
- type Chain
- type ChainInfo
- type ChainType
- type Config
- type ConfigAdapter
- func (c *ConfigAdapter) GetChainKey() []byte
- func (c *ConfigAdapter) GetGroup() curve.Curve
- func (c *ConfigAdapter) GetID() party.ID
- func (c *ConfigAdapter) GetPrivateShare() curve.Scalar
- func (c *ConfigAdapter) GetPublicKey() (curve.Point, error)
- func (c *ConfigAdapter) GetPublicShare(id party.ID) (curve.Point, error)
- func (c *ConfigAdapter) GetRID() []byte
- func (c *ConfigAdapter) GetThreshold() int
- func (c *ConfigAdapter) IsCompatible(other protocol.ThresholdConfig) bool
- func (c *ConfigAdapter) Validate() error
- type DynamicLSS
- type FROST
- type FROSTConfig
- type Factory
- type FactoryConfig
- type GenerationSnapshot
- type LSS
- type ReshareMessage
- type ReshareMessageType
- type RollbackManager
- func (rm *RollbackManager) ClearHistory()
- func (rm *RollbackManager) EvictParties(cfg *config.Config, evictedParties []party.ID) (*config.Config, error)
- func (rm *RollbackManager) GetHistory() []*GenerationSnapshot
- func (rm *RollbackManager) Rollback(targetGeneration uint64) (*config.Config, error)
- func (rm *RollbackManager) RollbackOnFailure(failureThreshold int) (*config.Config, error)
- func (rm *RollbackManager) SaveSnapshot(cfg *config.Config) error
- type SigningProtocol
- type Suite
- func (s *Suite) Keygen(group curve.Curve, selfID party.ID, participants []party.ID, threshold int) protocol.StartFunc
- func (s *Suite) Refresh(config protocol.ThresholdConfig) protocol.StartFunc
- func (s *Suite) Sign(config protocol.ThresholdConfig, signers []party.ID, message []byte) protocol.StartFunc
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertFromLSSConfig ¶
ConvertFromLSSConfig converts an LSS config to FROST config format
func DynamicReshareCMP ¶
func DynamicReshareCMP( oldConfigs map[party.ID]*config.Config, newPartyIDs []party.ID, newThreshold int, _ *pool.Pool, ) (map[party.ID]*config.Config, error)
DynamicReshare performs the LSS dynamic resharing protocol on CMP configurations. This implements the protocol from Section 4 of the LSS paper, allowing transition from T-of-N to T'-of-(N±k) without reconstructing the master key.
func DynamicReshareFROST ¶
func DynamicReshareFROST( oldConfigs map[party.ID]*keygen.Config, newPartyIDs []party.ID, newThreshold int, _ *pool.Pool, ) (map[party.ID]*keygen.Config, error)
DynamicReshareFROST performs the LSS dynamic resharing protocol on FROST configurations. This implements the protocol from Section 4 of the LSS paper, allowing transition from T-of-N to T'-of-(N±k) without reconstructing the master key.
func EmptyConfig ¶
EmptyConfig creates an empty Config with a fixed group, ready for unmarshalling.
func EvictAndRollback ¶
EvictAndRollback evicts problematic parties and rolls back if needed
func IsCompatibleForSigning ¶
IsCompatibleForSigning checks if two configs can sign together.
func IsEVMChain ¶ added in v1.1.0
IsEVMChain returns true if the chain is EVM-compatible
func IsEdDSAChain ¶ added in v1.1.0
IsEdDSAChain returns true if the chain uses Ed25519
func Keygen ¶
func Keygen(group curve.Curve, selfID party.ID, participants []party.ID, threshold int, pl *pool.Pool) protocol.StartFunc
Keygen generates a new shared ECDSA key with LSS protocol.
func Reshare ¶
func Reshare(c *config.Config, newParticipants []party.ID, newThreshold int, pl *pool.Pool) protocol.StartFunc
Reshare performs dynamic resharing to change the participant set.
func RollbackOnFailure ¶
RollbackOnFailure triggers automatic rollback after repeated failures
func RunKeygen ¶
func RunKeygen(t *testing.T, group curve.Curve, partyIDs []party.ID, threshold int) map[party.ID]*config.Config
RunKeygen runs a complete keygen protocol for testing
func RunProtocols ¶
func RunProtocols(t *testing.T, protocols map[party.ID]protocol.StartFunc, sessionID []byte) (map[party.ID]interface{}, error)
RunProtocols executes protocol instances and collects results
func RunReshare ¶
func RunReshare(t *testing.T, oldConfigs map[party.ID]*config.Config, newPartyIDs []party.ID, newThreshold int) map[party.ID]*config.Config
RunReshare performs a resharing operation for testing
func RunSign ¶
func RunSign(t *testing.T, configs map[party.ID]*config.Config, signers []party.ID, messageHash []byte) *ecdsa.Signature
RunSign executes a signing protocol for testing
func Sign ¶
func Sign(c *config.Config, signers []party.ID, messageHash []byte, pl *pool.Pool) protocol.StartFunc
Sign generates an ECDSA signature using the LSS protocol.
func SignWithBlinding ¶
func SignWithBlinding(c *config.Config, signers []party.ID, messageHash []byte, protocol BlindingProtocol, pl *pool.Pool) protocol.StartFunc
SignWithBlinding performs threshold signing with multiplicative blinding This provides enhanced privacy by hiding individual shares during signing
func VerifyConfig ¶
VerifyConfig validates that a Config is well-formed.
func VerifySignature ¶
VerifySignature checks if a signature is valid
func WrapConfig ¶ added in v1.0.1
func WrapConfig(result interface{}) protocol.ThresholdConfig
WrapConfig converts protocol-specific configs to ThresholdConfig
Types ¶
type BlindingProtocol ¶
type BlindingProtocol int
BlindingProtocol represents the blinding protocol version
const ( // BlindingProtocolI is the basic multiplicative blinding BlindingProtocolI BlindingProtocol = iota // BlindingProtocolII is enhanced blinding with additional security BlindingProtocolII )
type CMP ¶
type CMP struct {
// contains filtered or unexported fields
}
CMP extends the CMP protocol with LSS dynamic resharing capabilities. This allows CMP to perform membership changes without reconstructing the master key.
func (*CMP) GetGeneration ¶
GetGeneration returns the current resharing generation number
func (*CMP) UpdateConfig ¶
UpdateConfig updates the configuration after a successful resharing
type Chain ¶ added in v1.1.0
type Chain string
Chain represents a supported blockchain
const ( // Layer 1 Blockchains Bitcoin Chain = "bitcoin" Ethereum Chain = "ethereum" BNBChain Chain = "bnb" Solana Chain = "solana" Cardano Chain = "cardano" Lux Chain = "lux" Polygon Chain = "polygon" TRON Chain = "tron" TON Chain = "ton" Sui Chain = "sui" Aptos Chain = "aptos" Near Chain = "near" Cosmos Chain = "cosmos" Algorand Chain = "algorand" Stellar Chain = "stellar" Hedera Chain = "hedera" Flow Chain = "flow" Tezos Chain = "tezos" EOS Chain = "eos" XRPL Chain = "xrpl" Polkadot Chain = "polkadot" Kusama Chain = "kusama" // Layer 2 & Sidechains Arbitrum Chain = "arbitrum" Optimism Chain = "optimism" Base Chain = "base" Scroll Chain = "scroll" Linea Chain = "linea" Mantle Chain = "mantle" Metis Chain = "metis" // EVM Compatible Chains BSC Chain = "bsc" Celo Chain = "celo" Fantom Chain = "fantom" Cronos Chain = "cronos" Harmony Chain = "harmony" Moonbeam Chain = "moonbeam" Aurora Chain = "aurora" Gnosis Chain = "gnosis" Kava Chain = "kava" Klaytn Chain = "klaytn" // Specialized Chains Monero Chain = "monero" Dash Chain = "dash" Zcash Chain = "zcash" // Post-Quantum Ringtail Chain = "ringtail" )
All supported blockchains (top 100+ by market cap and usage)
func SupportedChains ¶ added in v1.1.0
func SupportedChains() []Chain
SupportedChains returns all supported blockchains
type ChainInfo ¶ added in v1.1.0
type ChainInfo struct {
Name string
Type ChainType
SignatureType adapters.SignatureType
Curve string
ChainID interface{} // Can be number or string
TestnetID interface{}
Symbol string
Decimals int
}
ChainInfo contains information about a blockchain
func GetChainInfo ¶ added in v1.1.0
GetChainInfo returns information about a blockchain
type Config ¶
Config represents the configuration for the LSS protocol. This is an alias to the config.Config type for backward compatibility.
type ConfigAdapter ¶ added in v1.0.1
ConfigAdapter wraps any config to implement ThresholdConfig
func (*ConfigAdapter) GetChainKey ¶ added in v1.0.1
func (c *ConfigAdapter) GetChainKey() []byte
GetChainKey returns the chain key
func (*ConfigAdapter) GetGroup ¶ added in v1.0.1
func (c *ConfigAdapter) GetGroup() curve.Curve
GetGroup returns the curve group
func (*ConfigAdapter) GetID ¶ added in v1.0.1
func (c *ConfigAdapter) GetID() party.ID
GetID returns the party ID
func (*ConfigAdapter) GetPrivateShare ¶ added in v1.0.1
func (c *ConfigAdapter) GetPrivateShare() curve.Scalar
GetPrivateShare returns the private share
func (*ConfigAdapter) GetPublicKey ¶ added in v1.0.1
func (c *ConfigAdapter) GetPublicKey() (curve.Point, error)
GetPublicKey returns the public key
func (*ConfigAdapter) GetPublicShare ¶ added in v1.0.1
GetPublicShare returns a party's public share
func (*ConfigAdapter) GetRID ¶ added in v1.0.1
func (c *ConfigAdapter) GetRID() []byte
GetRID returns the RID
func (*ConfigAdapter) GetThreshold ¶ added in v1.0.1
func (c *ConfigAdapter) GetThreshold() int
GetThreshold returns the threshold
func (*ConfigAdapter) IsCompatible ¶ added in v1.0.1
func (c *ConfigAdapter) IsCompatible(other protocol.ThresholdConfig) bool
IsCompatible checks compatibility with another config
func (*ConfigAdapter) Validate ¶ added in v1.0.1
func (c *ConfigAdapter) Validate() error
Validate validates the config
type DynamicLSS ¶ added in v1.0.1
type DynamicLSS struct {
// contains filtered or unexported fields
}
DynamicLSS implements the actual LSS protocol with live resharing This is the REAL implementation of Section 4 of the LSS paper
func NewDynamicLSS ¶ added in v1.0.1
func NewDynamicLSS(pl *pool.Pool) *DynamicLSS
NewDynamicLSS creates a proper LSS implementation
func (*DynamicLSS) LiveReshare ¶ added in v1.0.1
func (d *DynamicLSS) LiveReshare( oldConfigs []*config.Config, newParticipants []party.ID, newThreshold int, ) ([]*config.Config, error)
LiveReshare performs the core LSS innovation: dynamic resharing without key reconstruction This implements the protocol from Section 4 of the paper
type FROST ¶
type FROST struct {
// contains filtered or unexported fields
}
FROST extends the FROST protocol with LSS dynamic resharing capabilities. This allows FROST to perform membership changes without reconstructing the master key.
func NewLSSFROST ¶
NewLSSFROST creates a new LSS-extended FROST instance
func (*FROST) GetConfig ¶
func (f *FROST) GetConfig() *FROSTConfig
GetConfig returns the current FROST configuration
func (*FROST) GetGeneration ¶
GetGeneration returns the current resharing generation number
func (*FROST) Refresh ¶
func (f *FROST) Refresh() (*FROSTConfig, error)
Refresh performs a proactive refresh of shares without changing membership
func (*FROST) UpdateConfig ¶
func (f *FROST) UpdateConfig(newConfig *FROSTConfig)
UpdateConfig updates the configuration after a successful resharing
type FROSTConfig ¶
FROSTConfig wraps the FROST keygen config for LSS compatibility
type Factory ¶ added in v1.0.1
type Factory struct {
// contains filtered or unexported fields
}
Factory creates protocol instances
func NewFactory ¶ added in v1.0.1
NewFactory creates a protocol factory
type FactoryConfig ¶ added in v1.1.0
type FactoryConfig struct {
Chain Chain
Threshold int
TotalParties int
SignatureScheme adapters.SignatureType
TestMode bool
CustomChainID interface{}
}
FactoryConfig holds LSS adapter configuration
type GenerationSnapshot ¶
type GenerationSnapshot struct {
Generation uint64
Config *config.Config
PartyIDs []party.ID
Threshold int
Timestamp int64
FailureCount int
}
GenerationSnapshot represents a point-in-time configuration state
type LSS ¶ added in v1.1.0
type LSS struct {
// contains filtered or unexported fields
}
LSS is the main entry point for using LSS with any blockchain
func New ¶ added in v1.1.0
func New(config *FactoryConfig) (*LSS, error)
New creates a new LSS instance for any blockchain
func QuickStart ¶ added in v1.1.0
QuickStart creates an LSS instance with minimal configuration
func (*LSS) GetAdapter ¶ added in v1.1.0
func (l *LSS) GetAdapter() adapters.SignerAdapter
GetAdapter returns the underlying adapter
func (*LSS) GetConfig ¶ added in v1.1.0
func (l *LSS) GetConfig() *FactoryConfig
GetConfig returns the configuration
type ReshareMessage ¶
type ReshareMessage struct {
}
ReshareMessage represents a message in the reshare protocol
type ReshareMessageType ¶
type ReshareMessageType int
ReshareMessageType represents the type of reshare message.
const ( ReshareTypeJVSSCommitment ReshareMessageType = iota ReshareTypeBlindedShare ReshareTypeBlindedProduct ReshareTypeVerification )
type RollbackManager ¶
type RollbackManager struct {
// contains filtered or unexported fields
}
RollbackManager manages configuration history and rollback operations
func NewRollbackManager ¶
func NewRollbackManager(maxGenerations int) *RollbackManager
NewRollbackManager creates a new rollback manager
func (*RollbackManager) ClearHistory ¶
func (rm *RollbackManager) ClearHistory()
ClearHistory removes all stored snapshots
func (*RollbackManager) EvictParties ¶
func (rm *RollbackManager) EvictParties(cfg *config.Config, evictedParties []party.ID) (*config.Config, error)
EvictParties removes specified parties from the current configuration
func (*RollbackManager) GetHistory ¶
func (rm *RollbackManager) GetHistory() []*GenerationSnapshot
GetHistory returns the configuration history
func (*RollbackManager) Rollback ¶
func (rm *RollbackManager) Rollback(targetGeneration uint64) (*config.Config, error)
Rollback reverts to a previous generation
func (*RollbackManager) RollbackOnFailure ¶
func (rm *RollbackManager) RollbackOnFailure(failureThreshold int) (*config.Config, error)
RollbackOnFailure automatically rolls back if failure count exceeds threshold
func (*RollbackManager) SaveSnapshot ¶
func (rm *RollbackManager) SaveSnapshot(cfg *config.Config) error
SaveSnapshot saves a configuration snapshot for potential rollback
type SigningProtocol ¶ added in v1.0.1
type SigningProtocol struct {
// contains filtered or unexported fields
}
SigningProtocol implements the LSS signing protocols from Section 5
func NewSigningProtocol ¶ added in v1.0.1
func NewSigningProtocol(cfg *config.Config, pl *pool.Pool) *SigningProtocol
NewSigningProtocol creates a new LSS signing protocol instance
func (*SigningProtocol) SignWithBlinding ¶ added in v1.0.1
func (s *SigningProtocol) SignWithBlinding( message []byte, signers []party.ID, blindingFactor curve.Scalar, ) protocol.StartFunc
SignWithBlinding implements Protocol I: Localized Nonce Blinding from Section 5.1
type Suite ¶ added in v1.0.1
type Suite struct {
// contains filtered or unexported fields
}
Suite provides a clean abstraction over different threshold signature protocols. LSS (Layered Secret Sharing) acts as the unifying layer.
Example ¶
package main
import (
"github.com/luxfi/threshold/pkg/pool"
"github.com/luxfi/threshold/pkg/protocol"
"github.com/luxfi/threshold/protocols/lss"
)
func main() {
pl := pool.NewPool(0)
defer pl.TearDown()
// Auto-select protocol based on signature needs
factory := lss.NewFactory(pl)
// Need ECDSA? Automatically uses CMP
ecdsaSuite := factory.Auto(protocol.ECDSA)
_ = ecdsaSuite
// Need Schnorr? Automatically uses FROST
schnorrSuite := factory.Auto(protocol.Schnorr)
_ = schnorrSuite
// Or explicitly choose
cmpSuite := lss.WithCMP(pl)
frostSuite := lss.WithFROST(pl)
// All suites have the same interface
_ = cmpSuite
_ = frostSuite
}
func NewSuite ¶ added in v1.0.1
func NewSuite(backend protocol.ThresholdProtocol, pl *pool.Pool) *Suite
NewSuite creates a new LSS suite with the specified backend
func (*Suite) Keygen ¶ added in v1.0.1
func (s *Suite) Keygen(group curve.Curve, selfID party.ID, participants []party.ID, threshold int) protocol.StartFunc
Keygen generates a new distributed key
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package adapters - Bitcoin adapter with Taproot support
|
Package adapters - Bitcoin adapter with Taproot support |
|
Package config implements the LSS configuration and storage
|
Package config implements the LSS configuration and storage |
|
Package keygen implements the LSS key generation protocol.
|
Package keygen implements the LSS key generation protocol. |
|
Package reshare implements the LSS dynamic resharing protocol.
|
Package reshare implements the LSS dynamic resharing protocol. |
|
Package sign implements the LSS signing protocol.
|
Package sign implements the LSS signing protocol. |