Documentation
¶
Index ¶
- Constants
- func CPUProviderID() uint
- type ComputeAPIClass
- type ComputeProvider
- type OptionFunc
- func WithBitsPerLabel(bitsPerLabel uint32) OptionFunc
- func WithCommitment(commitment []byte) OptionFunc
- func WithComputeLeaves(enabled bool) OptionFunc
- func WithComputePow(difficulty []byte) OptionFunc
- func WithComputeProviderID(id uint) OptionFunc
- func WithSalt(salt []byte) OptionFunc
- func WithScryptParams(n, r, p uint32) OptionFunc
- func WithStartAndEndPosition(start, end uint64) OptionFunc
- type ScryptPositionsResult
- type StopResult
Constants ¶
const ( ComputeAPIClassUnspecified = ComputeAPIClass((C.ComputeApiClass)(C.COMPUTE_API_CLASS_UNSPECIFIED)) ComputeAPIClassCPU = ComputeAPIClass((C.ComputeApiClass)(C.COMPUTE_API_CLASS_CPU)) ComputeAPIClassCuda = ComputeAPIClass((C.ComputeApiClass)(C.COMPUTE_API_CLASS_CUDA)) ComputeAPIClassVulkan = ComputeAPIClass((C.ComputeApiClass)(C.COMPUTE_API_CLASS_VULKAN)) StopResultPowFound = StopResult(C.SPACEMESH_API_POW_SOLUTION_FOUND) StopResultOk = StopResult(C.SPACEMESH_API_ERROR_NONE) StopResultError = StopResult(C.SPACEMESH_API_ERROR) StopResultErrorTimeout = StopResult(C.SPACEMESH_API_ERROR_TIMEOUT) StopResultErrorAlready = StopResult(C.SPACEMESH_API_ERROR_ALREADY) StopResultErrorCancelled = StopResult(C.SPACEMESH_API_ERROR_CANCELED) StopResultErrorNoComputeOptions = StopResult(C.SPACEMESH_API_ERROR_NO_COMPUTE_OPTIONS) StopResultErrorInvalidParameter = StopResult(C.SPACEMESH_API_ERROR_INVALID_PARAMETER) StopResultErrorInvalidProvider = StopResult(C.SPACEMESH_API_ERROR_INVALID_PROVIDER_ID) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ComputeAPIClass ¶
type ComputeAPIClass uint
func (ComputeAPIClass) String ¶
func (c ComputeAPIClass) String() string
type ComputeProvider ¶
type ComputeProvider struct {
ID uint
Model string
ComputeAPI ComputeAPIClass
}
func Providers ¶
func Providers() []ComputeProvider
Providers returns a list of available compute providers.
type OptionFunc ¶
type OptionFunc func(*option) error
func WithBitsPerLabel ¶
func WithBitsPerLabel(bitsPerLabel uint32) OptionFunc
WithBitsPerLabel instructs scrypt to use the specified number of bits per label.
func WithCommitment ¶
func WithCommitment(commitment []byte) OptionFunc
WithCommitment instructs scrypt to use the specified commitment (seed) to calculate the output.
func WithComputeLeaves ¶
func WithComputeLeaves(enabled bool) OptionFunc
WithComputeLeafs instructs scrypt to compute leafs or not. By default computing leafs is enabled.
func WithComputePow ¶
func WithComputePow(difficulty []byte) OptionFunc
WithComputePow instructs scrypt to compute a proof of work or not. If difficulty is nil, no PoW will be computed. Otherwise it specifies the difficulty of the PoW to be computed (higher values are more difficult). By default computing proof of work is disabled.
func WithComputeProviderID ¶
func WithComputeProviderID(id uint) OptionFunc
WithComputeProviderID instructs scrypt to use the specified compute provider.
func WithSalt ¶
func WithSalt(salt []byte) OptionFunc
WithSalt instructs scrypt to use the specified salt to calculate the output.
func WithScryptParams ¶
func WithScryptParams(n, r, p uint32) OptionFunc
func WithStartAndEndPosition ¶
func WithStartAndEndPosition(start, end uint64) OptionFunc
WithStartAndEndPosition instructs scrypt to compute the scrypt output for the specified range of positions.
type ScryptPositionsResult ¶
type ScryptPositionsResult struct {
Output []byte // The output of the scrypt computation.
IdxSolution *uint64 // The index of a solution to the proof of work (if checked for).
HashesPerSec int // The number of hashes computed per second.
Stopped bool // Whether the computation was stopped.
}
ScryptPositionsResult is the result of a ScryptPositions call.
func ScryptPositions ¶
func ScryptPositions(opts ...OptionFunc) (*ScryptPositionsResult, error)
ScryptPositions computes the scrypt output for the given options.
type StopResult ¶
type StopResult int
func Stop ¶
func Stop() StopResult
func (StopResult) String ¶
func (s StopResult) String() string