nexa

package
v0.0.0-...-5ed304f Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateAddress

func ValidateAddress(address string) bool

Types

type Block

type Block struct {
	Hash              string         `json:"hash"`
	Confirmations     int64          `json:"confirmations"`
	StrippedSize      uint64         `json:"strippedsize"`
	Size              uint64         `json:"size"`
	Weight            uint64         `json:"weight"`
	Height            uint64         `json:"height"`
	Version           uint64         `json:"version"`
	VersionHex        string         `json:"versionHex"`
	MerkleRoot        string         `json:"merkleroot"`
	Transactions      []*Transaction `json:"tx"`
	Time              int64          `json:"time"`
	MedianTime        int64          `json:"mediantime"`
	Bits              string         `json:"bits"`
	Difficulty        float64        `json:"difficulty"`
	Chainwork         string         `json:"chainwork"`
	HeaderHash        string         `json:"headerhash"`
	MixHash           string         `json:"mixhash"`
	Nonce             uint64         `json:"nonce64"`
	PreviousBlockHash string         `json:"previousblockhash"`
	NextBlockHash     string         `json:"nextblockhash"`
}

type BlockchainInfo

type BlockchainInfo struct {
	Chain                string  `json:"chain"`
	Blocks               uint64  `json:"blocks"`
	Headers              uint64  `json:"headers"`
	BestBlockHash        string  `json:"bestblockhash"`
	Difficulty           float64 `json:"difficulty"`
	MedianTime           int64   `json:"mediantime"`
	VerificationProgress float64 `json:"verificationprogress"`
	ChainWork            string  `json:"chainwork"`
	Pruned               bool    `json:"pruned"`
}

type MiningCandidate

type MiningCandidate struct {
	ID               uint64 `json:"id"`
	HeaderCommitment string `json:"headerCommitment"`
	NBits            string `json:"nBits"`
}

type Node

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

func New

func New(
	mainnet bool,
	urls []string,
	rawPriv string,
	logger *log.Logger,
	tunnel *sshtunnel.SSHTunnel,
) (*Node, error)

func (Node) Address

func (node Node) Address() string

func (Node) BroadcastTx

func (node Node) BroadcastTx(tx string) (string, error)

func (Node) CalculateHashrate

func (node Node) CalculateHashrate(blockTime, difficulty float64) float64

func (Node) Chain

func (node Node) Chain() string

func (Node) CreateTx

func (node Node) CreateTx(inputs []*types.TxInput, outputs []*types.TxOutput) (string, string, error)

func (Node) GetAccountingType

func (node Node) GetAccountingType() types.AccountingType

func (Node) GetAddressExplorerURL

func (node Node) GetAddressExplorerURL(address string) string

func (Node) GetAddressPrefix

func (node Node) GetAddressPrefix() string

func (Node) GetAdjustedShareDifficulty

func (node Node) GetAdjustedShareDifficulty() float64

func (Node) GetAuthorizeResponses

func (node Node) GetAuthorizeResponses(diffFactor int) ([]interface{}, error)

func (Node) GetBalance

func (node Node) GetBalance() (*big.Int, error)

func (Node) GetBlockExplorerURL

func (node Node) GetBlockExplorerURL(round *pooldb.Round) string

func (Node) GetBlocks

func (node Node) GetBlocks(start, end uint64) ([]*tsdb.RawBlock, error)

func (Node) GetBlocksByHash

func (node Node) GetBlocksByHash(startHash string, limit uint64) ([]*tsdb.RawBlock, error)

func (Node) GetClientType

func (node Node) GetClientType(minerClient string) int

func (Node) GetImmatureDepth

func (node Node) GetImmatureDepth() uint64

func (Node) GetMatureDepth

func (node Node) GetMatureDepth() uint64

func (Node) GetMaxDifficulty

func (node Node) GetMaxDifficulty() *big.Int

func (Node) GetSetDifficultyResponse

func (node Node) GetSetDifficultyResponse(diffFactor int) (interface{}, error)

func (Node) GetShareDifficulty

func (node Node) GetShareDifficulty(diffFactor int) *types.Difficulty

func (Node) GetStatus

func (node Node) GetStatus() (uint64, bool, error)

func (Node) GetSubscribeResponses

func (node Node) GetSubscribeResponses(id []byte, clientID, extraNonce string) ([]interface{}, error)

func (Node) GetTx

func (node Node) GetTx(txid string) (*types.TxResponse, error)

func (Node) GetTxExplorerURL

func (node Node) GetTxExplorerURL(txid string) string

func (Node) GetUnits

func (node Node) GetUnits() *types.Number

func (*Node) HandleHostPoolInfoRequest

func (node *Node) HandleHostPoolInfoRequest(w http.ResponseWriter, r *http.Request)

func (Node) JobNotify

func (node Node) JobNotify(ctx context.Context, interval time.Duration) chan *types.StratumJob

func (Node) MarshalJob

func (node Node) MarshalJob(
	id interface{},
	job *types.StratumJob,
	cleanJobs bool,
	clientType, diffFactor int,
) (interface{}, error)

func (Node) MatureRound

func (node Node) MatureRound(round *pooldb.Round) ([]*pooldb.UTXO, error)

func (Node) Mocked

func (node Node) Mocked() bool

func (Node) Name

func (node Node) Name() string

func (Node) ParseWork

func (node Node) ParseWork(data []json.RawMessage, extraNonce string) (*types.StratumWork, error)

func (Node) PingHosts

func (node Node) PingHosts() ([]string, []uint64, []bool, []error)

func (Node) ShouldMergeUTXOs

func (node Node) ShouldMergeUTXOs() bool

func (Node) SubmitWork

func (node Node) SubmitWork(
	job *types.StratumJob,
	work *types.StratumWork,
	diffFactor int,
) (types.ShareStatus, *types.Hash, *pooldb.Round, error)

func (Node) UnlockRound

func (node Node) UnlockRound(round *pooldb.Round) error

func (Node) ValidateAddress

func (node Node) ValidateAddress(address string) bool

type SubmissionResponse

type SubmissionResponse struct {
	Height uint64  `json:"height"`
	Hash   string  `json:"hash"`
	Result *string `json:"result"`
}

type Transaction

type Transaction struct {
	Data          string `json:"data"`
	TxID          string `json:"txid"`
	TxIdem        string `json:"txidem"`
	BlockHash     string `json:"blockhash"`
	Confirmations int64  `json:"confirmations"`
	Inputs        []struct {
		Coinbase string `json:"coinbase"`
	} `json:"vin"`
	Outputs []struct {
		Value json.Number `json:"value"`
	} `json:"vout"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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