daemonManager

package
v0.0.0-...-07a8cb0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToGetDifficulty

func BytesToGetDifficulty(b []byte) interface{}

Types

type DaemonManager

type DaemonManager struct {
	Daemons []*config.DaemonOptions
	Coin    *config.CoinOptions
}

func NewDaemonManager

func NewDaemonManager(daemons []*config.DaemonOptions, coin *config.CoinOptions) *DaemonManager

func (*DaemonManager) BatchCmd

func (dm *DaemonManager) BatchCmd(commands []interface{}) (*config.DaemonOptions, []*JsonRpcResponse, error)

func (*DaemonManager) Check

func (dm *DaemonManager) Check()

func (*DaemonManager) CheckStatusCode

func (dm *DaemonManager) CheckStatusCode(statusCode int) error

func (*DaemonManager) Cmd

func (dm *DaemonManager) Cmd(method string, params []interface{}) (*config.DaemonOptions, *JsonRpcResponse, *http.Response)

func (*DaemonManager) CmdAll

func (dm *DaemonManager) CmdAll(method string, params []interface{}) ([]*http.Response, []*JsonRpcResponse)

func (*DaemonManager) DoHttpRequest

func (dm *DaemonManager) DoHttpRequest(daemon *config.DaemonOptions, reqRawData []byte) (*http.Response, error)

func (*DaemonManager) GetBlockTemplate

func (dm *DaemonManager) GetBlockTemplate() (getBlockTemplate *GetBlockTemplate, err error)

then JobManager.ProcessTemplate(rpcData)

func (*DaemonManager) IsAllOnline

func (dm *DaemonManager) IsAllOnline() bool

func (*DaemonManager) SubmitBlock

func (dm *DaemonManager) SubmitBlock(blockHex string)

submitblock has no result

type GetBalance

type GetBalance float64

type GetBlock

type GetBlock struct {
	Hash              string   `json:"hash"`
	Confirmations     int      `json:"confirmations"`
	Strippedsize      int      `json:"strippedsize"`
	Size              int      `json:"size"`
	Weight            int      `json:"weight"`
	Height            int      `json:"height"`
	Version           int      `json:"version"`
	VersionHex        string   `json:"versionHex"`
	Merkleroot        string   `json:"merkleroot"`
	Tx                []string `json:"tx"`
	Time              int      `json:"time"`
	Mediantime        int      `json:"mediantime"`
	Nonce             int      `json:"nonce"`
	Bits              string   `json:"bits"`
	Difficulty        float64  `json:"difficulty"`
	Chainwork         string   `json:"chainwork"`
	NTx               int      `json:"nTx"`
	Previousblockhash string   `json:"previousblockhash"`
}

func BytesToGetBlock

func BytesToGetBlock(b []byte) *GetBlock

type GetBlockTemplate

type GetBlockTemplate struct {
	// Base fields from BIP 0022.  CoinbaseAux is optional.  One of
	// CoinbaseTxn or CoinbaseValue must be specified, but not both.
	Version int32  `json:"version"`
	Bits    string `json:"bits"`
	CurTime uint32 `json:"curtime"`
	Height  int64  `json:"height"`
	//Rules             []string    `json:"rules"`
	PreviousBlockHash string `json:"previousblockhash"`
	//PreviousBits      string      `json:"previousbits"`
	//SigOpLimit        int64       `json:"sigoplimit,omitempty"`
	//SizeLimit         int64       `json:"sizelimit,omitempty"`
	//WeightLimit       int64       `json:"weightlimit,omitempty"`
	//WorkID            string      `json:"workid,omitempty"`
	Transactions []*TxParams `json:"transactions"`
	//CoinbaseTxn       *TxParams   `json:"coinbasetxn,omitempty"` // Bitcoin does not produce the coinbasetxn for you, you will have to build it manually.
	CoinbaseAux struct {
		Flags string `json:"flags"`
	} `json:"coinbaseaux"`
	CoinbaseValue uint64 `json:"coinbasevalue"`

	// Witness commitment defined in BIP 0141.
	DefaultWitnessCommitment string `json:"default_witness_commitment,omitempty"`

	// Basic poolManager extension from BIP 0023.
	Target string `json:"target,omitempty"`

	// Dash
	Masternode []MasternodeParams `json:"masternode"`

	Superblock []SuperblockParams `json:"superblock"`
	//SuperblocksStarted bool               `json:"superblocks_started"`
	//SuperblocksEnabled bool               `json:"superblocks_enabled"`
	CoinbasePayload string `json:"coinbase_payload"`

	// unknown
	Votes              []string
	MasternodePayments interface{}
	Payee              interface{}
	PayeeAmount        interface{}
}

func BytesToGetBlockTemplate

func BytesToGetBlockTemplate(b []byte) *GetBlockTemplate

type GetBlockchainInfo

type GetBlockchainInfo struct {
	Chain                string      `json:"chain"`
	Blocks               int         `json:"blocks"`
	Headers              int         `json:"headers"`
	Bestblockhash        string      `json:"bestblockhash"`
	Difficulty           float64     `json:"difficulty"`
	Mediantime           int         `json:"mediantime"`
	Verificationprogress float64     `json:"verificationprogress"`
	Chainwork            string      `json:"chainwork"`
	Pruned               bool        `json:"pruned"`
	Softforks            interface{} // having difference between LTC & BTC, so use interface to suppress the error
	Bip9Softforks        struct {
		Csv struct {
			Status    string `json:"status"`
			StartTime int    `json:"startTime"`
			Timeout   int    `json:"timeout"`
			Since     int    `json:"since"`
		} `json:"csv"`
		Dip0001 struct {
			Status    string `json:"status"`
			StartTime int    `json:"startTime"`
			Timeout   int    `json:"timeout"`
			Since     int    `json:"since"`
		} `json:"dip0001"`
		Dip0003 struct {
			Status    string `json:"status"`
			StartTime int    `json:"startTime"`
			Timeout   int    `json:"timeout"`
			Since     int    `json:"since"`
		} `json:"dip0003"`
		Dip0008 struct {
			Status    string `json:"status"`
			StartTime int    `json:"startTime"`
			Timeout   int    `json:"timeout"`
			Since     int    `json:"since"`
		} `json:"dip0008"`
		Bip147 struct {
			Status    string `json:"status"`
			StartTime int    `json:"startTime"`
			Timeout   int    `json:"timeout"`
			Since     int    `json:"since"`
		} `json:"bip147"`
	} `json:"bip9_softforks"`
}

func BytesToGetBlockchainInfo

func BytesToGetBlockchainInfo(b []byte) *GetBlockchainInfo

type GetInfo

type GetInfo struct {
	Version            int     `json:"version"`
	Protocolversion    int     `json:"protocolversion"`
	Walletversion      int     `json:"walletversion"`
	Balance            float64 `json:"balance"`
	PrivatesendBalance float64 `json:"privatesend_balance"`
	Blocks             int     `json:"blocks"`
	Timeoffset         int     `json:"timeoffset"`
	Connections        int     `json:"connections"`
	Proxy              string  `json:"proxy"`
	Difficulty         float64 `json:"difficulty"`
	Testnet            bool    `json:"testnet"`
	Keypoololdest      int     `json:"keypoololdest"`
	Keypoolsize        int     `json:"keypoolsize"`
	Paytxfee           float64 `json:"paytxfee"`
	Relayfee           float64 `json:"relayfee"`
	Errors             string  `json:"errors"`
}

func BytesToGetInfo

func BytesToGetInfo(b []byte) *GetInfo

type GetMiningInfo

type GetMiningInfo struct {
	Blocks           int     `json:"blocks"`
	Currentblocksize int     `json:"currentblocksize"`
	Currentblocktx   int     `json:"currentblocktx"`
	Difficulty       float64 `json:"difficulty"`
	Errors           string  `json:"errors"`
	Networkhashps    float64 `json:"networkhashps"`
	Pooledtx         int     `json:"pooledtx"`
	Chain            string  `json:"chain"`
}

func BytesToGetMiningInfo

func BytesToGetMiningInfo(b []byte) *GetMiningInfo

type GetNetworkInfo

type GetNetworkInfo struct {
	Version         int    `json:"version"`
	Subversion      string `json:"subversion"`
	Protocolversion int    `json:"protocolversion"`
	Localservices   string `json:"localservices"`
	Localrelay      bool   `json:"localrelay"`
	Timeoffset      int    `json:"timeoffset"`
	Networkactive   bool   `json:"networkactive"`
	Connections     int    `json:"connections"`
	Networks        []struct {
		Name                      string `json:"name"`
		Limited                   bool   `json:"limited"`
		Reachable                 bool   `json:"reachable"`
		Proxy                     string `json:"proxy"`
		ProxyRandomizeCredentials bool   `json:"proxy_randomize_credentials"`
	} `json:"networks"`
	Relayfee       float64       `json:"relayfee"`
	Incrementalfee float64       `json:"incrementalfee"`
	Localaddresses []interface{} `json:"localaddresses"`
	Warnings       string        `json:"warnings"`
}

func BytesToGetNetworkInfo

func BytesToGetNetworkInfo(b []byte) *GetNetworkInfo

type GetWalletInfo

type GetWalletInfo struct {
	Walletversion      int     `json:"walletversion"`
	Balance            float64 `json:"balance"`
	PrivatesendBalance float64 `json:"privatesend_balance"`
	UnconfirmedBalance float64 `json:"unconfirmed_balance"`
	ImmatureBalance    float64 `json:"immature_balance"`
	Txcount            int     `json:"txcount"`
	Keypoololdest      int     `json:"keypoololdest"`
	Keypoolsize        int     `json:"keypoolsize"`
	KeysLeft           int     `json:"keys_left"`
	Paytxfee           float64 `json:"paytxfee"`
}

func BytesToGetWalletInfo

func BytesToGetWalletInfo(b []byte) *GetWalletInfo

type JsonRpc

type JsonRpc interface {
	GetJsonRpcId() int64
	Json() []byte
}

type JsonRpcError

type JsonRpcError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type JsonRpcRequest

type JsonRpcRequest struct {
	Id     interface{}       `json:"id"`
	Method string            `json:"method"`
	Params []json.RawMessage `json:"params"`
}

func (*JsonRpcRequest) GetJsonRpcId

func (j *JsonRpcRequest) GetJsonRpcId() int64

func (*JsonRpcRequest) Json

func (j *JsonRpcRequest) Json() []byte

type JsonRpcResponse

type JsonRpcResponse struct {
	Id     interface{}     `json:"id"` // be int64 or null
	Result json.RawMessage `json:"result,omitempty"`
	Error  *JsonRpcError   `json:"error,omitempty"`
}

func (*JsonRpcResponse) GetJsonRpcId

func (j *JsonRpcResponse) GetJsonRpcId() int64

func (*JsonRpcResponse) Json

func (j *JsonRpcResponse) Json() []byte

type MasternodeParams

type MasternodeParams struct {
	Payee  string `json:"payee"`
	Script string `json:"script"`
	Amount uint64 `json:"amount"`
}

type SuperblockParams

type SuperblockParams struct {
	Payee  string `json:"payee"`
	Script string `json:"script"`
	Amount uint64 `json:"amount"`
}

type TxParams

type TxParams struct {
	Data    string        `json:"data"`
	Hash    string        `json:"hash"`
	Depends []interface{} `json:"depends"`
	Fee     uint64        `json:"fee"`
	Sigops  int           `json:"sigops"`
	TxId    string        `json:"txid"`
}

type ValidateAddress

type ValidateAddress struct {
	Isvalid      bool   `json:"isvalid"`
	Address      string `json:"address"`
	ScriptPubKey string `json:"scriptPubKey"`
	Ismine       bool   `json:"ismine"`
	Iswatchonly  bool   `json:"iswatchonly"`
	Isscript     bool   `json:"isscript"`
	Iswitness    bool   `json:"iswitness"`
	Script       string `json:"script"`
	Hex          string `json:"hex"`
	Pubkey       string `json:"pubkey"`
	Embedded     struct {
		Isscript       bool   `json:"isscript"`
		Iswitness      bool   `json:"iswitness"`
		WitnessVersion int    `json:"witness_version"`
		WitnessProgram string `json:"witness_program"`
		Pubkey         string `json:"pubkey"`
		Address        string `json:"address"`
		ScriptPubKey   string `json:"scriptPubKey"`
	} `json:"embedded"`
	Addresses     []string `json:"addresses"`
	Label         string   `json:"label"`
	Timestamp     int      `json:"timestamp"`
	Hdkeypath     string   `json:"hdkeypath"`
	Hdseedid      string   `json:"hdseedid"`
	Hdmasterkeyid string   `json:"hdmasterkeyid"`
	Labels        []struct {
		Name    string `json:"name"`
		Purpose string `json:"purpose"`
	} `json:"labels"`
}

func BytesToValidateAddress

func BytesToValidateAddress(b []byte) *ValidateAddress

Jump to

Keyboard shortcuts

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