dkg

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

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

	// BLSWithdrawalPrefixByte is the BLS withdrawal prefix
	BLSWithdrawalPrefixByte = byte(0)
)

Variables

View Source
var ErrAlreadyExists = errors.New("duplicate message")
View Source
var IsSupportedDepositNetwork = func(network eth2_key_manager_core.Network) bool {
	return network == eth2_key_manager_core.PyrmontNetwork || network == eth2_key_manager_core.PraterNetwork || network == eth2_key_manager_core.MainNetwork
}

IsSupportedDepositNetwork returns true if the given network is supported

Functions

func CreateExchange

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

func ExchangeWireMessage

func ExchangeWireMessage(exchData []byte, reqID [24]byte) *wire.Transport

func GetNetworkByFork

func GetNetworkByFork(fork [4]byte) eth2_key_manager_core.Network

func InitSecret

func InitSecret(suite pairing.Suite) (kyber.Scalar, kyber.Point)

Types

type DKGData

type DKGData struct {
	ReqID [24]byte

	Secret kyber.Scalar
	// contains filtered or unexported fields
}

type LocalOwner

type LocalOwner struct {
	Logger *zap.Logger

	ErrorChan chan error
	ID        uint64

	BroadcastF  func([]byte) error
	Exchanges   map[uint64]*wire.Exchange
	SecretShare *dkg.DistKeyShare
	VerifyFunc  func(id uint64, msg, sig []byte) error
	SignFunc    func([]byte) ([]byte, error)
	EncryptFunc func([]byte) ([]byte, error)
	DecryptFunc func([]byte) ([]byte, error)
	RSAPub      *rsa.PublicKey
	Owner       common.Address
	Nonce       uint64
	// contains filtered or unexported fields
}

func New

func New(opts OwnerOpts) *LocalOwner

func (*LocalOwner) Broadcast

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

func (*LocalOwner) Init

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

func (*LocalOwner) PostDKG

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

func (*LocalOwner) Process

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

func (*LocalOwner) StartDKG

func (o *LocalOwner) StartDKG() error

type Operator

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

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)
	RSAPub      *rsa.PublicKey
	Owner       [20]byte
	Nonce       uint64
}

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
}

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