Documentation ¶
Overview ¶
Package mpc is a client of mpc server, doing the sign and accept tasks.
Index ¶
- Variables
- func BuildMPCRawTx(nonce uint64, payload []byte, keyWrapper *keystore.Key) (string, error)
- func GetEnodeID(enode string) string
- func GetEnodeIDs(enodes []string) []string
- func Init(isServer bool)
- type AcceptData
- type Config
- func (c *Config) AcceptSign(raw string) (string, error)
- func (c *Config) DoAcceptSign(keyID, agreeResult string, msgHash, msgContext []string) (string, error)
- func (c *Config) DoSign(signType, signPubkey string, msgHash, msgContext []string) (keyID string, rsvs []string, err error)
- func (c *Config) DoSignOne(signType, signPubkey, msgHash, msgContext string) (keyID string, rsvs []string, err error)
- func (c *Config) DoSignOneEC(signPubkey, msgHash, msgContext string) (keyID string, rsvs []string, err error)
- func (c *Config) DoSignOneED(signPubkey, msgHash, msgContext string) (keyID string, rsvs []string, err error)
- func (c *Config) GetAllEnodes() []string
- func (c *Config) GetAllInitiatorNodes() []*NodeInfo
- func (c *Config) GetCurNodeSignInfo(expiredInterval int64) ([]*SignInfoData, error)
- func (c *Config) GetEnode(rpcAddr string) (string, error)
- func (c *Config) GetGroupByID(groupID, rpcAddr string) (*GroupInfo, error)
- func (c *Config) GetGroupID() string
- func (c *Config) GetSelfEnode() string
- func (c *Config) GetSignNonce(mpcUser, rpcAddr string) (uint64, error)
- func (c *Config) GetSignStatus(key, rpcAddr string) (*SignStatus, error)
- func (c *Config) GetSignStatusByKeyID(keyID string) (rsvs []string, err error)
- func (c *Config) IsMPCInitiator(account string) bool
- func (c *Config) IsSwapServer() bool
- func (c *Config) Sign(raw, rpcAddr string) (string, error)
- type DataEnode
- type DataResult
- type DataResultResp
- type GetEnodeResp
- type GetGroupByIDResp
- type GroupInfo
- type NodeInfo
- type SignData
- type SignInfoData
- type SignInfoResp
- type SignInfoSortedSlice
- type SignReply
- type SignStatus
Constants ¶
This section is empty.
Variables ¶
var ( ErrGetSignStatusTimeout = errors.New("getSignStatus timeout") ErrGetSignStatusFailed = errors.New("getSignStatus failure") ErrGetSignStatusHasDisagree = errors.New("getSignStatus has disagree") )
get mpc sign status error
Functions ¶
func BuildMPCRawTx ¶
BuildMPCRawTx build mpc raw tx
func GetEnodeID ¶
GetEnodeID get enode id (get rid of prefix and suffix)
Types ¶
type AcceptData ¶
type AcceptData struct { TxType string Key string Accept string MsgHash []string MsgContext []string TimeStamp string }
AcceptData accpet data
type Config ¶
type Config struct { IsFastMPC bool GetAcceptListLoopInterval uint64 GetAcceptListRetryInterval uint64 MaxAcceptSignTimeInterval int64 PendingInvalidAccept bool // contains filtered or unexported fields }
Config mpc config
func InitConfig ¶
InitConfig init mpc config
func (*Config) AcceptSign ¶
AcceptSign call acceptSign
func (*Config) DoAcceptSign ¶
func (c *Config) DoAcceptSign(keyID, agreeResult string, msgHash, msgContext []string) (string, error)
DoAcceptSign accept sign
func (*Config) DoSign ¶
func (c *Config) DoSign(signType, signPubkey string, msgHash, msgContext []string) (keyID string, rsvs []string, err error)
DoSign mpc sign msgHash with context msgContext
func (*Config) DoSignOne ¶
func (c *Config) DoSignOne(signType, signPubkey, msgHash, msgContext string) (keyID string, rsvs []string, err error)
DoSignOne mpc sign single msgHash with context msgContext
func (*Config) DoSignOneEC ¶
func (c *Config) DoSignOneEC(signPubkey, msgHash, msgContext string) (keyID string, rsvs []string, err error)
DoSignOneEC mpc sign single msgHash with context msgContext
func (*Config) DoSignOneED ¶
func (c *Config) DoSignOneED(signPubkey, msgHash, msgContext string) (keyID string, rsvs []string, err error)
DoSignOneED mpc sign single msgHash with context msgContext
func (*Config) GetAllInitiatorNodes ¶
GetAllInitiatorNodes get all initiator mpc node info
func (*Config) GetCurNodeSignInfo ¶
func (c *Config) GetCurNodeSignInfo(expiredInterval int64) ([]*SignInfoData, error)
GetCurNodeSignInfo call getCurNodeSignInfo filter out invalid sign info and filter out expired sign info if `expiredInterval` is greater than 0
func (*Config) GetGroupByID ¶
GetGroupByID call getGroupByID
func (*Config) GetSignNonce ¶
GetSignNonce call getSignNonce
func (*Config) GetSignStatus ¶
func (c *Config) GetSignStatus(key, rpcAddr string) (*SignStatus, error)
GetSignStatus call getSignStatus
func (*Config) GetSignStatusByKeyID ¶
GetSignStatusByKeyID get sign status by keyID
func (*Config) IsMPCInitiator ¶
IsMPCInitiator is initiator of mpc sign
func (*Config) IsSwapServer ¶
IsSwapServer returns if this mpc user is the swap server
type DataResultResp ¶
type DataResultResp struct { Status string Tip string Error string Data *DataResult }
DataResultResp result response
type GetEnodeResp ¶
GetEnodeResp enode response
type GetGroupByIDResp ¶
GetGroupByIDResp group response
type NodeInfo ¶
type NodeInfo struct {
// contains filtered or unexported fields
}
NodeInfo mpc node info
func (*NodeInfo) GetMPCRPCAddress ¶
GetMPCRPCAddress get mpc node rpc address
func (*NodeInfo) GetMPCUser ¶
GetMPCUser returns the mpc user of specified keystore
type SignData ¶
type SignData struct { TxType string PubKey string MsgHash []string MsgContext []string Keytype string GroupID string ThresHold string Mode string TimeStamp string }
SignData sign data
type SignInfoData ¶
type SignInfoData struct { Account string GroupID string Key string KeyType string Mode string MsgHash []string MsgContext []string Nonce string PubKey string ThresHold string TimeStamp string // contains filtered or unexported fields }
SignInfoData sign info
func (*SignInfoData) HasValidSignature ¶
func (s *SignInfoData) HasValidSignature() bool
HasValidSignature has valid signature
func (*SignInfoData) IsValid ¶
func (s *SignInfoData) IsValid(verifySignature bool) bool
IsValid is valid
type SignInfoResp ¶
type SignInfoResp struct { Status string Tip string Error string Data []*SignInfoData }
SignInfoResp sign info response
type SignInfoSortedSlice ¶
type SignInfoSortedSlice []*SignInfoData
SignInfoSortedSlice weighted string slice
func (SignInfoSortedSlice) Less ¶
func (s SignInfoSortedSlice) Less(i, j int) bool
Less impl Sortable
type SignStatus ¶
type SignStatus struct { Status string Rsv []string Tip string Error string AllReply []*SignReply TimeStamp string }
SignStatus sign status
func (*SignStatus) HasDisagree ¶
func (s *SignStatus) HasDisagree() bool
HasDisagree has disagree reply