Documentation ¶
Index ¶
- Constants
- func HealthcheckWorker(ctx context.Context, server *tss.TssServer, p HealthcheckProps, ...) error
- func KeygenCeremony(ctx context.Context, server *tss.TssServer, zc Zetacore, logger zerolog.Logger) (observertypes.TSS, error)
- func MultiAddressFromString(peer string) ([]multiaddr.Multiaddr, error)
- func NewTSSServer(bootstrapPeers []multiaddr.Multiaddr, whitelistPeers []peer.ID, ...) (*tss.TssServer, error)
- func ResolvePreParamsFromPath(path string) (*keygen.LocalPreParams, error)
- func SignatureToBytes(input keysign.Signature) (sig [65]byte, err error)
- func TestKeySign(keySigner KeySigner, tssPubKeyBec32 string, logger zerolog.Logger) error
- func VerifySignature(sig keysign.Signature, pk PubKey, hash []byte) ([65]byte, error)
- type HealthcheckProps
- type KeySigner
- type Metrics
- type Opt
- type PubKey
- type Service
- type SetupProps
- type Telemetry
- type Zetacore
Constants ¶
const ( // Port is the default port for go-tss server. Port = 6668 Version = "0.14.0" Algo = tsscommon.ECDSA )
Variables ¶
This section is empty.
Functions ¶
func HealthcheckWorker ¶
func HealthcheckWorker(ctx context.Context, server *tss.TssServer, p HealthcheckProps, logger zerolog.Logger) error
HealthcheckWorker checks the health of the TSS server and its peers.
func KeygenCeremony ¶
func KeygenCeremony( ctx context.Context, server *tss.TssServer, zc Zetacore, logger zerolog.Logger, ) (observertypes.TSS, error)
KeygenCeremony runs TSS keygen ceremony as a blocking thread. Most likely the keygen is already generated, so this function will be a noop. Returns the TSS key if generated, or error.
func MultiAddressFromString ¶
MultiAddressFromString parses a string into a slice of addresses (for convenience).
func NewTSSServer ¶
func NewTSSServer( bootstrapPeers []multiaddr.Multiaddr, whitelistPeers []peer.ID, preParams *keygen.LocalPreParams, privateKey crypto.PrivKey, cfg config.Config, tssPassword string, logger zerolog.Logger, ) (*tss.TssServer, error)
NewTSSServer creates a new tss.TssServer (go-tss) instance for key signing. - bootstrapPeers are used to discover other peers - whitelistPeers are the only peers that are allowed in p2p key signing. - preParams are the TSS pre-params required for key generation
func ResolvePreParamsFromPath ¶
func ResolvePreParamsFromPath(path string) (*keygen.LocalPreParams, error)
ResolvePreParamsFromPath resolves TSS pre-params from json config by path. Error indicates that the pre-params file is not found or invalid. FYI: pre-params are generated by keygen.GeneratePreParams.
func SignatureToBytes ¶
SignatureToBytes converts keysign.Signature to [65]byte (R, S, V)
func TestKeySign ¶
TestKeySign performs a TSS key-sign test of sample data.
Types ¶
type HealthcheckProps ¶
type HealthcheckProps struct { Telemetry Telemetry Interval time.Duration WhitelistPeers []peer.ID NumConnectedPeersMetric prometheus.Gauge }
HealthcheckProps represents options for HealthcheckWorker.
type Metrics ¶
type Metrics struct { ActiveMsgsSigns prometheus.Gauge SignLatency *prometheus.HistogramVec NodeBlamePerPubKey *prometheus.CounterVec }
Metrics Prometheus metrics for the TSS service.
type Opt ¶
Opt Service option.
func WithMetrics ¶
WithMetrics registers Prometheus metrics for the TSS service. Otherwise, no metrics will be collected.
func WithPostBlame ¶
WithPostBlame configures the TSS service to post blame in case of failed key signatures.
type PubKey ¶
type PubKey struct {
// contains filtered or unexported fields
}
PubKey represents TSS public key in various formats.
func NewPubKeyFromBech32 ¶
NewPubKeyFromBech32 creates a new PubKey from a bech32 address. Example: `zetapub1addwnpepq2fdhcmfyv07s86djjca835l4f2n2ta0c7le6vnl508mseca2s9g6slj0gm`
func NewPubKeyFromECDSA ¶
NewPubKeyFromECDSA creates a new PubKey from an ECDSA public key.
func NewPubKeyFromECDSAHexString ¶
NewPubKeyFromECDSAHexString creates PubKey from 0xABC12...
func ParsePubKeysFromPath ¶
ParsePubKeysFromPath extracts public keys from tss directory. Example: `tssPath="~/.tss"`. Contents: localstate-zetapub1addwnpepq2fdhcmfyv07s86djjca835l4f2n2ta0c7le6vnl508mseca2s9g6slj0gm.json Output: `zetapub1addwnpepq2fdhcmfyv07s86djjca835l4f2n2ta0c7le6vnl508mseca2s9g6slj0gm`
func (PubKey) AddressBTC ¶
func (k PubKey) AddressBTC(chainID int64) (*btcutil.AddressWitnessPubKeyHash, error)
AddressBTC returns the bitcoin address of the public key.
func (PubKey) AddressEVM ¶
AddressEVM returns the ethereum address of the public key.
func (PubKey) Bech32String ¶
Bech32String returns the bech32 string of the public key. Example: `zetapub1addwnpepq2fdhcmfyv07s86djjca835l4f2n2ta0c7le6vnl508mseca2s9g6slj0gm`
func (PubKey) Bytes ¶
Bytes marshals pubKey to bytes either as compressed or uncompressed slice.
In ECDSA, a compressed pubKey includes only the X and a parity bit for the Y, allowing the full Y to be reconstructed using the elliptic curve equation, thus reducing the key size while maintaining the ability to fully recover the pubKey.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service TSS service
func NewService ¶
func NewService( keySigner KeySigner, tssPubKeyBech32 string, zetacore Zetacore, logger zerolog.Logger, opts ...Opt, ) (*Service, error)
NewService Service constructor. TODO LRU cache
func Setup ¶
Setup beefy function that does all the logic for bootstrapping tss-server, tss signer, generating TSS key is needed, etc...
type SetupProps ¶
type SetupProps struct { Config config.Config Zetacore Zetacore GranteePubKeyBech32 string HotKeyPassword string TSSKeyPassword string BitcoinChainIDs []int64 PostBlame bool Telemetry Telemetry }
SetupProps represents options for Setup.
type Zetacore ¶
type Zetacore interface { GetKeys() keyinterfaces.ObserverKeys Chain() chains.Chain GetBlockHeight(ctx context.Context) (int64, error) GetKeyGen(ctx context.Context) (observertypes.Keygen, error) GetTSS(ctx context.Context) (observertypes.TSS, error) GetTSSHistory(ctx context.Context) ([]observertypes.TSS, error) PostVoteTSS( ctx context.Context, tssPubKey string, keyGenZetaHeight int64, status chains.ReceiveStatus, ) (string, error) PostVoteBlameData(ctx context.Context, blame *blame.Blame, chainID int64, index string) (string, error) }
Zetacore zeta core client.