protocol

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: GPL-3.0, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MpcGPKLeader = iota + 0
	MpcGPKPeer
	MpcSignLeader
	MpcSignPeer
)
View Source
const (
	StatusCode = iota + 10 // used by storeman protocol
	KeepaliveCode
	KeepaliveOkCode
	MPCError
	RequestMPC // ask for a new mpc Context
	MPCMessage // get a message for a Context
	RequestMPCNonce
	KeepaliveCycle
	CheckAllPeerConnected
	BuildStoremanGroup
	AllPeersInfo
	GetPeersInfo
	NumberOfMessageCodes
	//MPCTimeOut = time.Second * 100
	//MPCTimeOut = time.Second * 10
	MPCTimeOut = time.Second * 20
	PName      = "storeman"
	PVer       = uint64(10)
	PVerStr    = "1.1"
)
View Source
const (
	MpcPrivateShare  = "MpcPrivateShare"  // skShare
	RMpcPrivateShare = "RMpcPrivateShare" // rskShare
	MpcPublicShare   = "MpcPublicShare"   // pkShare
	RMpcPublicShare  = "RMpcPublicShare"  // rpkShare
	MpcContextResult = "MpcContextResult"

	PublicKeyResult  = "PublicKeyResult"  // gpk
	RPublicKeyResult = "RPublicKeyResult" // R: rpk
	MpcM             = "MpcM"             // M
	MpcS             = "MpcS"             // S: s

	MpcExt       = "MpcExtern"    // extern
	MpcByApprove = "MpcByApprove" // by approve

	MpcTxHash  = "MpcTxHash"
	MpcAddress = "MpcAddress"
	MPCAction  = "MPCAction"
)
View Source
const (
	MpcApproving     = "MpcApproving"
	MpcApproved      = "MpcApproved"
	MpcApprovingKeys = "MpcApprovingKeys" // key : MpcApprovingKeys, value: array of the key of the data.
)

Variables

View Source
var (
	ErrQuit                  = errors.New("quit")
	ErrMpcResultExist        = errors.New("mpc Result is not exist")
	ErrContextType           = errors.New("err Context Type is error")
	ErrTimeOut               = errors.New("mpc Request is TimeOut")
	ErrPointZero             = errors.New("mpc Point is zero")
	ErrMpcSeedOutRange       = errors.New("mpc seeds are out range")
	ErrMpcSeedDuplicate      = errors.New("mpc seeds have duplicate")
	ErrTooLessStoreman       = errors.New("mpc alive Storeman is not enough")
	ErrFailedDataVerify      = errors.New("mpc signing data validate failed")
	ErrFailedAddApproving    = errors.New("mpc add approving data failed")
	ErrMpcContextExist       = errors.New("mpc Context ID is already exist")
	ErrInvalidMPCAddr        = errors.New("invalid mpc account address")
	ErrInvalidMPCR           = errors.New("invalid signed data(R)")
	ErrInvalidMPCS           = errors.New("invalid signed data(S)")
	ErrVerifyFailed          = errors.New("verify failed")
	ErrGetDb                 = errors.New("get database failed")
	ErrWaitApproved          = errors.New("wait for being approved failed")
	ErrGetApproved           = errors.New("get being approved failed")
	ErrMarshal               = errors.New("marshal data failed")
	ErrApprovedNotConsistent = errors.New("not equal,received  data and approved data in DB")
	ErrTooLessDataCollected  = errors.New("not enough data collected")
)
View Source
var (
	MpcSchnrThr        = 26 // MpcSchnrThr >= number(storeman )/2 +1
	MPCDegree          = MpcSchnrThr - 1
	MpcSchnrNodeNumber = 50 // At least MpcSchnrNodeNumber MPC nodes
)

Functions

This section is empty.

Types

type GetMessageInterface

type GetMessageInterface interface {
	HandleMessage(*StepMessage) bool
}

type MpcMessage

type MpcMessage struct {
	ContextID uint64
	StepID    uint64
	Peers     []byte
	Data      []big.Int //message data
	BytesData [][]byte
}

type MpcResultInterface

type MpcResultInterface interface {
	Initialize() error
	SetValue(key string, value []big.Int) error
	GetValue(key string) ([]big.Int, error)
	SetByteValue(key string, value []byte) error
	GetByteValue(key string) ([]byte, error)
}

type PeerInfo

type PeerInfo struct {
	PeerID discover.NodeID
	Seed   uint64
}

type SendData

type SendData struct {
	PKBytes hexutil.Bytes `json:"pk"`
	//Data    []byte        `json:"data"`
	//Data   string `json:"data"`
	Data   hexutil.Bytes `json:"data"`
	Extern string        `json:extern`
}

func (*SendData) String

func (d *SendData) String() string

type SignedResult

type SignedResult struct {
	R hexutil.Bytes `json:"R"`
	S hexutil.Bytes `json:"S"`
}

type SliceStoremanGroup

type SliceStoremanGroup []discover.NodeID

func (SliceStoremanGroup) Len

func (s SliceStoremanGroup) Len() int

func (SliceStoremanGroup) Less

func (s SliceStoremanGroup) Less(i, j int) bool

func (SliceStoremanGroup) Swap

func (s SliceStoremanGroup) Swap(i, j int)

type StepMessage

type StepMessage struct {
	MsgCode   uint64 //message code
	PeerID    *discover.NodeID
	Peers     *[]PeerInfo
	Data      []big.Int //message data
	BytesData [][]byte
	StepId    int
}

type StoremanManager

type StoremanManager interface {
	P2pMessage(*discover.NodeID, uint64, interface{}) error
	BroadcastMessage([]discover.NodeID, uint64, interface{}) error
	SetMessagePeers(*MpcMessage, *[]PeerInfo)
	SelfNodeId() *discover.NodeID
	CreateKeystore(MpcResultInterface, *[]PeerInfo, string) error
}

Jump to

Keyboard shortcuts

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