dkg

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxEffectiveBalanceInGwei is the max effective balance
	MaxEffectiveBalanceInGwei phase0.Gwei = 32000000000
)

Variables

View Source
var ErrAlreadyExists = errors.New("duplicate message")

Functions

func CreateExchange

func CreateExchange(pk kyber.Point, commits []byte) ([]byte, *wire.Exchange, error)

Types

type DKGdata added in v1.0.0

type DKGdata struct {
	// contains filtered or unexported fields
}

DKGdata structure to store at LocalOwner information about initial message parameters and secret scalar to be used as input for DKG protocol

type DistKeyShare added in v1.0.0

type DistKeyShare struct {
	Commits []byte   `json:"commits"`
	Share   PriShare `json:"secret_share"`
}

func (*DistKeyShare) Decode added in v1.0.0

func (msg *DistKeyShare) Decode(data []byte) error

Decode returns error if decoding failed

func (*DistKeyShare) Encode added in v1.0.0

func (msg *DistKeyShare) Encode() ([]byte, error)

Encode returns a msg encoded bytes or error

type LocalOwner

type LocalOwner struct {
	Logger *zap.Logger

	ErrorChan chan error
	ID        uint64

	Suite pairing.Suite

	SecretShare        *kyber_dkg.DistKeyShare
	InitiatorPublicKey *rsa.PublicKey
	RSAPub             *rsa.PublicKey
	// contains filtered or unexported fields
}

LocalOwner as a main structure created for a new DKG initiation or resharing ceremony

func New

func New(opts *OwnerOpts) *LocalOwner

New creates a LocalOwner structure. We create it for each new DKG ceremony.

func (*LocalOwner) Broadcast

func (o *LocalOwner) Broadcast(ts *wire.Transport) error

Function to send signed messages back to initiator

func (*LocalOwner) GetCeremonySig added in v1.2.0

func (o *LocalOwner) GetCeremonySig(secretKeyBLS *bls.SecretKey) ([]byte, error)

func (*LocalOwner) GetDKGNodes added in v1.0.0

func (o *LocalOwner) GetDKGNodes(ops []*wire.Operator) ([]kyber_dkg.Node, error)

GetDKGNodes returns a slice of DKG node instances used for the protocol

func (*LocalOwner) GetLocalOwner added in v1.0.0

func (o *LocalOwner) GetLocalOwner() *LocalOwner

func (*LocalOwner) Init

func (o *LocalOwner) Init(reqID [24]byte, init *wire.Init) (*wire.Transport, error)

Init function creates an interface for DKG (board) which process protocol messages Here we randomly create a point at G1 as a DKG public key for the node

func (*LocalOwner) InitReshare added in v1.0.0

func (o *LocalOwner) InitReshare(reqID [24]byte, reshare *wire.Reshare, commitsPoints []kyber.Point) (*wire.Transport, error)

InitReshare initiates a resharing owner of dkg protocol

func (*LocalOwner) PostDKG

func (o *LocalOwner) PostDKG(res *kyber_dkg.OptionResult) error

PostDKG stores the resulting key share, convert it to BLS points acceptable by ETH2 and creates the Result structure to send back to initiator

func (*LocalOwner) Process

func (o *LocalOwner) Process(from uint64, st *wire.SignedTransport) error

Process processes incoming messages from initiator at /dkg route

func (*LocalOwner) PushDealsOldNodes added in v1.0.0

func (o *LocalOwner) PushDealsOldNodes() error

func (*LocalOwner) StartDKG

func (o *LocalOwner) StartDKG() error

StartDKG initializes and starts DKG protocol

func (*LocalOwner) StartReshareDKGNewNodes added in v1.0.0

func (o *LocalOwner) StartReshareDKGNewNodes() error

func (*LocalOwner) StartReshareDKGOldNodes added in v1.0.0

func (o *LocalOwner) StartReshareDKGOldNodes() error

type Operator

type Operator struct {
	IP     string
	ID     uint64
	Pubkey *rsa.PublicKey
}

Operator structure contains information about external operator participating in the DKG ceremony

type OwnerOpts

type OwnerOpts struct {
	Logger             *zap.Logger
	ID                 uint64
	BroadcastF         func([]byte) error
	Suite              pairing.Suite
	VerifyFunc         func(id uint64, msg, sig []byte) error
	SignFunc           func([]byte) ([]byte, error)
	EncryptFunc        func([]byte) ([]byte, error)
	DecryptFunc        func([]byte) ([]byte, error)
	InitiatorPublicKey *rsa.PublicKey
	RSAPub             *rsa.PublicKey
	Owner              [20]byte
	Nonce              uint64
	Version            []byte
}

OwnerOpts structure to pass parameters from Switch to LocalOwner structure

type PriShare added in v1.0.0

type PriShare struct {
	I int    `json:"index"`
	V []byte `json:"secret_point"`
}

type Result

type Result struct {
	// Operator ID
	OperatorID uint64
	// Operator RSA pubkey
	PubKeyRSA *rsa.PublicKey
	// RequestID for the DKG instance (not used for signing)
	RequestID [24]byte
	// EncryptedShare standard SSV encrypted shares
	EncryptedShare []byte
	// SharePubKey is the share's BLS pubkey
	SharePubKey []byte
	// ValidatorPubKey the resulting public key corresponding to the shared private key
	ValidatorPubKey []byte
	// Partial Operator Signature of Deposit data
	DepositPartialSignature []byte
	// SSV owner + nonce signature
	OwnerNoncePartialSignature []byte
	// Signed priv share + initiator pub
	CeremonySig []byte
}

Result is the last message in every DKG which marks a specific node's end of process

func (*Result) Decode

func (msg *Result) Decode(data []byte) error

Decode returns error if decoding failed

func (*Result) Encode

func (msg *Result) Encode() ([]byte, error)

Encode returns a msg encoded bytes or error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL