dkg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2019 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotReachThreshold = fmt.Errorf("threshold not reach")
	ErrInvalidThreshold  = fmt.Errorf("invalid threshold")
)

Errors for typesDKG package.

Functions

func CalcQualifyNodes

func CalcQualifyNodes(
	mpks []*MasterPublicKey, complaints []*Complaint, threshold int) (
	qualifyIDs cryptoDKG.IDs, qualifyNodeIDs map[types.NodeID]struct{}, err error)

CalcQualifyNodes returns the qualified nodes.

func NewID

func NewID(ID types.NodeID) cryptoDKG.ID

NewID creates a DKGID from NodeID.

Types

type Complaint

type Complaint struct {
	ProposerID   types.NodeID     `json:"proposer_id"`
	Round        uint64           `json:"round"`
	Reset        uint64           `json:"reset"`
	PrivateShare PrivateShare     `json:"private_share"`
	Signature    crypto.Signature `json:"signature"`
}

Complaint describe a complaint in DKG protocol.

func (*Complaint) DecodeRLP

func (c *Complaint) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder

func (*Complaint) EncodeRLP

func (c *Complaint) EncodeRLP(w io.Writer) error

EncodeRLP implements rlp.Encoder

func (*Complaint) Equal

func (c *Complaint) Equal(other *Complaint) bool

Equal checks equality between two Complaint instances.

func (*Complaint) IsNack

func (c *Complaint) IsNack() bool

IsNack returns true if it's a nack complaint in DKG protocol.

func (*Complaint) String

func (c *Complaint) String() string

type Finalize

type Finalize struct {
	ProposerID types.NodeID     `json:"proposer_id"`
	Round      uint64           `json:"round"`
	Reset      uint64           `json:"reset"`
	Signature  crypto.Signature `json:"signature"`
}

Finalize describe a dkg finalize message in DKG protocol.

func (*Finalize) Equal

func (final *Finalize) Equal(other *Finalize) bool

Equal check equality of two Finalize instances.

func (*Finalize) String

func (final *Finalize) String() string

type GroupPublicKey

type GroupPublicKey struct {
	Round          uint64
	QualifyIDs     cryptoDKG.IDs
	QualifyNodeIDs map[types.NodeID]struct{}
	IDMap          map[types.NodeID]cryptoDKG.ID
	GroupPublicKey *cryptoDKG.PublicKey
	Threshold      int
}

GroupPublicKey is the result of DKG protocol.

func NewGroupPublicKey

func NewGroupPublicKey(
	round uint64,
	mpks []*MasterPublicKey, complaints []*Complaint,
	threshold int) (
	*GroupPublicKey, error)

NewGroupPublicKey creats a GroupPublicKey instance.

func (*GroupPublicKey) VerifySignature

func (gpk *GroupPublicKey) VerifySignature(
	hash common.Hash, sig crypto.Signature) bool

VerifySignature verifies if the signature is correct.

type MPKReady

type MPKReady struct {
	ProposerID types.NodeID     `json:"proposer_id"`
	Round      uint64           `json:"round"`
	Reset      uint64           `json:"reset"`
	Signature  crypto.Signature `json:"signature"`
}

MPKReady describe a dkg ready message in DKG protocol.

func (*MPKReady) Equal

func (ready *MPKReady) Equal(other *MPKReady) bool

Equal check equality of two MPKReady instances.

func (*MPKReady) String

func (ready *MPKReady) String() string

type MasterPublicKey

type MasterPublicKey struct {
	ProposerID      types.NodeID              `json:"proposer_id"`
	Round           uint64                    `json:"round"`
	Reset           uint64                    `json:"reset"`
	DKGID           cryptoDKG.ID              `json:"dkg_id"`
	PublicKeyShares cryptoDKG.PublicKeyShares `json:"public_key_shares"`
	Signature       crypto.Signature          `json:"signature"`
}

MasterPublicKey decrtibe a master public key in DKG protocol.

func NewMasterPublicKey

func NewMasterPublicKey() *MasterPublicKey

NewMasterPublicKey returns a new MasterPublicKey instance.

func (*MasterPublicKey) DecodeRLP

func (d *MasterPublicKey) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder

func (*MasterPublicKey) EncodeRLP

func (d *MasterPublicKey) EncodeRLP(w io.Writer) error

EncodeRLP implements rlp.Encoder

func (*MasterPublicKey) Equal

func (d *MasterPublicKey) Equal(other *MasterPublicKey) bool

Equal check equality of two DKG master public keys.

func (*MasterPublicKey) String

func (d *MasterPublicKey) String() string

func (*MasterPublicKey) UnmarshalJSON

func (d *MasterPublicKey) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaller.

type NodePublicKeys

type NodePublicKeys struct {
	Round          uint64
	QualifyIDs     cryptoDKG.IDs
	QualifyNodeIDs map[types.NodeID]struct{}
	IDMap          map[types.NodeID]cryptoDKG.ID
	PublicKeys     map[types.NodeID]*cryptoDKG.PublicKey
	Threshold      int
}

NodePublicKeys is the result of DKG protocol.

func NewNodePublicKeys

func NewNodePublicKeys(
	round uint64,
	mpks []*MasterPublicKey, complaints []*Complaint,
	threshold int) (
	*NodePublicKeys, error)

NewNodePublicKeys creats a NodePublicKeys instance.

type PartialSignature

type PartialSignature struct {
	ProposerID       types.NodeID               `json:"proposer_id"`
	Round            uint64                     `json:"round"`
	Hash             common.Hash                `json:"hash"`
	PartialSignature cryptoDKG.PartialSignature `json:"partial_signature"`
	Signature        crypto.Signature           `json:"signature"`
}

PartialSignature describe a partial signature in DKG protocol.

type PrivateShare

type PrivateShare struct {
	ProposerID   types.NodeID         `json:"proposer_id"`
	ReceiverID   types.NodeID         `json:"receiver_id"`
	Round        uint64               `json:"round"`
	Reset        uint64               `json:"reset"`
	PrivateShare cryptoDKG.PrivateKey `json:"private_share"`
	Signature    crypto.Signature     `json:"signature"`
}

PrivateShare describe a secret share in DKG protocol.

func (*PrivateShare) Equal

func (p *PrivateShare) Equal(other *PrivateShare) bool

Equal checks equality between two PrivateShare instances.

type Success

type Success struct {
	ProposerID types.NodeID     `json:"proposer_id"`
	Round      uint64           `json:"round"`
	Reset      uint64           `json:"reset"`
	Signature  crypto.Signature `json:"signature"`
}

Success describe a dkg success message in DKG protocol.

func (*Success) Equal

func (s *Success) Equal(other *Success) bool

Equal check equality of two Success instances.

func (*Success) String

func (s *Success) String() string

Jump to

Keyboard shortcuts

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