dcrm

package
v0.0.0-...-e59d3c4 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//err code 1
	ErrEncodeSendMsgFail      = `{Code:1,Error:"encode send msg fail."}`
	ErrParamError             = `{Code:2,Error:"parameters error."}`
	ErrGetOtherNodesDataFail  = `{Code:3,Error:"NetWork Error,Get Data From Other Node Fail."}`
	ErrUnknownChType          = `{Code:4,Error:"unknown channel type."}`
	ErrGetChValueFail         = `{Code:5,Error:"get channel value fail."}`
	ErrNoFindWorker           = `{Code:7,Error:"can not find worker."}`
	ErrGetWorkerIdError       = `{Code:10,Error:"get worker id error."}`
	ErrGetPrexDataError       = `{Code:11,Error:"get msg prefix data error."}`
	ErrSendDataToGroupFail    = `{Code:15,Error:"send data to group fail."}`
	ErrInternalMsgFormatError = `{Code:16,Error:"msg data format error."}`
	ErrGetNoResFromGroupMem   = `{Code:17,Error:"no get any result from other group node."}`
	ErrCoinTypeNotSupported   = `{Code:18,Error:"coin type is not supported."}`
	ErrGroupNotReady          = `{Code:23,Error:"the group is not ready.please try again."}`
	ErrGetGenPubkeyFail       = `{Code:24,Error:"get generate pubkey fail."}`
	ErrGetGenSaveDataFail     = `{Code:25,Error:"get generate save data fail."}`
	ErrCreateDbFail           = `{Code:26,Error:"create db fail."}`
	ErrDcrmSigWrongSize       = `{Code:28,Error:"wrong size for dcrm sig."}`
	ErrDcrmSigFail            = `{Code:29,Error:"dcrm sign fail."}`
	ErrInvalidDcrmAddr        = `{Code:30,Error:"invalid dcrm address."}`
	ErrGetRealEosUserFail     = `{Code:27,Error:"cannot get real eos account."}`
	ErrSendTxToNetFail        = `{Code:14,Error:"send tx to outside net fail."}`
	ErrGetC1Timeout           = `{Code:31,Error:"get C1 timeout."}`
	ErrGetEnodeByUIdFail      = `{Code:32,Error:"can not find proper enodes by uid."}`
	ErrGetD1Timeout           = `{Code:33,Error:"get D1 timeout."}`
	ErrGetSHARE1Timeout       = `{Code:34,Error:"get SHARE1 timeout."}`
	ErrGetAllSHARE1Fail       = `{Code:35,Error:"get all SHARE1 msg fail."}`
	ErrGetAllD1Fail           = `{Code:36,Error:"get all D1 msg fail."}`
	ErrVerifySHARE1Fail       = `{Code:37,Error:"verify SHARE1 fail."}`
	ErrGetAllC1Fail           = `{Code:38,Error:"get all C1 msg fail."}`
	ErrKeyGenVerifyCommitFail = `{Code:39,Error:"verify commit in keygenerate fail."}`
	ErrGetZKFACTPROOFTimeout  = `{Code:40,Error:""get ZKFACTPROOF timeout."}`
	ErrGetZKUPROOFTimeout     = `{Code:41,Error:""get ZKUPROOF timeout."}`
	ErrGetAllZKFACTPROOFFail  = `{Code:42,Error:"get all ZKFACTPROOF msg fail."}`
	ErrVerifyZKFACTPROOFFail  = `{Code:43,Error:"verify ZKFACTPROOF fail."}`
	ErrGetAllZKUPROOFFail     = `{Code:44,Error:"get all ZKUPROOF msg fail."}`
	ErrVerifyZKUPROOFFail     = `{Code:45,Error:"verify ZKUPROOF fail."}`
	ErrGetC11Timeout          = `{Code:46,Error:"get C11 timeout."}`
	ErrGetMTAZK1PROOFTimeout  = `{Code:47,Error:"get MTAZK1PROOF timeout."}`
	ErrGetKCTimeout           = `{Code:48,Error:"get KC timeout."}`
	ErrGetAllKCFail           = `{Code:49,Error:"get all KC msg fail."}`
	ErrGetAllMTAZK1PROOFFail  = `{Code:50,Error:"get all MTAZK1PROOF msg fail."}`
	ErrVerifyMTAZK1PROOFFail  = `{Code:51,Error:"verify MTAZK1PROOF fail.""}`
	ErrGetMKGTimeout          = `{Code:52,Error:"get MKG timeout."}`
	ErrGetAllMKGFail          = `{Code:53,Error:"get all MKG msg fail."}`
	ErrGetMKWTimeout          = `{Code:54,Error:"get MKW timeout."}`
	ErrGetAllMKWFail          = `{Code:55,Error:"get all MKW msg fail."}`
	ErrVerifyMKGFail          = `{Code:56,Error:"verify MKG fail.""}`
	ErrVerifyMKWFail          = `{Code:57,Error:"verify MKW fail.""}`
	ErrGetPaillierPrivKeyFail = `{Code:58,Error:"get paillier privkey fail.""}`
	ErrGetDELTA1Timeout       = `{Code:59,Error:"get DELTA1 timeout."}`
	ErrGetAllDELTA1Fail       = `{Code:60,Error:"get all DELTA1 msg fail."}`
	ErrGetD11Timeout          = `{Code:61,Error:"get D11 timeout."}`
	ErrGetAllD11Fail          = `{Code:62,Error:"get all D11 msg fail."}`
	ErrGetAllC11Fail          = `{Code:63,Error:"get all C11 msg fail."}`
	ErrSignVerifyCommitFail   = `{Code:64,Error:"verify commit in dcrm sign fail."}`
	ErrREqualZero             = `{Code:65,Error:"sign error: r equal zero."}`
	ErrGetS1Timeout           = `{Code:66,Error:"get S1 timeout."}`
	ErrGetAllS1Fail           = `{Code:67,Error:"get all S1 msg fail."}`
	ErrVerifySAllFail         = `{Code:68,Error:"verify SAll != m*G + r*PK in dcrm sign ec2."}`
	ErrGetSS1Timeout          = `{Code:69,Error:"get SS1 timeout."}`
	ErrGetAllSS1Fail          = `{Code:70,Error:"get all SS1 msg fail."}`
	ErrSEqualZero             = `{Code:71,Error:"sign error: s equal zero."}`
	ErrDcrmSignVerifyFail     = `{Code:72,Error:"dcrm sign verify fail."}`
)

dcrm erros

View Source
var (
	LdbPubKeyData  = common.NewSafeMap(10) //make(map[string][]byte)
	PubKeyDataChan = make(chan KeyData, 10000)
	SkU1Chan       = make(chan KeyData, 10000)
)
View Source
var (
	C1Data = common.NewSafeMap(10)

	//callback
	GetGroup               func(string) (int, string)
	SendToGroupAllNodes    func(string, string) (string, error)
	GetSelfEnode           func() string
	BroadcastInGroupOthers func(string, string) (string, error)
	SendToPeer             func(string, string) error
	ParseNode              func(string) string
	GetEosAccount          func() (string, string, string)
)
View Source
var (
	RPCReqQueueCache = make(chan RPCReq, RPCMaxQueue)
	//rpc-req //dcrm node
	RPCMaxWorker = 10000
	RPCMaxQueue  = 10000
	RPCReqQueue  chan RPCReq
)
View Source
var (
	KeyFile string
)
View Source
var (
	PaillierKeyLength = 2048
)

Functions

func AcceptLockOut

func AcceptLockOut(initiator string, account string, groupid string, nonce string, dcrmfrom string, threshold string, deal string, accept string, status string, outhash string, tip string, errinfo string, allreply []NodeReply, workid int) (string, error)

func AcceptReShare

func AcceptReShare(initiator string, account string, groupid string, tsgroupid string, pubkey string, threshold string, mode string, deal string, accept string, status string, newsk string, tip string, errinfo string, allreply []NodeReply, workid int) (string, error)

func AcceptReqAddr

func AcceptReqAddr(initiator string, account string, cointype string, groupid string, nonce string, threshold string, mode string, deal string, accept string, status string, pubkey string, tip string, errinfo string, allreply []NodeReply, workid int, sigs string) (string, error)

func AcceptSign

func AcceptSign(initiator string, account string, pubkey string, msghash []string, keytype string, groupid string, nonce string, threshold string, mode string, deal string, accept string, status string, rsv string, tip string, errinfo string, allreply []NodeReply, workid int) (string, error)

func CalcDelta

func CalcDelta(alpha1 []*big.Int, betaU1 []*big.Int, ch chan interface{}, ThresHold int) *big.Int

func CalcSigma

func CalcSigma(uu1 []*big.Int, vU1 []*big.Int, ch chan interface{}, ThresHold int) *big.Int

func Calc_r

func Calc_r(cointype string, w *RPCReqWorker, idSign sortableIDSSlice, ug map[string][]*big.Int, deltaSum *big.Int, ch chan interface{}) (*big.Int, *big.Int)

func Calc_s

func Calc_s(msgprex string, cointype string, w *RPCReqWorker, idSign sortableIDSSlice, ss1s map[string]*big.Int, ch chan interface{}) *big.Int

func Call

func Call(msg interface{}, enode string)

func Call2

func Call2(msg interface{})

func CheckAcc

func CheckAcc(eid string, geter_acc string, sigs string) bool

func CheckAccept

func CheckAccept(pubkey string, mode string, account string) bool

func CheckGroupEnode

func CheckGroupEnode(gid string) bool

func CheckRaw

func CheckRaw(raw string) (string, string, string, interface{}, error)

func CheckReply

func CheckReply(l *list.List, rt RpcType, key string) bool

func CommitRpcReq

func CommitRpcReq()

func Compress

func Compress(c []byte) (string, error)

//compress

func DECDSAGenKeyCalcPrivKey

func DECDSAGenKeyCalcPrivKey(msgprex string, cointype string, ch chan interface{}, w *RPCReqWorker, sstruct map[string]*ec2.ShareStruct2, ids sortableIDSSlice) (*big.Int, bool)

func DECDSAGenKeyCalcPubKey

func DECDSAGenKeyCalcPubKey(msgprex string, cointype string, ch chan interface{}, w *RPCReqWorker, udecom map[string]*ec2.Commitment, ids sortableIDSSlice) (map[string][]*big.Int, bool)

func DECDSAGenKeyRoundFive

func DECDSAGenKeyRoundFive(msgprex string, ch chan interface{}, w *RPCReqWorker, u1 *big.Int) bool

func DECDSAGenKeyRoundFour

func DECDSAGenKeyRoundFour(msgprex string, ch chan interface{}, w *RPCReqWorker) (*ec2.NtildeH1H2, bool)

func DECDSAGenKeyRoundOne

func DECDSAGenKeyRoundOne(msgprex string, ch chan interface{}, w *RPCReqWorker) (*big.Int, *ec2.PolyStruct2, *ec2.PolyGStruct2, *ec2.Commitment, *ec2.PublicKey, *ec2.PrivateKey, bool)

func DECDSAGenKeyRoundThree

func DECDSAGenKeyRoundThree(msgprex string, cointype string, ch chan interface{}, w *RPCReqWorker, u1PolyG *ec2.PolyGStruct2, commitU1G *ec2.Commitment, ids sortableIDSSlice) bool

func DECDSAGenKeyRoundTwo

func DECDSAGenKeyRoundTwo(msgprex string, cointype string, ch chan interface{}, w *RPCReqWorker, u1Poly *ec2.PolyStruct2, ids sortableIDSSlice) ([]*ec2.ShareStruct2, bool)

func DECDSAGenKeySaveData

func DECDSAGenKeySaveData(cointype string, ids sortableIDSSlice, w *RPCReqWorker, ch chan interface{}, skU1 *big.Int, u1PaillierPk *ec2.PublicKey, u1PaillierSk *ec2.PrivateKey, cs []string, u1NtildeH1H2 *ec2.NtildeH1H2) bool

func DECDSAGenKeyVerifyCommitment

func DECDSAGenKeyVerifyCommitment(msgprex string, cointype string, ch chan interface{}, w *RPCReqWorker, ds []string, commitU1G *ec2.Commitment, ids sortableIDSSlice) ([]string, map[string]*ec2.Commitment, bool)

func DECDSAGenKeyVerifyShareData

func DECDSAGenKeyVerifyShareData(msgprex string, cointype string, ch chan interface{}, w *RPCReqWorker, u1PolyG *ec2.PolyGStruct2, u1Shares []*ec2.ShareStruct2, ids sortableIDSSlice) (map[string]*ec2.ShareStruct2, []string, bool)

func DECDSAGenKeyVerifyZKU

func DECDSAGenKeyVerifyZKU(msgprex string, cointype string, ch chan interface{}, w *RPCReqWorker, ids sortableIDSSlice, ug map[string][]*big.Int) bool

func DECDSASignPaillierEncrypt

func DECDSASignPaillierEncrypt(cointype string, save string, w *RPCReqWorker, idSign sortableIDSSlice, u1K *big.Int, ch chan interface{}) (map[string]*big.Int, map[string]*big.Int, map[string]*ec2.PublicKey)

func DECDSASignRoundEight

func DECDSASignRoundEight(msgprex string, r *big.Int, deltaGammaGy *big.Int, us1 *big.Int, l1 *big.Int, rho1 *big.Int, w *RPCReqWorker, ch chan interface{}, commitBigVAB1 *ec2.Commitment) (*ec2.ZkABProof, []string)

func DECDSASignRoundEleven

func DECDSASignRoundEleven(msgprex string, cointype string, w *RPCReqWorker, idSign sortableIDSSlice, ch chan interface{}, us1 *big.Int) map[string]*big.Int

func DECDSASignRoundFive

func DECDSASignRoundFive(msgprex string, cointype string, delta1 *big.Int, idSign sortableIDSSlice, w *RPCReqWorker, ch chan interface{}) *big.Int

func DECDSASignRoundFour

func DECDSASignRoundFour(msgprex string, cointype string, save string, w *RPCReqWorker, idSign sortableIDSSlice, ukc map[string]*big.Int, ukc3 map[string]*ec2.PublicKey, zkfactproof map[string]*ec2.NtildeH1H2, u1Gamma *big.Int, w1 *big.Int, betaU1Star []*big.Int, vU1Star []*big.Int, ch chan interface{}) (map[string]*big.Int, map[string]*ec2.MtAZK2Proof_nhh, map[string]*big.Int, map[string]*ec2.MtAZK3Proof_nhh, bool)

func DECDSASignRoundNine

func DECDSASignRoundNine(msgprex string, cointype string, w *RPCReqWorker, idSign sortableIDSSlice, mMtA *big.Int, r *big.Int, pkx *big.Int, pky *big.Int, BigVx *big.Int, BigVy *big.Int, rho1 *big.Int, commitbigcom map[string]*ec2.Commitment, l1 *big.Int, ch chan interface{}) ([]string, *ec2.Commitment)

func DECDSASignRoundOne

func DECDSASignRoundOne(msgprex string, w *RPCReqWorker, idSign sortableIDSSlice, ch chan interface{}) (*big.Int, *big.Int, *ec2.Commitment)

func DECDSASignRoundSeven

func DECDSASignRoundSeven(msgprex string, r *big.Int, deltaGammaGy *big.Int, us1 *big.Int, w *RPCReqWorker, ch chan interface{}) (*ec2.Commitment, []string, *big.Int, *big.Int)

func DECDSASignRoundSix

func DECDSASignRoundSix(msgprex string, u1Gamma *big.Int, commitU1GammaG *ec2.Commitment, w *RPCReqWorker, ch chan interface{}) *ec2.ZkUProof

func DECDSASignRoundTen

func DECDSASignRoundTen(msgprex string, commitBigUT1 *ec2.Commitment, w *RPCReqWorker, ch chan interface{}) []string

func DECDSASignRoundThree

func DECDSASignRoundThree(msgprex string, cointype string, save string, w *RPCReqWorker, idSign sortableIDSSlice, ch chan interface{}, ukc map[string]*big.Int) bool

func DECDSASignRoundTwo

func DECDSASignRoundTwo(msgprex string, cointype string, save string, w *RPCReqWorker, idSign sortableIDSSlice, ch chan interface{}, u1K *big.Int, ukc2 map[string]*big.Int, ukc3 map[string]*ec2.PublicKey) (map[string]*ec2.MtAZK1Proof_nhh, map[string]*ec2.NtildeH1H2)

func DECDSASignVerifyBigUTCommitment

func DECDSASignVerifyBigUTCommitment(msgprex string, cointype string, commitbiguts []string, commitbigutd11s []string, commitBigUT1 *ec2.Commitment, w *RPCReqWorker, idSign sortableIDSSlice, ch chan interface{}, commitbigcom map[string]*ec2.Commitment) bool

func DECDSASignVerifyBigVAB

func DECDSASignVerifyBigVAB(cointype string, w *RPCReqWorker, commitbigvabs []string, zkabproofs []string, commitBigVAB1 *ec2.Commitment, u1zkABProof *ec2.ZkABProof, idSign sortableIDSSlice, r *big.Int, deltaGammaGy *big.Int, ch chan interface{}) (map[string]*ec2.Commitment, *big.Int, *big.Int)

func DECDSASignVerifyCommitment

func DECDSASignVerifyCommitment(cointype string, w *RPCReqWorker, idSign sortableIDSSlice, commitU1GammaG *ec2.Commitment, u1GammaZKProof *ec2.ZkUProof, ch chan interface{}) map[string][]*big.Int

func DECDSASignVerifyZKGammaW

func DECDSASignVerifyZKGammaW(msgprex string, cointype string, save string, w *RPCReqWorker, idSign sortableIDSSlice, ukc map[string]*big.Int, ukc3 map[string]*ec2.PublicKey, zkfactproof map[string]*ec2.NtildeH1H2, mkg map[string]*big.Int, mkg_mtazk2 map[string]*ec2.MtAZK2Proof_nhh, mkw map[string]*big.Int, mkw_mtazk2 map[string]*ec2.MtAZK3Proof_nhh, ch chan interface{}) bool

func DECDSASignVerifyZKNtilde

func DECDSASignVerifyZKNtilde(msgprex string, cointype string, save string, w *RPCReqWorker, idSign sortableIDSSlice, ch chan interface{}, ukc map[string]*big.Int, ukc3 map[string]*ec2.PublicKey, zk1proof map[string]*ec2.MtAZK1Proof_nhh, zkfactproof map[string]*ec2.NtildeH1H2) bool

func DECDSA_Sign_Verify_RSV

func DECDSA_Sign_Verify_RSV(r *big.Int, s *big.Int, v int32, message string, pkx *big.Int, pky *big.Int) bool

func Decode2

func Decode2(s string, datatype string) (interface{}, error)

func DecryptCkGamma

func DecryptCkGamma(cointype string, idSign sortableIDSSlice, w *RPCReqWorker, u1PaillierSk *ec2.PrivateKey, mkg map[string]*big.Int, ch chan interface{}) []*big.Int

func DecryptCkW

func DecryptCkW(cointype string, idSign sortableIDSSlice, w *RPCReqWorker, u1PaillierSk *ec2.PrivateKey, mkw map[string]*big.Int, ch chan interface{}) []*big.Int

func DecryptMsg

func DecryptMsg(cm string) (string, error)

func DisAcceptMsg

func DisAcceptMsg(raw string, workid int)

func DisMsg

func DisMsg(msg string)

msg: key-enode:C1:X1:X2...:Xn msg: key-enode1:NoReciv:enode2:C1

func DoubleHash

func DoubleHash(id string, cointype string) *big.Int

func DoubleHash2

func DoubleHash2(id string, keytype string) *big.Int

func EdVerify

func EdVerify(input InputVerify) bool

func Encode2

func Encode2(obj interface{}) (string, error)

func EncryptMsg

func EncryptMsg(msg string, enodeID string) (string, error)

/

func ExsitPubKey

func ExsitPubKey(account string, cointype string) (string, bool)

func Find

func Find(l *list.List, msg string) bool

func GenRandomSafePrime

func GenRandomSafePrime(length int)

func GetAcceptLockOutDir

func GetAcceptLockOutDir() string

func GetAcceptReqAddrDir

func GetAcceptReqAddrDir() string

func GetAccounts

func GetAccounts(geter_acc, mode string) (interface{}, string, error)

func GetAccountsBalance

func GetAccountsBalance(pubkey string, geter_acc string) (interface{}, string, error)

func GetAddr

func GetAddr(pubkey string, cointype string) (string, string, error)

func GetAllAccountsDir

func GetAllAccountsDir() string

func GetAllPubKeyDataFromDb

func GetAllPubKeyDataFromDb() *common.SafeMap

func GetBalance

func GetBalance(account string, cointype string, dcrmaddr string) (string, string, error)

func GetChannelValue

func GetChannelValue(t int, obj interface{}) (string, string, error)

func GetDbDir

func GetDbDir() string

func GetDcrmAddr

func GetDcrmAddr(pubkey string) (string, string, error)

func GetEnodesByUid

func GetEnodesByUid(uid *big.Int, cointype string, groupid string) string

func GetGAccsDir

func GetGAccsDir() string

func GetGroupDir

func GetGroupDir() string

func GetGroupIdByEnode

func GetGroupIdByEnode(enode string) string

func GetGroupSigsDataByRaw

func GetGroupSigsDataByRaw(raw string) (string, error)

func GetIds

func GetIds(cointype string, groupid string) sortableIDSSlice

func GetIds2

func GetIds2(keytype string, groupid string) sortableIDSSlice

func GetLockOutNonce

func GetLockOutNonce(account string) (string, string, error)

func GetLockOutStatus

func GetLockOutStatus(key string) (string, string, error)

func GetPaillierPk2

func GetPaillierPk2(cointype string, w *RPCReqWorker, uid *big.Int) *ec2.PublicKey

func GetPubKeyData

func GetPubKeyData(key string, account string, cointype string) (string, string, error)

func GetPubKeyDataFromLocalDb

func GetPubKeyDataFromLocalDb(key string) (bool, interface{})

func GetPubKeyDataValueFromDb

func GetPubKeyDataValueFromDb(key string) []byte

func GetRawReply

func GetRawReply(l *list.List) map[string]*RawReply

func GetReShareNonce

func GetReShareNonce(account string) (string, string, error)

func GetReShareStatus

func GetReShareStatus(key string) (string, string, error)

func GetRealByUid

func GetRealByUid(cointype string, w *RPCReqWorker, uid *big.Int) int

func GetRealByUid2

func GetRealByUid2(keytype string, w *RPCReqWorker, uid *big.Int) int

func GetReqAddrKeyByOtherKey

func GetReqAddrKeyByOtherKey(key string, rt RpcType) string

func GetReqAddrNonce

func GetReqAddrNonce(account string) (string, string, error)

func GetReqAddrStatus

func GetReqAddrStatus(key string) (string, string, error)

func GetRetErr

func GetRetErr(err string) error

func GetRetErrJsonStr

func GetRetErrJsonStr(code int, err string) string

func GetSelfPrivKey

func GetSelfPrivKey(cointype string, idSign sortableIDSSlice, w *RPCReqWorker, save string, ch chan interface{}) *ec2.PrivateKey

func GetSignNonce

func GetSignNonce(account string) (string, string, error)

func GetSignStatus

func GetSignStatus(key string) (string, string, error)

func GetSignString

func GetSignString(r *big.Int, s *big.Int, v int32, i int) string

func GetSkU1Dir

func GetSkU1Dir() string

func GetSkU1FromLocalDb

func GetSkU1FromLocalDb(key string) []byte

func GetValueFromPubKeyData

func GetValueFromPubKeyData(key string) (bool, interface{})

func GetWorkerId

func GetWorkerId(w *RPCReqWorker) (int, error)

func HandleC1Data

func HandleC1Data(ac *AcceptReqAddrData, key string, workid int)

func HandleNoReciv

func HandleNoReciv(key string, reqer string, ower string, datatype string, wid int)

func Init

func Init(groupId string)

func InitAcceptData

func InitAcceptData(raw string, workid int, sender string, ch chan interface{}) error

func InitChan

func InitChan()

workers,RpcMaxWorker,RpcReqWorker,RpcReqQueue,RpcMaxQueue,ReqDispatcher

func InitDev

func InitDev(keyfile string)

func InitGroupInfo

func InitGroupInfo(groupId string)

func IsCurNode

func IsCurNode(enodes string, cur string) bool

func IsInGroup

func IsInGroup(enode string, groupId string) bool

func IsValidReShareAccept

func IsValidReShareAccept(from string, gid string) bool

func KeyGenerate_DECDSA

func KeyGenerate_DECDSA(msgprex string, ch chan interface{}, id int, cointype string) bool

ec2 msgprex = hash

func KeyGenerate_ed

func KeyGenerate_ed(msgprex string, ch chan interface{}, id int, cointype string) bool

ed msgprex = hash

func LockOut

func LockOut(raw string) (string, string, error)

func MapPrivKeyShare

func MapPrivKeyShare(cointype string, w *RPCReqWorker, idSign sortableIDSSlice, privshare string) (*big.Int, *big.Int)

func PutGroup

func PutGroup(groupId string) bool

func ReShare

func ReShare(raw string) (string, string, error)

func ReShare_ec2

func ReShare_ec2(msgprex string, initator string, groupid string, pubkey string, account string, mode string, sigs string, ch chan interface{}, id int)

msgprex = hash return value is the backup for the dcrm sig

func RegDcrmGetEosAccountCallBack

func RegDcrmGetEosAccountCallBack(f func() (string, string, string))

func RegP2pBroadcastInGroupOthersCallBack

func RegP2pBroadcastInGroupOthersCallBack(f func(string, string) (string, error))

func RegP2pGetGroupCallBack

func RegP2pGetGroupCallBack(f func(string) (int, string))

p2p callback

func RegP2pGetSelfEnodeCallBack

func RegP2pGetSelfEnodeCallBack(f func() string)

func RegP2pParseNodeCallBack

func RegP2pParseNodeCallBack(f func(string) string)

func RegP2pSendMsgToPeerCallBack

func RegP2pSendMsgToPeerCallBack(f func(string, string) error)

func RegP2pSendToGroupAllNodesCallBack

func RegP2pSendToGroupAllNodesCallBack(f func(string, string) (string, error))

func ReqDataFromGroup

func ReqDataFromGroup(msgprex string, wid int, datatype string, trytimes int, timeout int) bool

func ReqDcrmAddr

func ReqDcrmAddr(raw string) (string, string, error)

func RpcAcceptLockOut

func RpcAcceptLockOut(raw string) (string, string, error)

func RpcAcceptReShare

func RpcAcceptReShare(raw string) (string, string, error)

func RpcAcceptReqAddr

func RpcAcceptReqAddr(raw string) (string, string, error)

func RpcAcceptSign

func RpcAcceptSign(raw string) (string, string, error)

func SaveAcceptLockOutData

func SaveAcceptLockOutData(ac *AcceptLockOutData) error

func SaveAcceptReShareData

func SaveAcceptReShareData(ac *AcceptReShareData) error

func SaveAcceptReqAddrData

func SaveAcceptReqAddrData(ac *AcceptReqAddrData) error

func SaveAcceptSignData

func SaveAcceptSignData(ac *AcceptSignData) error

func SavePubKeyDataToDb

func SavePubKeyDataToDb()

func SaveSkU1ToDb

func SaveSkU1ToDb()

func SendMsgToDcrmGroup

func SendMsgToDcrmGroup(msg string, groupid string)

func SendMsgToPeer

func SendMsgToPeer(enodes string, msg string)

/

func SetLockOutNonce

func SetLockOutNonce(account string, nonce string) (string, error)

func SetReShareNonce

func SetReShareNonce(account string, nonce string) (string, error)

func SetReqAddrNonce

func SetReqAddrNonce(account string, nonce string) (string, error)

func SetSignNonce

func SetSignNonce(account string, nonce string) (string, error)

func SetUpMsgList

func SetUpMsgList(msg string, enode string)

func SetUpMsgList2

func SetUpMsgList2(msg string)

func SetUpMsgList3

func SetUpMsgList3(msg string, enode string, rch chan interface{})

func Sign

func Sign(raw string) (string, string, error)

func Sign_ec2

func Sign_ec2(msgprex string, save string, sku1 *big.Int, message string, cointype string, pkx *big.Int, pky *big.Int, ch chan interface{}, id int) string

msgprex = hash return value is the backup for the dcrm sig

func Sign_ed

func Sign_ed(msgprex string, save string, sku1 *big.Int, message string, cointype string, pk string, ch chan interface{}, id int) string

msgprex = hash return value is the backup for the dcrm sig

func SortCurNodeInfo

func SortCurNodeInfo(value []interface{}) []interface{}

func Start

func Start(waitmsg uint64)

func Tool_DecimalByteSlice2HexString

func Tool_DecimalByteSlice2HexString(DecimalSlice []byte) string

func UnCompress

func UnCompress(s string) (string, error)

//uncompress

Types

type AcceptLockOutData

type AcceptLockOutData struct {
	Initiator string //enode
	Account   string
	GroupId   string
	Nonce     string
	PubKey    string
	DcrmTo    string
	Value     string
	Cointype  string
	LimitNum  string
	Mode      string
	TimeStamp string

	Deal   string
	Accept string

	Status    string
	OutTxHash string
	Tip       string
	Error     string

	AllReply []NodeReply
	WorkId   int
}

type AcceptReShareData

type AcceptReShareData struct {
	Initiator  string //enode
	Account    string
	GroupId    string
	TSGroupId  string
	PubKey     string
	LimitNum   string
	PubAccount string
	Mode       string
	Sigs       string
	TimeStamp  string

	Deal   string
	Accept string

	Status string
	NewSk  string //TODO
	Tip    string
	Error  string

	AllReply []NodeReply
	WorkId   int
}

type AcceptReqAddrData

type AcceptReqAddrData struct {
	Initiator string //enode
	Account   string
	Cointype  string
	GroupId   string
	Nonce     string
	LimitNum  string
	Mode      string
	TimeStamp string

	Deal   string
	Accept string

	Status string
	PubKey string
	Tip    string
	Error  string

	AllReply []NodeReply

	WorkId int

	Sigs string //5:eid1:acc1:eid2:acc2:eid3:acc3:eid4:acc4:eid5:acc5
}

type AcceptSignData

type AcceptSignData struct {
	Initiator  string //enode
	Account    string
	GroupId    string
	Nonce      string
	PubKey     string
	MsgHash    []string
	MsgContext []string
	Keytype    string
	LimitNum   string
	Mode       string
	TimeStamp  string

	Deal   string
	Accept string

	Status string
	Rsv    string //rsv1:rsv2:....:rsvn:NULL
	Tip    string
	Error  string

	AllReply []NodeReply
	WorkId   int
}

type AccountsList

type AccountsList struct {
	GroupID  string
	Accounts []PubKeyInfo
}

type DcrmAccountsBalanceRes

type DcrmAccountsBalanceRes struct {
	PubKey   string
	Balances []SubAddressBalance
}

type DcrmAddrRes

type DcrmAddrRes struct {
	Account  string
	PubKey   string
	DcrmAddr string
	Cointype string
}

type DcrmHash

type DcrmHash [32]byte

func Keccak256Hash

func Keccak256Hash(data ...[]byte) (h DcrmHash)

Keccak256Hash calculates and returns the Keccak256 hash of the input data, converting it to an internal Hash data structure.

func (DcrmHash) Hex

func (h DcrmHash) Hex() string

type DcrmPubkeyRes

type DcrmPubkeyRes struct {
	Account     string
	PubKey      string
	DcrmAddress map[string]string
}

type DecdsaLog

type DecdsaLog struct {
	CurEnode       string //enodeid:ip:port
	GroupEnodes    []string
	DcrmCallTime   string
	RecivAcceptRes []RecivAcceptResTime
	SendAcceptRes  []SendAcceptResTime
	RecivDcrm      []RecivDcrmTime
	SendDcrm       []SendDcrmTime
	FailTime       string
	FailInfo       string
	No_Reciv       []NoRecivData
}

type ECDSASignature

type ECDSASignature struct {
	// contains filtered or unexported fields
}

func (*ECDSASignature) GetR

func (this *ECDSASignature) GetR() *big.Int

func (*ECDSASignature) GetRecoveryParam

func (this *ECDSASignature) GetRecoveryParam() int32

func (*ECDSASignature) GetRoudFiveAborted

func (this *ECDSASignature) GetRoudFiveAborted() bool

func (*ECDSASignature) GetS

func (this *ECDSASignature) GetS() *big.Int

func (*ECDSASignature) New

func (this *ECDSASignature) New()

func (*ECDSASignature) New2

func (this *ECDSASignature) New2(r *big.Int, s *big.Int)

func (*ECDSASignature) New3

func (this *ECDSASignature) New3(r *big.Int, s *big.Int, recoveryParam int32)

func (*ECDSASignature) SetR

func (this *ECDSASignature) SetR(r *big.Int)

func (*ECDSASignature) SetRecoveryParam

func (this *ECDSASignature) SetRecoveryParam(recoveryParam int32)

func (*ECDSASignature) SetRoudFiveAborted

func (this *ECDSASignature) SetRoudFiveAborted(roudFiveAborted bool)

func (*ECDSASignature) SetS

func (this *ECDSASignature) SetS(s *big.Int)

type EnAcc

type EnAcc struct {
	Enode    string
	Accounts []string
}

type EnAccs

type EnAccs struct {
	EnodeAccounts []EnAcc
}

type Err

type Err struct {
	Info string
}

error type 1

func (Err) Error

func (e Err) Error() string

type ErrorRet

type ErrorRet struct {
	Code  int
	Error string
}

type InputVerify

type InputVerify struct {
	FinalR  [32]byte
	FinalS  [32]byte
	Message []byte
	FinalPk [32]byte
}

type KeyData

type KeyData struct {
	Key  []byte
	Data string
}

type LockOutCurNodeInfo

type LockOutCurNodeInfo struct {
	Key       string
	Account   string
	GroupId   string
	Nonce     string
	DcrmFrom  string
	DcrmTo    string
	Value     string
	Cointype  string
	ThresHold string
	Mode      string
	TimeStamp string
}

func GetCurNodeLockOutInfo

func GetCurNodeLockOutInfo(geter_acc string) ([]*LockOutCurNodeInfo, string, error)

type LockOutReply

type LockOutReply struct {
	Enode string
	Reply string
}

type LockOutReplys

type LockOutReplys struct {
	Replys []LockOutReply
}

type LockOutStatus

type LockOutStatus struct {
	Status    string
	OutTxHash string
	Tip       string
	Error     string
	AllReply  []NodeReply
	TimeStamp string
}

type NoRecivData

type NoRecivData struct {
	Node string
	Msg  string
}

type NodeReply

type NodeReply struct {
	Enode     string
	Status    string
	TimeStamp string
	Initiator string // "1"/"0"
}

func GetAllReplyFromGroup

func GetAllReplyFromGroup(wid int, gid string, rt RpcType, initiator string) []NodeReply

type PubAccounts

type PubAccounts struct {
	Group []AccountsList
}

type PubKeyData

type PubKeyData struct {
	Key            string
	Account        string
	Pub            string
	Save           string
	Nonce          string
	GroupId        string
	LimitNum       string
	Mode           string
	KeyGenTime     string
	RefReShareKeys string //key1:key2...
}

type PubKeyInfo

type PubKeyInfo struct {
	PubKey    string
	ThresHold string
	TimeStamp string
}

type RPCReq

type RPCReq struct {
	// contains filtered or unexported fields
}

type RPCReqWorker

type RPCReqWorker struct {
	RPCReqWorkerPool chan chan RPCReq
	RPCReqChannel    chan RPCReq

	DcrmFrom  string
	NodeCnt   int
	ThresHold int
	// contains filtered or unexported fields
}

func FindWorker

func FindWorker(sid string) (*RPCReqWorker, error)

func NewRPCReqWorker

func NewRPCReqWorker(workerPool chan chan RPCReq) *RPCReqWorker

func (*RPCReqWorker) Clear

func (w *RPCReqWorker) Clear()

func (*RPCReqWorker) Clear2

func (w *RPCReqWorker) Clear2()

func (*RPCReqWorker) Start

func (w *RPCReqWorker) Start()

func (*RPCReqWorker) Stop

func (w *RPCReqWorker) Stop()

type RawReply

type RawReply struct {
	From      string
	Accept    string
	TimeStamp string
}

type ReShareCurNodeInfo

type ReShareCurNodeInfo struct {
	Key       string
	PubKey    string
	GroupId   string
	TSGroupId string
	ThresHold string
	Account   string
	Mode      string
	TimeStamp string
}

func GetCurNodeReShareInfo

func GetCurNodeReShareInfo() ([]*ReShareCurNodeInfo, string, error)

type ReShareStatus

type ReShareStatus struct {
	Status    string
	Pubkey    string
	Tip       string
	Error     string
	AllReply  []NodeReply
	TimeStamp string
}

type RecivAcceptResTime

type RecivAcceptResTime struct {
	RecivTime string
	Reply     string
}

type RecivDcrmTime

type RecivDcrmTime struct {
	Round     string
	RecivTime string
	Msg       string
}

type RecvMsg

type RecvMsg struct {
	// contains filtered or unexported fields
}

RecvMsg

func (*RecvMsg) Run

func (self *RecvMsg) Run(workid int, ch chan interface{}) bool

type ReqAddrReply

type ReqAddrReply struct {
	Key       string
	Account   string
	Cointype  string
	GroupId   string
	Nonce     string
	ThresHold string
	Mode      string
	TimeStamp string
}

func GetCurNodeReqAddrInfo

func GetCurNodeReqAddrInfo(geter_acc string) ([]*ReqAddrReply, string, error)

type ReqAddrStatus

type ReqAddrStatus struct {
	Status    string
	PubKey    string
	Tip       string
	Error     string
	AllReply  []NodeReply
	TimeStamp string
}

type ReqDispatcher

type ReqDispatcher struct {
	// A pool of workers channels that are registered with the dispatcher
	WorkerPool chan chan RPCReq
}

rpc-req

func NewReqDispatcher

func NewReqDispatcher(maxWorkers int) *ReqDispatcher

func (*ReqDispatcher) Run

func (d *ReqDispatcher) Run()

type RpcDcrmRes

type RpcDcrmRes struct {
	Ret string
	Tip string
	Err error
}

type RpcType

type RpcType int32
const (
	Rpc_REQADDR RpcType = 0
	Rpc_LOCKOUT RpcType = 1
	Rpc_SIGN    RpcType = 2
	Rpc_RESHARE RpcType = 3
)

type SendAcceptResTime

type SendAcceptResTime struct {
	SendTime string
	Reply    string
}

type SendDcrmTime

type SendDcrmTime struct {
	Round    string
	SendTime string
	Msg      string
}

type SendMsg

type SendMsg struct {
	MsgType string
	Nonce   string
	WorkId  int
	Msg     string
}

type SignCurNodeInfo

type SignCurNodeInfo struct {
	Key        string
	Account    string
	PubKey     string
	MsgHash    []string
	MsgContext []string
	KeyType    string
	GroupId    string
	Nonce      string
	ThresHold  string
	Mode       string
	TimeStamp  string
}

func GetCurNodeSignInfo

func GetCurNodeSignInfo(geter_acc string) ([]*SignCurNodeInfo, string, error)

type SignData

type SignData struct {
	MsgPrex   string
	Key       string
	Save      string
	Sku1      *big.Int
	Txhash    string
	GroupId   string
	NodeCnt   int
	ThresHold int
	DcrmFrom  string
	Keytype   string
	Cointype  string
	Pkx       *big.Int
	Pky       *big.Int
}

type SignStatus

type SignStatus struct {
	Status    string
	Rsv       []string
	Tip       string
	Error     string
	AllReply  []NodeReply
	TimeStamp string
}

type SubAddressBalance

type SubAddressBalance struct {
	Cointype string
	DcrmAddr string
	Balance  string
}

type TxDataAcceptLockOut

type TxDataAcceptLockOut struct {
	TxType    string
	Key       string
	DcrmTo    string
	Value     string
	Cointype  string
	Mode      string
	Accept    string
	TimeStamp string
}

type TxDataAcceptReShare

type TxDataAcceptReShare struct {
	TxType    string
	Key       string
	Accept    string
	TimeStamp string
}

type TxDataAcceptReqAddr

type TxDataAcceptReqAddr struct {
	TxType    string
	Key       string
	Accept    string
	TimeStamp string
}

type TxDataAcceptSign

type TxDataAcceptSign struct {
	TxType     string
	Key        string
	MsgHash    []string
	MsgContext []string
	Accept     string
	TimeStamp  string
}

type TxDataLockOut

type TxDataLockOut struct {
	TxType    string
	DcrmAddr  string
	DcrmTo    string
	Value     string
	Cointype  string
	GroupId   string
	ThresHold string
	Mode      string
	TimeStamp string
	Memo      string
}

type TxDataReShare

type TxDataReShare struct {
	TxType    string
	PubKey    string
	GroupId   string
	TSGroupId string
	ThresHold string
	Account   string
	Mode      string
	Sigs      string
	TimeStamp string
}

type TxDataReqAddr

type TxDataReqAddr struct {
	TxType    string
	GroupId   string
	ThresHold string
	Mode      string
	TimeStamp string
	Sigs      string
}

type TxDataSign

type TxDataSign struct {
	TxType     string
	PubKey     string
	MsgHash    []string
	MsgContext []string
	Keytype    string
	GroupId    string
	ThresHold  string
	Mode       string
	TimeStamp  string
}

type WorkReq

type WorkReq interface {
	Run(workid int, ch chan interface{}) bool
}

Jump to

Keyboard shortcuts

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