dcrm

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2018 License: GPL-3.0, LGPL-3.0 Imports: 55 Imported by: 0

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

View Source
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.

View Source
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"
)
View Source
const BITCOIN_BASE58_TABLE = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

Variables

View Source
var (
	FSN Backend

	SecureRnd = rand.New(rand.NewSource(rnd_num)) //caihaijun

	NodeCnt = 4
	//commitment
	MPK = generateMasterPK()

	ZKParams *PublicParameters

	CHAIN_ID = 4 //ethereum mainnet=1 rinkeby testnet=4

	//rpc-req //dcrm node
	RpcMaxWorker     = 20000
	RpcMaxQueue      = 20000
	DcrmDataMaxQueue = 10 //1000
	RpcReqQueue      chan RpcReq
	DcrmDataQueue    chan DcrmData

	RpcMaxNonDcrmWorker = 20000
	RpcMaxNonDcrmQueue  = 20000
	RpcReqNonDcrmQueue  chan RpcReq

	ETH_SERVER = "http://54.183.185.30:8018"

	BTC_BLOCK_CONFIRMS int64
)

Functions

func Base58Decode

func Base58Decode(bitcoin_net int, input []byte) []byte

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 CalcKgKey

func CalcKgKey(msgprex string, encXShare *big.Int, kgx0 *big.Int, kgy0 *big.Int, id int) bool

func CheckCmt

func CheckCmt(msgprex string, id int) bool

func CheckCmt2

func CheckCmt2(msgprex string, id int) bool

func CheckCmt3

func CheckCmt3(msgprex string, id int) bool

func ChooseDcrmAddrForLockoutByValue

func ChooseDcrmAddrForLockoutByValue(dcrmaddr string, lockoutto string, value float64) bool

func ChooseRealFusionAccountForLockout

func ChooseRealFusionAccountForLockout(amount string, lockoutto string, cointype string) (string, string, error)

func Coinbase

func Coinbase() (eb common.Address, err error)

func Dcrm_ConfirmAddr

func Dcrm_ConfirmAddr(wr WorkReq) (string, error)

func Dcrm_GetAccountList

func Dcrm_GetAccountList(pubkey string) (string, error)

API

func Dcrm_LiLoReqAddress

func Dcrm_LiLoReqAddress(wr WorkReq) (string, error)

func Dcrm_LockIn

func Dcrm_LockIn(tx string, txhashs []string) (string, error)

func Dcrm_NodeInfo

func Dcrm_NodeInfo() (string, error)

func Dcrm_ReqAddress

func Dcrm_ReqAddress(wr WorkReq) (string, error)

func Dcrm_ReqAddress(pubkey string,cointype string) (string, error) {

func Dcrm_Sign

func Dcrm_Sign(wr WorkReq) (string, error)

func DecryptSplitPrivKey

func DecryptSplitPrivKey(cDPrivKey string, enodeID string) (dPrivKey *big.Int, err error)

func DefaultDataDir

func DefaultDataDir() string

func DisMsg

func DisMsg(msg string)

func DispenseSplitPrivKey

func DispenseSplitPrivKey(enode interface{})

func EncryptSplitPrivKey

func EncryptSplitPrivKey(dPrivKey *big.Int, pub *ecies.PublicKey) (cDPrivKey string, err error)

func Erc20_newUnsignedTransaction

func Erc20_newUnsignedTransaction(client *ethclient.Client, dcrmAddress string, toAddressHex string, amount *big.Int, gasPrice *big.Int, gasLimit uint64, tokenType string) (*types.Transaction, *common.Hash, error)

func Erc20_sendTx

func Erc20_sendTx(client *ethclient.Client, signedTx *types.Transaction) (string, error)

func EstimateSerializeSize

func EstimateSerializeSize(inputCount int, txOuts []*wire.TxOut, addChangeOutput bool) int

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 GenerateBTC() (string, string, error)

func GenerateBTCTest

func GenerateBTCTest(pubkey []byte) (string, string, error)

func GetBTCTxFee

func GetBTCTxFee(dcrmaddr string, lockoutto string, value float64) (float64, error)

func GetChannelValue

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

func GetDbDir

func GetDbDir() string

func GetDbDirForLockin

func GetDbDirForLockin() string

for lockin

func GetDbDirForLockoutInfo

func GetDbDirForLockoutInfo() string

for lockout info

func GetDbDirForNodeInfoSave

func GetDbDirForNodeInfoSave() string

for node info save

func GetDbDirForWriteDcrmAddr

func GetDbDirForWriteDcrmAddr() string

for write dcrmaddr

func GetDcrmAddr

func GetDcrmAddr(hash string, cointype string) string

func GetEnodePrivKey

func GetEnodePrivKey(enodeID string) (prv *ecies.PrivateKey, err error)

func GetEnodesInfo

func GetEnodesInfo()

func GetFee

func GetFee(cointype string) float64

func GetFee(dcrmaddr string,lockoutto string,value float64,cointype string) (float64,error) {

func GetLockoutInfoFromLocalDB

func GetLockoutInfoFromLocalDB(hashkey string) (string, error)

func GetPaillierKey

func GetPaillierKey(rnd io.Reader, bitlen int, paillier_dprivkey *big.Int, tmp string)

func GetPublicParams

func GetPublicParams(BitCurve *secp256k1.BitCurve, primeCertainty int32, kPrime int32, rnd *rand.Rand)

func GetRawTransactionHash

func GetRawTransactionHash(decode string) string

func GetSignString

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

func GetTxHashForLockout

func GetTxHashForLockout(realfusionfrom string, realdcrmfrom string, to string, value string, cointype string, signature string) (string, string, error)

func HashPubKey

func HashPubKey(pubKey []byte) []byte

HashPubKey hashes public key

func Init

func Init(tmp string, paillier_dprivkey *big.Int, nodecnt int)

func InitChan

func InitChan()

workers,RpcMaxWorker,RpcReqWorker,RpcReqQueue,RpcMaxQueue,DcrmDataQueue,DcrmData,DcrmDataMaxQueue,makedata,ReqDispatcher

func InitDcrmData

func InitDcrmData()

func InitNonDcrmChan

func InitNonDcrmChan()

func IsDcrmAddr

func IsDcrmAddr(addr string) bool

////

func IsExsitDcrmValidateData

func IsExsitDcrmValidateData(data string) bool

data: {}

func IsFusionAccountExsitDcrmAddr

func IsFusionAccountExsitDcrmAddr(fusion string, cointype string, dcrmaddr string) (bool, string, error)

func IsHashkeyExsitInLocalDB

func IsHashkeyExsitInLocalDB(hashkey string) (bool, error)

func IsInGroup

func IsInGroup() bool

func IsNodeInfoExsitInLocalDB

func IsNodeInfoExsitInLocalDB(nodeinfo string) (bool, error)

func IsValidDcrmAddr

func IsValidDcrmAddr(s string, cointype string) bool

func IsValidFusionAddr

func IsValidFusionAddr(s string) bool

func KeyGenerate

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

func MakeSignedTransaction

func MakeSignedTransaction(client *ethclient.Client, tx *types.Transaction, rsv string) (*types.Transaction, error)

func ManuallySplitPrivKey

func ManuallySplitPrivKey(privKey *big.Int, userCnt int) (dPrivKeyList []*big.Int)

func NewClient

func NewClient(host string, port int, user, passwd string, useSSL bool) (c *rpcClient, err error)

连接配置

func PathExists

func PathExists(path string) (bool, error)

func ReadDcrmAddrFromLocalDBByIndex

func ReadDcrmAddrFromLocalDBByIndex(fusion string, cointype string, index int) (string, error)

========

func ReadNodeInfoFromLocalDB

func ReadNodeInfoFromLocalDB(nodeinfo string) (string, error)

func RestoreNodeInfo

func RestoreNodeInfo()

func SendMsgToDcrmGroup

func SendMsgToDcrmGroup(msg string)

func SendReqToGroup

func SendReqToGroup(msg string, rpctype string) (string, error)

func SendTxForLockout

func SendTxForLockout(realfusionfrom string, realdcrmfrom string, to string, value string, cointype string, signature string) (string, error)

func SetBackend

func SetBackend(e Backend)

func SetDatadir

func SetDatadir(data string)

func SetPaillierThresholdIndex

func SetPaillierThresholdIndex(d int)

tmp

func SetUpMsgList

func SetUpMsgList(msg string)

func Sign

func Sign(msgprex string, encX *big.Int, message string, tokenType string, pkx *big.Int, pky *big.Int, ch chan interface{}, id int)

func SumOutputSerializeSizes

func SumOutputSerializeSizes(outputs []*wire.TxOut) (serializeSize int)

SumOutputSerializeSizes sums up the serialized size of the supplied outputs.

func SumOutputValues

func SumOutputValues(outputs []*wire.TxOut) (totalOutput btcutil.Amount)

SumOutputValues sums up the list of TxOuts and returns an Amount.

func ToWIF

func ToWIF(priv []byte) (wif string)

ToWIF converts a Bitcoin private key to a Wallet Import Format string.

func Tool_DecimalByteSlice2HexString

func Tool_DecimalByteSlice2HexString(DecimalSlice []byte) string

func ValidBTCTx

func ValidBTCTx(returnJson string, txhash string, realdcrmfrom string, realdcrmto string, value string, islockout bool, ch chan interface{})

func ValidateAddress

func ValidateAddress(bitcoin_net int, address string) bool

func ValidateDcrm

func ValidateDcrm(txhash string) bool

data: {}||{}||{}

func Validate_Lockout

func Validate_Lockout(wr WorkReq) (string, error)

func Validate_Txhash

func Validate_Txhash(wr WorkReq) (string, error)

func Verify

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

func WriteDcrmAddrToLocalDB

func WriteDcrmAddrToLocalDB(fusion string, cointype string, dcrmaddr string) (bool, error)

func WriteHashkeyToLocalDB

func WriteHashkeyToLocalDB(hashkey string, value string) (bool, error)

func WriteLockoutInfoToLocalDB

func WriteLockoutInfoToLocalDB(hashkey string, value string) (bool, error)

func WriteNodeInfoToLocalDB

func WriteNodeInfoToLocalDB(nodeinfo string, value string) (bool, error)

func ZkpSignOneVerify

func ZkpSignOneVerify(msgprex string, encX *big.Int, id int) bool

func ZkpSignTwoVerify

func ZkpSignTwoVerify(msgprex string, u *big.Int, id int) bool

func ZkpVerify

func ZkpVerify(msgprex string, id int) bool

Types

type AccountListInfo

type AccountListInfo struct {
	COINTYPE    string
	DCRMADDRESS string
	DCRMPUBKEY  string
}

type AccountListJson

type AccountListJson struct {
	ACCOUNTLIST []AccountListInfo
}

type AddrApiResult

type AddrApiResult struct {
	Address             string
	Total_received      float64
	Balance             float64
	Unconfirmed_balance uint64
	Final_balance       float64
	N_tx                int64
	Unconfirmed_n_tx    int64
	Final_n_tx          int64
	Txrefs              []Txref
	Tx_url              string
}

type AuthoredTx

type AuthoredTx struct {
	Tx              *wire.MsgTx
	PrevScripts     [][]byte
	PrevInputValues []btcutil.Amount
	TotalInput      btcutil.Amount
	ChangeIndex     int // negative if no change
}

type Backend

type Backend interface {
	//BlockChain() *core.BlockChain
	//TxPool() *core.TxPool
	Etherbase() (eb common.Address, err error)
	ChainDb() ethdb.Database
}

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 CheckHashkeySendMsgToDcrm

type CheckHashkeySendMsgToDcrm struct {
	Txhash  string
	Tx      string
	Hashkey string
}

checkhashkey

func (*CheckHashkeySendMsgToDcrm) Run

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

type CmtMasterPublicKey

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

func (*CmtMasterPublicKey) New

func (cmpk *CmtMasterPublicKey) New(g *pbc.Element, q *big.Int, h *pbc.Element, pairing *pbc.Pairing)

type Commitment

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

func (*Commitment) New

func (ct *Commitment) New(pubkey *pbc.Element, a *pbc.Element)

type ConfirmAddrSendMsgToDcrm

type ConfirmAddrSendMsgToDcrm struct {
	Txhash     string
	Tx         string
	FusionAddr string
	DcrmAddr   string
	Hashkey    string
	Cointype   string
}

non dcrm,

func (*ConfirmAddrSendMsgToDcrm) Run

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

type DcrmConfirmAddr

type DcrmConfirmAddr struct {
	Txhash     string
	Tx         string
	FusionAddr string
	DcrmAddr   string
	Hashkey    string
	Cointype   string
}

DcrmConfirmAddr

func (*DcrmConfirmAddr) Run

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

type DcrmData

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

type DcrmLiLoReqAddress

type DcrmLiLoReqAddress struct {
	Fusionaddr string
	Pub        string
	Cointype   string
}

DcrmLiLoReqAddress

func (*DcrmLiLoReqAddress) Run

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

type DcrmLockin

type DcrmLockin struct {
	Tx           string
	LockinAddr   string
	Hashkey      string
	RealDcrmFrom string
}

DcrmLockin

func (*DcrmLockin) Run

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

type DcrmLockout

type DcrmLockout struct {
	Txhash         string
	Tx             string
	FusionFrom     string
	DcrmFrom       string
	RealFusionFrom string
	RealDcrmFrom   string
	Lockoutto      string
	Value          string
	Cointype       string
}

DcrmLockout

func (*DcrmLockout) Run

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

type DcrmReqAddress

type DcrmReqAddress struct {
	Pub      string
	Cointype string
}

DcrmReqAddress

func (*DcrmReqAddress) Run

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

type DcrmSign

type DcrmSign struct {
	Sig      string
	Txhash   string
	DcrmAddr string
	Cointype string
}

DcrmSign

func (*DcrmSign) Run

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

type DcrmValidateRes

type DcrmValidateRes struct {
	Txhash      string
	Tx          string
	Workid      string
	Enode       string
	DcrmParms   string
	ValidateRes string
	DcrmCnt     int
	DcrmEnodes  string
}

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) 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)

type Err

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

error type 1

func (Err) Error

func (e Err) Error() string

type GetTransactionResult

type GetTransactionResult struct {
	Txid          string
	Hash          string
	Version       int64
	Size          int64
	Vsize         int64
	Weight        int64
	Locktime      int64
	Vin           []Vinparm
	Vout          []Voutparm
	Hex           string
	Blockhash     string
	Confirmations int64
	Time          int64
	BlockTime     int64
}

type GetTransactionResultNoInputs

type GetTransactionResultNoInputs struct {
	Txid          string
	Hash          string
	Version       int64
	Size          int64
	Vsize         int64
	Weight        int64
	Locktime      int64
	Vin           []VinparmNoInputs
	Vout          []Voutparm
	Hex           string
	Blockhash     string
	Confirmations int64
	Time          int64
	BlockTime     int64
}

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 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 MTDCommitment

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

func (*MTDCommitment) New

func (mtdct *MTDCommitment) New(commitment *Commitment, open *Open)

type NodeInfo

type NodeInfo struct {
	IP      string
	NAME    string
	RPCPORT string
}

type NodeJson

type NodeJson struct {
	ARRAY []NodeInfo
}

type NodeWorkId

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

type Open

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

func (*Open) New

func (open *Open) New(randomness *pbc.Element, secrets []*big.Int)

type Output

type Output struct {
	Script    string
	Addresses []string
}

type PublicParameters

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

func (*PublicParameters) New

func (this *PublicParameters) New(BitCurve *secp256k1.BitCurve, nTilde *big.Int, kPrime int32, h1 *big.Int, h2 *big.Int, paillierPubKey *pubKey)

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 RecvMsg

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

RecvMsg

func (*RecvMsg) Run

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

type ReqAddrSendMsgToDcrm

type ReqAddrSendMsgToDcrm struct {
	Fusionaddr string
	Pub        string
	Cointype   string
}

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

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

type RpcReq

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

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) 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 NewRpcReqWorker

func NewRpcReqWorker(workerPool chan chan RpcReq) RpcReqWorker

func (RpcReqWorker) Start

func (w RpcReqWorker) Start()

func (RpcReqWorker) Stop

func (w RpcReqWorker) Stop()

type SafeMap

type SafeMap struct {
	sync.RWMutex
	KeyMap map[string]string
}

type ScriptSigParam

type ScriptSigParam struct {
	Asm string
	Hex string
}

type Scriptparm

type Scriptparm struct {
	Asm       string
	Hex       string
	ReqSigs   int64
	Type      string
	Addresses []string
}

///////////////////for btc main chain

type SendRawTxRes

type SendRawTxRes struct {
	Hash common.Hash
	Err  error
}

type TxApiResult

type TxApiResult struct {
	TxHash  string
	Outputs []Output
}

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 User

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

func (*User) GetEncX

func (this *User) GetEncX() *big.Int

func (*User) GetPk_x

func (this *User) GetPk_x() *big.Int

func (*User) GetPk_y

func (this *User) GetPk_y() *big.Int

type UtxoLsRes

type UtxoLsRes struct {
	Unspent_outputs []UtxoRes
}

type UtxoRes

type UtxoRes struct {
	Tx_hash_big_endian string
	Script             string
	Tx_output_n        uint32
	Value              float64
	Confirmations      int64
}

type Vinparm

type Vinparm struct {
	Txid      string
	Vout      int64
	ScriptSig ScriptSigParam
	Sequence  int64
}

type VinparmNoInputs

type VinparmNoInputs struct {
	Coinbase string
	Sequence int64
}

type Voutparm

type Voutparm struct {
	Value        float64
	N            int64
	ScriptPubKey Scriptparm
}

type Wallet

type Wallet struct {
	PrivateKey []byte
	PublicKey  []byte
}

Wallet stores private and public keys

func NewWallet

func NewWallet() *Wallet

NewWallet creates and returns a Wallet

func (Wallet) GetAddress

func (w Wallet) GetAddress(bitcoin_net int) (address string)

GetAddress returns wallet address

type WorkReq

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

/////////////////////////////////////

type ZkpKG

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

func (*ZkpKG) New

func (this *ZkpKG) New(params *PublicParameters, eta *big.Int, rand *rand.Rand, cx *big.Int, cy *big.Int, w *big.Int, r *big.Int)

type ZkpSignOne

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

func (*ZkpSignOne) New

func (this *ZkpSignOne) New(params *PublicParameters, eta *big.Int, rand *rand.Rand, r *big.Int, c1 *big.Int, c2 *big.Int, c3 *big.Int)

type ZkpSignTwo

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

func (*ZkpSignTwo) New

func (this *ZkpSignTwo) New(params *PublicParameters, eta1 *big.Int, eta2 *big.Int, rand *rand.Rand, cx *big.Int, cy *big.Int, w *big.Int, u *big.Int, randomness *big.Int)

Directories

Path Synopsis
Package pbc provides structures for building pairing-based cryptosystems.
Package pbc provides structures for building pairing-based cryptosystems.

Jump to

Keyboard shortcuts

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