smpc

package
v0.0.0-...-1e2cef0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: GPL-2.0, GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package smpc Gsmpc rpc interface

Package smpc Gsmpc rpc interface

Package smpc P2P rpc interface

Index

Constants

View Source
const (
	// SUCCESS success
	SUCCESS string = "Success"

	// FAIL fail
	FAIL string = "Error"

	// NULLRET retur nil
	NULLRET string = "Null"

	// REPEAT repeat
	REPEAT string = "Repeat"

	// PENDING pending
	PENDING string = "Pending"
)

Variables

View Source
var RPCTEST bool = false

RPCTEST test

Functions

func RPCInit

func RPCInit(port int)

RPCInit rpc start init

Types

type Enode

type Enode struct {
	Enode string
}

Enode enode

type EnodeStatus

type EnodeStatus struct {
	Enode  string
	Status string
}

EnodeStatus the status of enode

type GroupID

type GroupID struct {
	Gid  string
	Sgid string
}

GroupID group id

type GroupInfo

type GroupInfo struct {
	Gid    string
	Count  int
	Enodes []string
}

GroupInfo group info

type Result

type Result struct {
	Status string // Success, Error, Null, Repeat, Pending
	Tip    string
	Error  string
	Data   interface{}
}

Result rpc result

type Service

type Service struct{}

Service RPC service,include interface

func (*Service) AcceptKeyGen

func (service *Service) AcceptKeyGen(rsv string, msg string) map[string]interface{}

AcceptKeyGen Agree to generate pubkey Raw is a special signed transaction that agrees to reqaddr. The data format is: { "TxType":"ACCEPTREQADDR", "Account":"xxx", "Nonce":"xxx", "Key":"XXX", "Accept":"XXX", "TimeStamp":"XXX" }

func (*Service) AcceptReShare

func (service *Service) AcceptReShare(raw string) map[string]interface{}

AcceptReShare Agree to reshare

func (*Service) AcceptReSharing

func (service *Service) AcceptReSharing(rsv string, msg string) map[string]interface{}

AcceptReSharing Agree to reshare

func (*Service) AcceptReqAddr

func (service *Service) AcceptReqAddr(raw string) map[string]interface{}

AcceptReqAddr Agree to generate pubkey

Raw is a special signed transaction that agrees to reqaddr. The data format is:

{ "TxType":"ACCEPTREQADDR", "Key":"XXX", "Accept":"XXX", "TimeStamp":"XXX" }

func (*Service) AcceptSign

func (service *Service) AcceptSign(raw string) map[string]interface{}

AcceptSign Agree to sign Raw is a special transaction agreed to sign after signing. The data format is: { "TxType":"ACCEPTSIGN", "Key":"XXX", "Accept":"XXX", "TimeStamp":"XXX" }

func (*Service) AcceptSigning

func (service *Service) AcceptSigning(rsv string, msg string) map[string]interface{}

AcceptSigning Agree to sign Raw is a special transaction agreed to sign after signing. The data format is: { "TxType":"ACCEPTSIGN", "Account":"xxx", "Nonce":"xxx", "Key":"XXX", "Accept":"XXX", "TimeStamp":"XXX" }

func (*Service) BroadcastInSDKGroupAll

func (service *Service) BroadcastInSDKGroupAll(gid, msg string) map[string]interface{}

BroadcastInSDKGroupAll broacast msg to all nodes in group by gid

func (*Service) CreateGroup

func (service *Service) CreateGroup(threshold string, enodes []string) map[string]interface{}

CreateGroup create group

func (*Service) CreateSDKGroup

func (service *Service) CreateSDKGroup(threshold string, enodes []string, subGroup bool) map[string]interface{}

CreateSDKGroup create group

func (*Service) GetAccounts

func (service *Service) GetAccounts(account, mode string) map[string]interface{}

GetAccounts get all pubkey by accout and mode gid = "",get all pubkey of all gid gid != "",get all pubkey by gid

func (*Service) GetAccountsBalance

func (service *Service) GetAccountsBalance(pubkey string, account string) map[string]interface{}

GetAccountsBalance get all accout balances by pubkey

func (*Service) GetBalance

func (service *Service) GetBalance(account string, cointype string, smpcaddr string) map[string]interface{}

GetBalance get account balance

func (*Service) GetBip32ChildKey

func (service *Service) GetBip32ChildKey(rootpubkey string, inputcode string, keytype string, mode string) map[string]interface{}

GetBip32ChildKey The return value is the sub public key of the X1 / x2 /... / xn sub node of the root node's total public key pubkey. Rootpubkey is the total public key pubkey of the root node The inputcode format is "m / X1 / x2 /... / xn", where x1,..., xn is the index number of the child node of each level, which is in decimal format, for example: "m / 1234567890123456789012345678901234567890123456789012323455678901234" inputcode = "m/x1/x2/..../xn"

func (*Service) GetCurNodeReShareInfo

func (service *Service) GetCurNodeReShareInfo() map[string]interface{}

GetCurNodeReShareInfo Get the Reshare command approval list

func (*Service) GetCurNodeReqAddrInfo

func (service *Service) GetCurNodeReqAddrInfo(account string) map[string]interface{}

GetCurNodeReqAddrInfo Get the list of generating pubkey command data currently to be approved

func (*Service) GetCurNodeSignInfo

func (service *Service) GetCurNodeSignInfo(account string) map[string]interface{}

GetCurNodeSignInfo Get the list of sign command data currently to be approved

func (*Service) GetEnode

func (service *Service) GetEnode() map[string]interface{}

GetEnode get gsmpc node enodeId

func (*Service) GetEnodeStatus

func (service *Service) GetEnodeStatus(enode string) map[string]interface{}

GetEnodeStatus get enode status

func (*Service) GetGroupByID

func (service *Service) GetGroupByID(gid string) map[string]interface{}

GetGroupByID get group by gid

func (*Service) GetMpcNodeInfo

func (service *Service) GetMpcNodeInfo() map[string]interface{}

GetMpcNodeInfo get mpc node info

func (*Service) GetReShareNonce

func (service *Service) GetReShareNonce(account string) map[string]interface{}

GetReShareNonce Get the nonce value of this resare command special transaction

func (*Service) GetReShareStatus

func (service *Service) GetReShareStatus(key string) map[string]interface{}

GetReShareStatus Get the result of the Reshare command

func (*Service) GetReqAddrNonce

func (service *Service) GetReqAddrNonce(account string) map[string]interface{}

GetReqAddrNonce Get the nonce value of the special transaction generating pubkey

func (*Service) GetReqAddrStatus

func (service *Service) GetReqAddrStatus(key string) map[string]interface{}

GetReqAddrStatus Get the result of generating pubkey key: This generates the unique identification value of the pubkey command

func (*Service) GetSDKGroup

func (service *Service) GetSDKGroup(enode string) map[string]interface{}

GetSDKGroup get sdk group

func (*Service) GetSDKGroup4Smpc

func (service *Service) GetSDKGroup4Smpc() map[string]interface{}

GetSDKGroup4Smpc get group for smpc

func (*Service) GetSDKGroupAll

func (service *Service) GetSDKGroupAll() map[string]interface{}

GetSDKGroupAll for test

func (*Service) GetSDKGroupPerson

func (service *Service) GetSDKGroupPerson(enode string) map[string]interface{}

GetSDKGroupPerson get person group

func (*Service) GetSignNonce

func (service *Service) GetSignNonce(account string) map[string]interface{}

GetSignNonce Get the nonce value of the special transaction of the sign command

func (*Service) GetSignStatus

func (service *Service) GetSignStatus(key string) map[string]interface{}

GetSignStatus Get the result of sign command key: This generates the unique identification value of the sign command

func (*Service) GetSmpcAddr

func (service *Service) GetSmpcAddr(pubkey string) map[string]interface{}

GetSmpcAddr get smpc addrs by pubkey

func (*Service) GetVersion

func (service *Service) GetVersion() map[string]interface{}

GetVersion get gsmpc version

func (*Service) PreGenSignData

func (service *Service) PreGenSignData(raw string) map[string]interface{}

PreGenSignData Generate the relevant data required by the sign command in advance raw tx: data = pubkey + subgids

func (*Service) PreSigning

func (service *Service) PreSigning(rsv string, msg string) map[string]interface{}

PreSigning Generate the relevant data required by the sign command in advance data = pubkey + subgids

func (*Service) ReShare

func (service *Service) ReShare(raw string) map[string]interface{}

ReShare do reshare

func (*Service) ReSharing

func (service *Service) ReSharing(rsv string, msg string) map[string]interface{}

ReSharing do reshare

func (*Service) ReqKeyGen

func (service *Service) ReqKeyGen(rsv string, msg string) map[string]interface{}

ReqKeyGen this will be called by smpc_reqKeyGen msg: a json string,such as : { "Account":xxx, "Nonce":xxx, } return pubkey and coins addr

func (*Service) ReqSmpcAddr

func (service *Service) ReqSmpcAddr(raw string) map[string]interface{}

ReqSmpcAddr this will be called by smpc_reqSmpcAddr raw: tx raw data return pubkey and coins addr

func (*Service) ReshareGroup

func (service *Service) ReshareGroup(threshold string, enodes []string) map[string]interface{}

ReshareGroup create reshare group

func (*Service) SendToGroupAllNodes

func (service *Service) SendToGroupAllNodes(gid, msg string) map[string]interface{}

SendToGroupAllNodes send msg to all nodes in group by gid

func (*Service) Sign

func (service *Service) Sign(raw string) map[string]interface{}

Sign Execute the sign command Raw is a special signed transaction. The nonce of the transaction is through SMPC_ Getsignnonce function. The data format is: { "TxType":"SIGN", "PubKey":"XXX", "MsgHash":"XXX", "MsgContext":"XXX", "Keytype":"XXX", "GroupId":"XXX", "ThresHold":"XXX", "Mode":"XXX", "TimeStamp":"XXX" }

func (*Service) Signing

func (service *Service) Signing(rsv string, msg string) map[string]interface{}

Signing Execute the sign command Raw is a special signed transaction. The nonce of the transaction is through SMPC_ Getsignnonce function. The data format is: { "TxType":"SIGN", "Account":"xxx", "Nonce":"xxx", "PubKey":"XXX", "MsgHash":"XXX", "MsgContext":"XXX", "Keytype":"XXX", "GroupId":"XXX", "ThresHold":"XXX", "Mode":"XXX", "TimeStamp":"XXX" }

type Version

type Version struct {
	Version string
	Commit  string
	Date    string
}

Version version info

Jump to

Keyboard shortcuts

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