Documentation
¶
Index ¶
- Constants
- func GetAddress() string
- func GetHandler() map[string]handler.Func
- func GetMaxHashes() int
- func GetMaxThreads() int
- func GetPort() string
- func HashesToString(hashes uint64) string
- func IsActive() bool
- func IsProcessing() bool
- func JobIsReady(timeout time.Duration) (err error)
- func SetAddress(address string) (err error)
- func SetMaxHashes(i int) (err error)
- func SetMaxThreads(i int)
- func SetPort(port int) (err error)
- func StartGetWork(address, endpoint string) (err error)
- func StopGetWork()
- type Attempt_Params
- type EPOCH
- type EPOCH_Result
- func AttemptEPOCH(ctx context.Context, p Attempt_Params) (result EPOCH_Result, err error)
- func AttemptHashes(hashes int) (result EPOCH_Result, err error)
- func SubmitEPOCH(ctx context.Context, params []Submit_Params) (result EPOCH_Result, err error)
- func SubmitHashes(params []Submit_Params) (result EPOCH_Result, err error)
- type GetAddressEPOCH_Result
- type GetMaxHashes_Result
- type GetSessionEPOCH_Result
- type Submit_Params
Constants ¶
const ( DEFAULT_MAX_THREADS = 2 // Default max thread value for EPOCH DEFAULT_WORK_PORT = 10100 // Default DERO GetWork port LIMIT_MAX_HASHES = 10000 // Maximum value that EPOCH package will accept hashes per request at )
Variables ¶
This section is empty.
Functions ¶
func HashesToString ¶
Parse EPOCH hashes and return as formatted string
func JobIsReady ¶
JobIsReady waits for a JobID to be present, it returns error if job is not found before timeout duration
func SetAddress ¶
Set the EPOCH reward address, must be a registered DERO address
func SetMaxHashes ¶
Set the max amount of hash attempts or job submissions that a single request can handle, exceeding MAX_HASHES will return error
func SetMaxThreads ¶
func SetMaxThreads(i int)
Set the max amount of threads to be used when attempting or submitting, max is limited to total available and minimum of 1
func StartGetWork ¶
Start listening to GetWork server, if address is empty string epoch.address will be used, endpoint is a DERO daemon address and will use the port defined by SetPort() to connect to GetWork, when StartGetWork is successfully connected it will set the EPOCH session totals to zero
Types ¶
type Attempt_Params ¶
type Attempt_Params struct {
Hashes int `json:"hashes"`
}
EPOCH attempt params
type EPOCH_Result ¶
type EPOCH_Result struct { Hashes uint64 `json:"epochHashes"` Submitted int `json:"epochSubmitted"` Duration int64 `json:"epochDuration"` HashPerSec float64 `json:"epochHashPerSecond,omitempty"` Error error `json:"epochError,omitempty"` }
EPOCH attempt/submit result
func AttemptEPOCH ¶
func AttemptEPOCH(ctx context.Context, p Attempt_Params) (result EPOCH_Result, err error)
AttemptEPOCH performs the POW and submits its results to the connected node
func AttemptHashes ¶
func AttemptHashes(hashes int) (result EPOCH_Result, err error)
AttemptHashes performs the POW for the number of hashes and submits valid hashes as miniblocks to the connected node, when it is called it increases the session total for hashes and blocks as per the result
func SubmitEPOCH ¶
func SubmitEPOCH(ctx context.Context, params []Submit_Params) (result EPOCH_Result, err error)
SubmitEPOCH submits pre computed block data to the connected node
func SubmitHashes ¶
func SubmitHashes(params []Submit_Params) (result EPOCH_Result, err error)
SubmitHashes checks and submits valid pre computed hashes as miniblocks to the connected node, only the block session total will be increased when it is called
type GetAddressEPOCH_Result ¶
type GetAddressEPOCH_Result struct {
Address string `json:"epochAddress"`
}
EPOCH GetAddressEPOCH result
func GetAddressEPOCH ¶
func GetAddressEPOCH(ctx context.Context) (result GetAddressEPOCH_Result, err error)
GetAddressEPOCH returns the current address EPOCH has set if active
type GetMaxHashes_Result ¶
type GetMaxHashes_Result struct {
MaxHashes int `json:"maxHashes"`
}
EPOCH GetMaxHashes result
func GetMaxHashesEPOCH ¶
func GetMaxHashesEPOCH(ctx context.Context) (result GetMaxHashes_Result, err error)
GetMaxHashesEPOCH returns the current max hash per request setting if EPOCH is active
type GetSessionEPOCH_Result ¶
type GetSessionEPOCH_Result struct { Hashes uint64 `json:"sessionHashes"` MiniBlocks int `json:"sessionMinis"` Version string `json:"sessionVersion"` }
EPOCH GetSessionEPOCH result
func GetSession ¶
func GetSession(timeout time.Duration) (session GetSessionEPOCH_Result, err error)
GetSession returns the current EPOCH session statistics, it will wait while EPOCH is processing and return error if result is not found before timeout duration
func GetSessionEPOCH ¶
func GetSessionEPOCH(ctx context.Context) (result GetSessionEPOCH_Result, err error)
GetSessionEPOCH returns the statistics for the current EPOCH session if active. There may be multiple applications connected to a EPOCH session, the result values will be the sum of all the connections
type Submit_Params ¶
type Submit_Params struct { Job rpc.GetBlockTemplate_Result `json:"jobTemplate"` PowHash [32]byte `json:"powHash"` EpochWork [block.MINIBLOCK_SIZE]byte `json:"epochWork"` Difficulty big.Int `json:"epochDifficulty"` }
EPOCH submit params