Documentation ¶
Index ¶
Constants ¶
View Source
const ComponentName = "miner"
View Source
const NumProcessors = 1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashSettings ¶
type HashSettings struct {
// contains filtered or unexported fields
}
func NewHashSettings ¶
func NewHashSettings(challenge *MiningChallenge, publicAddr string) *HashSettings
type Hasher ¶
type Hasher interface { //base is a 52 byte slice containing the challenge and public address // the guessed nonce is appended to this slice and used as input to the first hash fn // returns a valid nonce, or empty string if none was found CheckRange(anySolution context.Context, hash *HashSettings, start uint64, n uint64) (string, uint64, error) //number of hashes this backend checks at a time StepSize() uint64 Name() string }
interface for all mining implementations.
type MiningChallenge ¶
MiningChallenge holds information about a PoW challenge.
type MiningGroup ¶
type MiningGroup struct { Backends []*Backend LastPrinted time.Time // contains filtered or unexported fields }
func NewMiningGroup ¶
func NewMiningGroup(logger log.Logger, ctx context.Context, cfg Config, hashers []Hasher, contractInstance contracts.TellorCaller) (*MiningGroup, error)
func SetupMiningGroup ¶
func SetupMiningGroup(logger log.Logger, ctx context.Context, cfg Config, contractInstance contracts.TellorCaller) (*MiningGroup, error)
func (*MiningGroup) HashRateEstimate ¶
func (g *MiningGroup) HashRateEstimate() float64
func (*MiningGroup) Mine ¶
func (g *MiningGroup) Mine(ctx context.Context, input chan *Work, output chan *Result)
func (*MiningGroup) PreferredWorkMultiple ¶
func (g *MiningGroup) PreferredWorkMultiple() uint64
func (*MiningGroup) PrintHashRateSummary ¶
func (g *MiningGroup) PrintHashRateSummary()
type MiningMgr ¶
type MiningMgr struct {
// contains filtered or unexported fields
}
MiningMgr manages mining, submiting a solution and requesting data. In the tellor contract a solution is saved in slots where a value is valid only when it has 5 confirmed slots. The manager tracks tx costs and profitThreshold is set it skips any transactions below the profit threshold. The profit is calculated the same way as in the Tellor contract. Transaction cost for submitting in each slot might be different so because of this the manager needs to complete few transaction to gather the tx cost for each slot.
type SolutionSink ¶
Click to show internal directories.
Click to hide internal directories.