Documentation
¶
Index ¶
- Constants
- Variables
- func CPUProviderID() uint
- func GenerateProof(dataDir string, challenge []byte, cfg config.Config, nonces uint, threads uint, ...) (*shared.Proof, error)
- func InitResultToError(retVal uint32) error
- func VerifyProof(proof *shared.Proof, metadata *shared.ProofMetadata, cfg config.Config, ...) error
- type DeviceClass
- type OptionFunc
- type Provider
- type ScryptPositionsResult
Constants ¶
View Source
const ( ClassCPU = DeviceClass((C.DeviceClass)(C.CPU)) ClassGPU = DeviceClass((C.DeviceClass)(C.GPU)) )
View Source
const (
// LabelLength is the length of the label in bytes.
LabelLength = 16
)
Variables ¶
View Source
var ( ErrInvalidProviderID = errors.New("invalid provider ID") ErrInvalidLabelsRange = errors.New("invalid labels range") ErrOpenCL = errors.New("OpenCL error") ErrInvalidArgument = errors.New("invalid argument") ErrFetchProviders = errors.New("failed to fetch providers") ErrUnknown = errors.New("unknown error") )
Functions ¶
func CPUProviderID ¶
func CPUProviderID() uint
func GenerateProof ¶
func InitResultToError ¶
InitResultToError converts the return value of the C.initialize() function to a Go error.
func VerifyProof ¶
func VerifyProof(proof *shared.Proof, metadata *shared.ProofMetadata, cfg config.Config, powScrypt, labelScrypt config.ScryptParams) error
Types ¶
type DeviceClass ¶
type DeviceClass int
DeviceClass is an enum for the type of device (CPU or GPU).
func (DeviceClass) String ¶
func (c DeviceClass) String() string
type OptionFunc ¶
type OptionFunc func(*option) error
func WithCommitment ¶
func WithCommitment(commitment []byte) OptionFunc
func WithProviderID ¶
func WithProviderID(id uint) OptionFunc
WithProviderID sets the ID of the openCL provider to use.
func WithScryptN ¶
func WithScryptN(n uint32) OptionFunc
func WithStartAndEndPosition ¶
func WithStartAndEndPosition(start, end uint64) OptionFunc
func WithVRFDifficulty ¶
func WithVRFDifficulty(difficulty []byte) OptionFunc
type Provider ¶
type Provider struct {
ID uint
Model string
DeviceType DeviceClass
}
Provider is a struct that contains information about an OpenCL provider. libpostrs returns a list of these structs when calling cGetProviders(). Each Provider is an OpenCL platform + Device combination.
func OpenCLProviders ¶
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).
}
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.
Click to show internal directories.
Click to hide internal directories.