Documentation
¶
Overview ¶
Package helpers provides convenience functions to simplify wallet code. This package is intended for internal wallet use only.
Copyright (c) 2016 The btcsuite developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Index ¶
- Constants
- Variables
- func AccountManager() *accounts.Manager
- func Base58Decode(bitcoin_net int, input []byte) []byte
- func Btc_createTransaction(msgprex string, dcrmaddr string, toAddr string, changeAddress string, ...) string
- func CanDoMatch() bool
- func ChainDb() ethdb.Database
- func CheckRealEosAccount(accountName, ownerkey, activekey string) (ok bool)
- func ChooseDcrmAddrForLockoutByValue(dcrmaddr string, lockoutto string, value float64) bool
- func ChooseRealFusionAccountForLockout(amount string, lockoutto string, cointype string) (string, string, error)
- func Coinbase() (eb common.Address, err error)
- func Compress(c []byte) (string, error)
- func CreateRealEosAccount(accountName string, ownerkey string, activekey string) error
- func Dcrm_LiLoReqAddress(wr WorkReq) (string, error)
- func Dcrm_Sign(wr WorkReq) (string, error)
- func Decode(s string) (interface{}, error)
- func DecryptSplitPrivKey(cDPrivKey string, enodeID string) (dPrivKey *big.Int, err error)
- func DefaultDataDir() string
- func DisMsg(msg string)
- func DispenseSplitPrivKey(enode interface{})
- func DoCurlRequest(url, api, data string) string
- func DoubleHash(id string) *big.Int
- func Encode(obj interface{}) (string, error)
- func EncryptSplitPrivKey(dPrivKey *big.Int, pub *ecies.PublicKey) (cDPrivKey string, err error)
- func Erc20_newUnsignedTransaction(client *ethclient.Client, dcrmAddress string, toAddressHex string, ...) (*types.Transaction, *common.Hash, error)
- func Erc20_sendTx(client *ethclient.Client, signedTx *types.Transaction) (string, error)
- func EstimateSerializeSize(inputCount int, txOuts []*wire.TxOut, addChangeOutput bool) int
- func EstimateVirtualSize(numP2PKHIns, numP2WPKHIns, numNestedP2WPKHIns int, txOuts []*wire.TxOut, ...) int
- func GenerateBTC() (string, string, error)
- func GenerateBTCTest(pubkey []byte) (string, string, error)
- func GetAllMatchRes(res string) ([]string, error)
- func GetBTCTxFee(lockoutto string, value float64) (*big.Int, error)
- func GetChannelValue(t int, obj interface{}) (string, error)
- func GetDbDir() string
- func GetDbDirForLockoutInfo() string
- func GetDbDirForLockoutRealFee() string
- func GetDbDirForLockoutStatus() string
- func GetDbDirForWriteDcrmAddr() string
- func GetDcrmAddr(dcrmaddr string, cointype string, coin string) string
- func GetDcrmAddrBalanceForLockout(dcrmaddr string, lockoutto string, value float64) (*big.Int, bool)
- func GetDcrmAddrOutSideBalance(dcrmaddr string, cointype string) *big.Int
- func GetEnodePrivKey(enodeID string) (prv *ecies.PrivateKey, err error)
- func GetEnodesByUid(uid *big.Int) string
- func GetEnodesInfo()
- func GetEosAccount() (acct, owner, active string)
- func GetEosDbDir() string
- func GetIds() sortableIDSSlice
- func GetLockoutConfirmations(txhash string) (bool, error)
- func GetLockoutInfoFromLocalDB(hash string) (string, error)
- func GetLockoutRealFeeFromLocalDB(hash string) (string, error)
- func GetLockoutTxStatusFromLocalDB(hash string) (string, error)
- func GetPaillierPk(save string, index int) *paillier.PublicKey
- func GetPaillierSk(save string, index int) *paillier.PrivateKey
- func GetRawTransactionHash(decode string) string
- func GetRetErr(err string) error
- func GetRetErrJsonStr(code int, err string) string
- func GetSignString(r *big.Int, s *big.Int, v int32, i int) string
- func GetTxOutsAmount(lockoutto string, value float64) *big.Int
- func GetTxStatus(hash string) string
- func GetUTXO_BlockChainInfo(addr string) string
- func GetZkFactProof(save string, index int) *paillier.ZkFactProof
- func HashPubKey(pubKey []byte) []byte
- func ImportAddrToWallet(dcrmaddr string, ch chan bool)
- func Init(tmp string, c string, nodecnt int)
- func InitChan()
- func InitNonDcrmChan()
- func InsToOB(msg string)
- func IsCurNode(enodes string, cur string) bool
- func IsFusionAccountExsitDcrmAddr(fusion string, cointype string, dcrmaddr string) (bool, string, error)
- func IsInGroup() bool
- func IsInXvcGroup() bool
- func IsOrderBalanceOk(from string, trade string, side string, price decimal.Decimal, ...) (bool, error)
- func IsValidDcrmAddr(s string, cointype string) bool
- func IsValidFusionAddr(s string) bool
- func KeyGenerate_ec2(msgprex string, ch chan interface{}, id int) bool
- func LockoutIsConfirmed(addr string, txhash string) (bool, error)
- func MakeSignedTransaction(client *ethclient.Client, tx *types.Transaction, rsv string) (*types.Transaction, error)
- func MergeDcrmBalance(account string, from string, to string, value *big.Int, cointype string)
- func MergeDcrmBalance2(account string, from string, to string, value *big.Int, cointype string, ...)
- func NewClient(host string, port int, user, passwd string, useSSL bool) (c *rpcClient, err error)
- func ReadDcrmAddrFromLocalDBByIndex(fusion string, cointype string, index int) (string, error)
- func RegisterCheckOrderBalanceCB(...)
- func RegisterGetDcrmAddrCallback(recvObFunc func(string, string, string) string)
- func RegisterGetMatchResCallback(recvObFunc func(string, chan interface{}))
- func RegisterObCallback(recvObFunc func(string, chan interface{}))
- func RegisterObCallback2(recvObFunc func(string))
- func RegisterTXCallback(recvObFunc func(string, string) *big.Int)
- func SendMsgToDcrmGroup(msg string)
- func SendMsgToPeer(enodes string, msg string)
- func SendReqToGroup(msg string, rpctype string) (string, error)
- func SetBackend(e Backend)
- func SetDatadir(data string)
- func SetTxStatus(hash string, status string)
- func SetUpMsgList(msg string)
- func Sign_ec2(msgprex string, save string, message string, tokenType string, pkx *big.Int, ...) string
- func SumOutputSerializeSizes(outputs []*wire.TxOut) (serializeSize int)
- func SumOutputValues(outputs []*wire.TxOut) (totalOutput btcutil.Amount)
- func ToWIF(priv []byte) (wif string)
- func Tool_DecimalByteSlice2HexString(DecimalSlice []byte) string
- func UnCompress(s string) (string, error)
- func ValidateAddress(bitcoin_net int, address string) bool
- func Validate_Txhash(wr WorkReq) (string, error)
- func Verify(r *big.Int, s *big.Int, v int32, message string, pkx *big.Int, pky *big.Int) bool
- func Verify2(r *big.Int, s *big.Int, v int32, message string, pkx *big.Int, pky *big.Int) bool
- func WriteDcrmAddrToLocalDB(fusion string, cointype string, dcrmaddr string) (bool, error)
- func WriteLockoutInfoToLocalDB(hash string, value string) (bool, error)
- func WriteLockoutRealFeeToLocalDB(hash string, value string) (bool, error)
- func WriteLockoutTxStatusToLocalDB(hash string, value string) (bool, error)
- type AccountInfo
- type AccountListInfo
- type AccountListJson
- type AddrApiResult
- type Auth
- type AuthoredTx
- type Backend
- type BtcTxResInfo
- type BtcTxResInfoNoInputs
- type ConfirmAddrSendMsgToDcrm
- type DcrmAddrInfo
- type DcrmAddrInfoWrapper
- type DcrmAddrRes
- type DcrmChain
- type DcrmPubkeyRes
- type ECDSASignature
- func (this *ECDSASignature) GetR() *big.Int
- func (this *ECDSASignature) GetRecoveryParam() int32
- func (this *ECDSASignature) GetRoudFiveAborted() bool
- func (this *ECDSASignature) GetS() *big.Int
- func (this *ECDSASignature) New()
- func (this *ECDSASignature) New2(r *big.Int, s *big.Int)
- func (this *ECDSASignature) New3(r *big.Int, s *big.Int, recoveryParam int32)
- func (this *ECDSASignature) SetR(r *big.Int)
- func (this *ECDSASignature) SetRecoveryParam(recoveryParam int32)
- func (this *ECDSASignature) SetRoudFiveAborted(roudFiveAborted bool)
- func (this *ECDSASignature) SetS(s *big.Int)
- type Err
- type ErrorRet
- type GetAllMatchResSendMsgToXvc
- type GetDcrmGroupCountSendMsgToXvc
- type GetMatchResSendMsgToXvc
- type GetTransactionResult
- type GetTransactionResultNoInputs
- type KVData
- type Key
- type Limit
- type ListUTXO
- type ListUTXOs
- type LockInSendMsgToDcrm
- type LockoutGetRealAccount
- type LockoutSendMsgToDcrm
- type OrderCreateSendMsgToXvc
- type Output
- type Permission
- type Permissions
- type RPCTransaction
- type RecvMsg
- type ReqAddrSendMsgToDcrm
- type ReqDispatcher
- type ReqNonDcrmDispatcher
- type RpcDcrmRes
- type RpcReq
- type RpcReqNonDcrmWorker
- type RpcReqWorker
- type SafeMap
- type ScriptSigParam
- type Scriptparm
- type SendMsg
- type SendRawTxRes
- type TxApiResult
- type Txref
- type UtxoLsRes
- type UtxoRes
- type Vinparm
- type VinparmNoInputs
- type Voutparm
- type Wallet
- type WorkReq
Constants ¶
const ( // RedeemP2PKHSigScriptSize is the worst case (largest) serialize size // of a transaction input script that redeems a compressed P2PKH output. // It is calculated as: // // - OP_DATA_73 // - 72 bytes DER signature + 1 byte sighash // - OP_DATA_33 // - 33 bytes serialized compressed pubkey RedeemP2PKHSigScriptSize = 1 + 73 + 1 + 33 // P2PKHPkScriptSize is the size of a transaction output script that // pays to a compressed pubkey hash. It is calculated as: // // - OP_DUP // - OP_HASH160 // - OP_DATA_20 // - 20 bytes pubkey hash // - OP_EQUALVERIFY // - OP_CHECKSIG P2PKHPkScriptSize = 1 + 1 + 1 + 20 + 1 + 1 // RedeemP2PKHInputSize is the worst case (largest) serialize size of a // transaction input redeeming a compressed P2PKH output. It is // calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte compact int encoding value 107 // - 107 bytes signature script // - 4 bytes sequence RedeemP2PKHInputSize = 32 + 4 + 1 + RedeemP2PKHSigScriptSize + 4 // P2PKHOutputSize is the serialize size of a transaction output with a // P2PKH output script. It is calculated as: // // - 8 bytes output value // - 1 byte compact int encoding value 25 // - 25 bytes P2PKH output script P2PKHOutputSize = 8 + 1 + P2PKHPkScriptSize // P2WPKHPkScriptSize is the size of a transaction output script that // pays to a witness pubkey hash. It is calculated as: // // - OP_0 // - OP_DATA_20 // - 20 bytes pubkey hash P2WPKHPkScriptSize = 1 + 1 + 20 // P2WPKHOutputSize is the serialize size of a transaction output with a // P2WPKH output script. It is calculated as: // // - 8 bytes output value // - 1 byte compact int encoding value 22 // - 22 bytes P2PKH output script P2WPKHOutputSize = 8 + 1 + P2WPKHPkScriptSize // RedeemP2WPKHScriptSize is the size of a transaction input script // that spends a pay-to-witness-public-key hash (P2WPKH). The redeem // script for P2WPKH spends MUST be empty. RedeemP2WPKHScriptSize = 0 // RedeemP2WPKHInputSize is the worst case size of a transaction // input redeeming a P2WPKH output. It is calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte encoding empty redeem script // - 0 bytes redeem script // - 4 bytes sequence RedeemP2WPKHInputSize = 32 + 4 + 1 + RedeemP2WPKHScriptSize + 4 // RedeemNestedP2WPKHScriptSize is the worst case size of a transaction // input script that redeems a pay-to-witness-key hash nested in P2SH // (P2SH-P2WPKH). It is calculated as: // // - 1 byte compact int encoding value 22 // - OP_0 // - 1 byte compact int encoding value 20 // - 20 byte key hash RedeemNestedP2WPKHScriptSize = 1 + 1 + 1 + 20 // RedeemNestedP2WPKHInputSize is the worst case size of a // transaction input redeeming a P2SH-P2WPKH output. It is // calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte compact int encoding value 23 // - 23 bytes redeem script (scriptSig) // - 4 bytes sequence RedeemNestedP2WPKHInputSize = 32 + 4 + 1 + RedeemNestedP2WPKHScriptSize + 4 // RedeemP2WPKHInputWitnessWeight is the worst case weight of // a witness for spending P2WPKH and nested P2WPKH outputs. It // is calculated as: // // - 1 wu compact int encoding value 2 (number of items) // - 1 wu compact int encoding value 73 // - 72 wu DER signature + 1 wu sighash // - 1 wu compact int encoding value 33 // - 33 wu serialized compressed pubkey RedeemP2WPKHInputWitnessWeight = 1 + 1 + 73 + 1 + 33 )
Worst case script and input/output size estimates.
const ( VERSION = 0.1 RPCCLIENT_TIMEOUT = 30 SERVER_HOST = "47.107.50.83" //"localhost" SERVER_PORT = 8000 //18443 USER = "xxmm" PASSWD = "123456" USESSL = false WALLET_PASSPHRASE = "WalletPassphrase" )
const BITCOIN_BASE58_TABLE = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
Variables ¶
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."}` ErrNoGetLOAccout = `{Code:6,Error:"There's no proper account to do lockout."}` ErrNoFindWorker = `{Code:7,Error:"can not find worker."}` ErrOutsideTxFail = `{Code:8,Error:"outside tx fail."}` ErrReqAddrTimeout = `{Code:9,Error:"request dcrm address timeout."}` ErrGetWorkerIdError = `{Code:10,Error:"get worker id error."}` ErrGetPrexDataError = `{Code:11,Error:"get msg prefix data error."}` ErrValidateRealFusionAddrFail = `{Code:12,Error:"validate real fusion from fail."}` ErrValidateRealDcrmFromFail = `{Code:13,Error:"validate real dcrm from fail."}` ErrSendTxToNetFail = `{Code:14,Error:"send tx to outside net fail."}` 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."}` ErrTokenTypeError = `{Code:19,Error:"token type error."}` ErrValidateLIFromAddrFail = `{Code:20,Error:"lockin validate from address fail."}` ErrValidateLIValueFail = `{Code:21,Error:"lockin validate value fail."}` ErrConfirmAddrFail = `{Code:22,Error:"the dcrm address confirm validate fail."}` 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."}` ErrGetRealEosUserFail = `{Code:27,Error:"cannot get real eos account."}` ErrDcrmSigWrongSize = `{Code:28,Error:"wrong size for dcrm sig."}` ErrDcrmSigFail = `{Code:29,Error:"dcrm sign fail."}` ErrInvalidDcrmAddr = `{Code:30,Error:"invalid dcrm address."}` 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."}` ErrInvalidCoinbase = `{Code:73,Error:"Invalid Coinbase."}` ErrStateDBError = `{Code:74,Error:"StateDB Error."}` ErrEosAccountNameError = `{Code:75,Error:"eos account name must be 12 character long, lowercase letters or 1-5."}` ErrReqEosPubkeyError = `{Code:76,Error:"Request eos pubkey error."}` ErrAlreadyKnownLOTx = `{Code:101,Error:"already known lockout transaction with same nonce."}` ErrOrderAlreadySend = `{Code:102,Error:"the miner has send order already."}` ErrTxDataError = `{Code:103,Error:"tx input data error."}` ErrInvalidDcrmPubkey = `{Code:104,Error:"invalid dcrm pubkey."}` ErrDcrmAddrAlreadyConfirmed = `{Code:105,Error:"the account has confirmed dcrm address."}` ErrDcrmAddrNotConfirmed = `{Code:106,Error:"the account has not confirmed dcrm address before."}` ErrDcrmAddrAlreadyLockIn = `{Code:107,Error:"the dcrmaddr has lockin alread."}` ErrNotRealLockIn = `{Code:108,Error:"it is not the real lockin,it is BTC change."}` ErrInsufficientDcrmFunds = `{Code:109,Error:"Insufficient Dcrm Funds For Value + Fee."}` ErrInvalidAddrToLO = `{Code:110,Error:"Lock Out To Invalid Address."}` ErrLOToSelf = `{Code:111,Error:"can not lockout to yourself."}` ErrInvalidTx = `{Code:112,Error:"tx data invalid."}` ErrHashKeyMiss = `{Code:113,Error:"hash key and real dcrm from is miss."}` //TODO ErrGetTradeUnitFail = `{Code:114,Error:"get trade unit fail."}` ErrCalcOrderBalance = `{Code:115,Error:"calc balance error."}` ErrFromNotFusionAccount = `{Code:116,Error:"From Must Be Fusion Account In LockOut Tx."}` ErrReqAddrInsufficient = `{Code:117,Error:"Insufficient for req addr,need least 5 fsn."}` ErrAddNewTradeInsufficient = `{Code:118,Error:"Insufficient for add new trade,need least 5 fsn."}` )
dcrm erros
var ( FSN Backend NodeCnt = 3 ThresHold = 3 PaillierKeyLength = 2048 CHAIN_ID = 4 //ethereum mainnet=1 rinkeby testnet=4 //TODO :get user define chainid. //rpc-req //dcrm node RpcMaxWorker = 100 RpcMaxQueue = 100 RpcReqQueue chan RpcReq RpcMaxNonDcrmWorker = 100 RpcMaxNonDcrmQueue = 100 RpcReqNonDcrmQueue chan RpcReq ETH_SERVER = "http://54.183.185.30:8018" BTC_BLOCK_CONFIRMS int64 BTC_DEFAULT_FEE float64 ETH_DEFAULT_FEE *big.Int // BLOCK_FORK_0 = "0" //"18000" //fork for dcrmsendtransaction.not to self. BLOCK_FORK_1 = "0" //"280000" //fork for lockin,txhash store into block. BLOCK_FORK_2 = "0" //"100000" //fork for lockout choose real dcrm from. TryTimes = 100 TryTimesForLockin = 10 OrderTest string ReorgNum uint64 //test net:10 main net:1000 UT = "10000000000" ////add for exchange decimal--->big.Int )
var (
DC *list.List
)
Functions ¶
func AccountManager ¶
func Base58Decode ¶
func Btc_createTransaction ¶
func Btc_createTransaction(msgprex string, dcrmaddr string, toAddr string, changeAddress string, value float64, requiredConfirmations uint32, feeRateBtc float64, ch chan interface{}) string
构建和发送一笔比特币交易 dcrmaddr: dcrm地址, toAddr: 接收转账的地址 changeAddress: 找零地址 requiredConfirmations 需要的确认区块数, 默认是6 feeRateBtc: 费用率, 单位是比特币
func CanDoMatch ¶
func CanDoMatch() bool
func CheckRealEosAccount ¶
func CreateRealEosAccount ¶
func Dcrm_LiLoReqAddress ¶
============================================================
func DecryptSplitPrivKey ¶
func DefaultDataDir ¶
func DefaultDataDir() string
func DispenseSplitPrivKey ¶
func DispenseSplitPrivKey(enode interface{})
func DoCurlRequest ¶
func DoubleHash ¶
func EncryptSplitPrivKey ¶
func Erc20_sendTx ¶
func EstimateSerializeSize ¶
EstimateSerializeSize returns a worst case serialize size estimate for a signed transaction that spends inputCount number of compressed P2PKH outputs and contains each transaction output from txOuts. The estimated size is incremented for an additional P2PKH change output if addChangeOutput is true.
func EstimateVirtualSize ¶
func EstimateVirtualSize(numP2PKHIns, numP2WPKHIns, numNestedP2WPKHIns int, txOuts []*wire.TxOut, addChangeOutput bool) int
EstimateVirtualSize returns a worst case virtual size estimate for a signed transaction that spends the given number of P2PKH, P2WPKH and (nested) P2SH-P2WPKH outputs, and contains each transaction output from txOuts. The estimate is incremented for an additional P2PKH change output if addChangeOutput is true.
func GenerateBTC ¶
func GetAllMatchRes ¶
func GetChannelValue ¶
func GetEnodePrivKey ¶
func GetEnodePrivKey(enodeID string) (prv *ecies.PrivateKey, err error)
func GetEnodesByUid ¶
func GetEnodesInfo ¶
func GetEnodesInfo()
func GetEosAccount ¶
func GetEosAccount() (acct, owner, active string)
func GetEosDbDir ¶
func GetEosDbDir() string
eos_init---> eos account key: crypto.Keccak256Hash([]byte("eossettings")) value: pubkey+eos account
func GetLockoutConfirmations ¶
func GetLockoutInfoFromLocalDB ¶
key: lockout tx hash value: lockout_txhash + sep10 + realfusionfrom + sep10 + realdcrmfrom
func GetLockoutRealFeeFromLocalDB ¶
key: lockout tx hash value: real fee
func GetLockoutTxStatusFromLocalDB ¶
key: lockout tx hash value: {Txid:xxx,Status:xxxxx,error:xxxxx,BlockHeight:xxxxx,RealFusionAccount:xxxxx,RealDcrmAccount:xxxxx,Cointype:xxxxx,OutSideTxHash:xxxxxx,TimeStamp:xxxxxx}
func GetPaillierSk ¶
func GetPaillierSk(save string, index int) *paillier.PrivateKey
func GetRawTransactionHash ¶
func GetRetErrJsonStr ¶
func GetTxStatus ¶
func GetUTXO_BlockChainInfo ¶
func GetZkFactProof ¶
func GetZkFactProof(save string, index int) *paillier.ZkFactProof
func ImportAddrToWallet ¶
func InitChan ¶
func InitChan()
workers,RpcMaxWorker,RpcReqWorker,RpcReqQueue,RpcMaxQueue,ReqDispatcher
func InitNonDcrmChan ¶
func InitNonDcrmChan()
func IsInXvcGroup ¶
func IsInXvcGroup() bool
func IsOrderBalanceOk ¶
func IsValidDcrmAddr ¶
func IsValidFusionAddr ¶
func KeyGenerate_ec2 ¶
ec2 msgprex = hash
func MakeSignedTransaction ¶
func MakeSignedTransaction(client *ethclient.Client, tx *types.Transaction, rsv string) (*types.Transaction, error)
func MergeDcrmBalance ¶
func MergeDcrmBalance2 ¶
func ReadDcrmAddrFromLocalDBByIndex ¶
key: kec256(fusionaddr:cointype) value: dcrmaddr1:dcrmaddr2:dcrmaddr3............
func RegisterGetMatchResCallback ¶
func RegisterGetMatchResCallback(recvObFunc func(string, chan interface{}))
func RegisterObCallback ¶
func RegisterObCallback(recvObFunc func(string, chan interface{}))
func RegisterObCallback2 ¶
func RegisterObCallback2(recvObFunc func(string))
func SendMsgToDcrmGroup ¶
func SendMsgToDcrmGroup(msg string)
msg = hash-enode:C1:X1:X2...... send msg = hash-enode-C1|1|2|hash-enode:C1: send msg = hash-enode-C1|2|2|X1:X2......
func SendMsgToPeer ¶
msg = hash-enode:C1:X1:X2...... send msg = hash-enode-C1|1|2|hash-enode:C1: send msg = hash-enode-C1|2|2|X1:X2......
func SetBackend ¶
func SetBackend(e Backend)
func SetDatadir ¶
func SetDatadir(data string)
func SetTxStatus ¶
func SetUpMsgList ¶
func SetUpMsgList(msg string)
==================node in group callback=================================
func Sign_ec2 ¶
func Sign_ec2(msgprex string, save string, message string, tokenType 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 SumOutputSerializeSizes ¶
SumOutputSerializeSizes sums up the serialized size of the supplied outputs.
func SumOutputValues ¶
SumOutputValues sums up the list of TxOuts and returns an Amount.
func ValidateAddress ¶
func Validate_Txhash ¶
func WriteDcrmAddrToLocalDB ¶
Types ¶
type AccountInfo ¶
type AccountInfo struct { AccountName string `json:"account_name"` RamQuato uint32 `json:"ram_quato"` NetWeight uint32 `json:"net_weight"` CpuWeight uint32 `json:"cpu_weight"` NetLimit Limit `json:"net_limit"` CpuLimit Limit `json:"cpu_limit"` RamUsage uint32 `json:"ram_usage"` Perms Permissions `json:"permissions"` Error map[string]interface{} `json:"error"` }
type AccountListInfo ¶
type AccountListJson ¶
type AccountListJson struct {
ACCOUNTLIST []AccountListInfo
}
type AddrApiResult ¶
type AuthoredTx ¶
type BtcTxResInfo ¶
type BtcTxResInfo struct { Result GetTransactionResult Error error Id int }
for btc main chain noinputs
type BtcTxResInfoNoInputs ¶
type BtcTxResInfoNoInputs struct { Result GetTransactionResultNoInputs Error error Id int }
for btc main chain noinputs
type ConfirmAddrSendMsgToDcrm ¶
type ConfirmAddrSendMsgToDcrm struct { Txhash string Tx string FusionAddr string DcrmAddr string Hashkey string Cointype string }
func (*ConfirmAddrSendMsgToDcrm) Run ¶
func (self *ConfirmAddrSendMsgToDcrm) Run(workid int, ch chan interface{}) bool
type DcrmAddrInfo ¶
type DcrmAddrInfoWrapper ¶
type DcrmAddrInfoWrapper struct {
// contains filtered or unexported fields
}
func (DcrmAddrInfoWrapper) Len ¶
func (dw DcrmAddrInfoWrapper) Len() int
func (DcrmAddrInfoWrapper) Less ¶
func (dw DcrmAddrInfoWrapper) Less(i, j int) bool
func (DcrmAddrInfoWrapper) Swap ¶
func (dw DcrmAddrInfoWrapper) Swap(i, j int)
type DcrmAddrRes ¶
type DcrmChain ¶
type DcrmChain struct { //key: lockout tx hash //value: lockout_txhash + sep10 + realfusionfrom + sep10 + realdcrmfrom Lo_info *KVData //key: kec256(fusionaddr:cointype) //value: dcrmaddr1:dcrmaddr2:dcrmaddr3............ Da *KVData //key: dcrmaddr or pubkey //value: fusionaddr + sep + xxx + sep + ys + sep + save + sep + kec256(fusionaddr:cointype) Dc_info *KVData Status string Txhash string }
func NewDcrmChain ¶
type DcrmPubkeyRes ¶
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) 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 GetAllMatchResSendMsgToXvc ¶
type GetAllMatchResSendMsgToXvc struct {
Msg string
}
get all matchres
func (*GetAllMatchResSendMsgToXvc) Run ¶
func (self *GetAllMatchResSendMsgToXvc) Run(workid int, ch chan interface{}) bool
type GetDcrmGroupCountSendMsgToXvc ¶
type GetDcrmGroupCountSendMsgToXvc struct {
Msg string
}
func (*GetDcrmGroupCountSendMsgToXvc) Run ¶
func (self *GetDcrmGroupCountSendMsgToXvc) Run(workid int, ch chan interface{}) bool
type GetMatchResSendMsgToXvc ¶
type GetMatchResSendMsgToXvc struct {
Msg string
}
func (*GetMatchResSendMsgToXvc) Run ¶
func (self *GetMatchResSendMsgToXvc) Run(workid int, ch chan interface{}) bool
type GetTransactionResult ¶
type LockInSendMsgToDcrm ¶
type LockInSendMsgToDcrm struct { Txhash string Tx string Fusionaddr string Hashkey string Value string Cointype string LockinAddr string RealDcrmFrom string }
lockin
func (*LockInSendMsgToDcrm) Run ¶
func (self *LockInSendMsgToDcrm) Run(workid int, ch chan interface{}) bool
type LockoutGetRealAccount ¶
type LockoutGetRealAccount struct { Txhash string Tx string FusionFrom string DcrmFrom string RealFusionFrom string RealDcrmFrom string Lockoutto string Value string Cointype string }
get real account
func (*LockoutGetRealAccount) Run ¶
func (self *LockoutGetRealAccount) Run(workid int, ch chan interface{}) bool
type LockoutSendMsgToDcrm ¶
type LockoutSendMsgToDcrm struct { Txhash string Tx string FusionFrom string DcrmFrom string RealFusionFrom string RealDcrmFrom string Lockoutto string Value string Cointype string }
lockout
func (*LockoutSendMsgToDcrm) Run ¶
func (self *LockoutSendMsgToDcrm) Run(workid int, ch chan interface{}) bool
type OrderCreateSendMsgToXvc ¶
type OrderCreateSendMsgToXvc struct { //txhash:tx:fusionaddr:trade:ordertype:side:price:quanity:rule:time Msg string }
order create
func (*OrderCreateSendMsgToXvc) Run ¶
func (self *OrderCreateSendMsgToXvc) Run(workid int, ch chan interface{}) bool
type Permission ¶
type Permissions ¶
type Permissions []Permission
func (Permissions) Len ¶
func (p Permissions) Len() int
func (Permissions) Less ¶
func (p Permissions) Less(i, j int) bool
func (Permissions) Swap ¶
func (p Permissions) Swap(i, j int)
type RPCTransaction ¶
type RPCTransaction struct { BlockHash common.Hash `json:"blockHash"` BlockNumber *hexutil.Big `json:"blockNumber"` From common.Address `json:"from"` Gas hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` Hash common.Hash `json:"hash"` Input hexutil.Bytes `json:"input"` Nonce hexutil.Uint64 `json:"nonce"` To *common.Address `json:"to"` TransactionIndex hexutil.Uint `json:"transactionIndex"` Value *hexutil.Big `json:"value"` V *hexutil.Big `json:"v"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` }
for eth
type ReqAddrSendMsgToDcrm ¶
//////////////////////////////////////////
func (*ReqAddrSendMsgToDcrm) Run ¶
func (self *ReqAddrSendMsgToDcrm) Run(workid int, ch chan interface{}) bool
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 ReqNonDcrmDispatcher ¶
type ReqNonDcrmDispatcher struct { // A pool of workers channels that are registered with the dispatcher WorkerPool chan chan RpcReq }
func NewReqNonDcrmDispatcher ¶
func NewReqNonDcrmDispatcher(maxWorkers int) *ReqNonDcrmDispatcher
func (*ReqNonDcrmDispatcher) Run ¶
func (d *ReqNonDcrmDispatcher) Run()
type RpcDcrmRes ¶
func GetGroupRes ¶
func GetGroupRes(wid int) RpcDcrmRes
type RpcReqNonDcrmWorker ¶
type RpcReqNonDcrmWorker struct { RpcReqWorkerPool chan chan RpcReq RpcReqChannel chan RpcReq // contains filtered or unexported fields }
func NewRpcReqNonDcrmWorker ¶
func NewRpcReqNonDcrmWorker(workerPool chan chan RpcReq) *RpcReqNonDcrmWorker
func (*RpcReqNonDcrmWorker) Clear ¶
func (w *RpcReqNonDcrmWorker) Clear()
func (*RpcReqNonDcrmWorker) Start ¶
func (w *RpcReqNonDcrmWorker) Start()
func (*RpcReqNonDcrmWorker) Stop ¶
func (w *RpcReqNonDcrmWorker) Stop()
type RpcReqWorker ¶
type RpcReqWorker struct { RpcReqWorkerPool chan chan RpcReq RpcReqChannel chan RpcReq // 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 ScriptSigParam ¶
type Scriptparm ¶
///////////////////for btc main chain
type SendRawTxRes ¶
type TxApiResult ¶
type Txref ¶
type Txref struct { Tx_hash string Block_height int64 Tx_input_n int32 Tx_output_n int32 Value float64 Ref_balance float64 Spent bool Confirmations int64 Confirmed string Double_spend bool }
Txref 表示一次交易中的第 Tx_input_n 个输入, 或第 Tx_output_n 个输出 如果是一个输入, Tx_input_n = -1 如果是一个输出, Tx_output_n = -1 如果表示交易输出,spent表示是否花出
type Vinparm ¶
type Vinparm struct { Txid string Vout int64 ScriptSig ScriptSigParam Sequence int64 }
type VinparmNoInputs ¶
type Voutparm ¶
type Voutparm struct { Value float64 N int64 ScriptPubKey Scriptparm }
type Wallet ¶
Wallet stores private and public keys
func (Wallet) GetAddress ¶
GetAddress returns wallet address
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
btc
Package helpers provides convenience functions to simplify wallet code.
|
Package helpers provides convenience functions to simplify wallet code. |
config
提供api的节点地址
|
提供api的节点地址 |
eth/sha3
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
|
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202. |
ec2
|
|