Documentation ¶
Overview ¶
Package ethash implements the ethash proof-of-work consensus engine.
Index ¶
- Variables
- func DefaultDataSetDir() string
- func MakeCache(block uint64, dir string)
- func MakeDataset(block uint64, dir string)
- func Number(seedHash common.Hash) (int64, error)
- func SeedHash(block uint64) []byte
- type Ethash
- func (ethash *Ethash) APIs(chain consensus.ChainReader) []rpc.API
- func (ethash *Ethash) Hashrate() float64
- func (ethash *Ethash) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
- func (ethash *Ethash) SetThreads(threads int)
- func (ethash *Ethash) Threads() int
- func (ethash *Ethash) Verify(header *types.Header) error
- type OpenCLDevice
- type OpenCLMiner
- func (c *OpenCLMiner) ChangeDAGOnAllDevices() (err error)
- func (c *OpenCLMiner) CmpDagSize(work *Work) bool
- func (c *OpenCLMiner) Destroy()
- func (c *OpenCLMiner) GetFanPercent(deviceID int) float64
- func (c *OpenCLMiner) GetHashrate(deviceID int) float64
- func (c *OpenCLMiner) GetTemperature(deviceID int) float64
- func (c *OpenCLMiner) InitCL() error
- func (c *OpenCLMiner) LowMemDevice() bool
- func (c *OpenCLMiner) MarshalJSON() ([]byte, error)
- func (c *OpenCLMiner) Poll()
- func (c *OpenCLMiner) Release(deviceID int)
- func (c *OpenCLMiner) ReleaseAll()
- func (c *OpenCLMiner) Resume()
- func (c *OpenCLMiner) Seal(stop <-chan struct{}, deviceID int, ...) error
- func (c *OpenCLMiner) SetEngineClock(values []int)
- func (c *OpenCLMiner) SetFanPercent(percents []int)
- func (c *OpenCLMiner) SetIntensity(values []int)
- func (c *OpenCLMiner) SetKernel(values []int)
- func (c *OpenCLMiner) SetMemoryClock(values []int)
- func (c *OpenCLMiner) TotalHashRate() (total float64)
- func (c *OpenCLMiner) TotalHashRate1() (total float64)
- func (c *OpenCLMiner) TotalHashRateMean() float64
- func (c *OpenCLMiner) WorkChanged()
- type Work
Constants ¶
This section is empty.
Variables ¶
var ( //ErrInvalidChain const ErrInvalidChain = errors.New("invalid header chain") //ErrTooManyUncles const ErrTooManyUncles = errors.New("too many uncles") //ErrDuplicateUncle const ErrDuplicateUncle = errors.New("duplicate uncle") //ErrUncleIsAncestor const ErrUncleIsAncestor = errors.New("uncle is ancestor") //ErrDanglingUncle const ErrDanglingUncle = errors.New("uncle's parent is not ancestor") //ErrNonceOutOfRange const ErrNonceOutOfRange = errors.New("nonce out of range") //ErrInvalidDifficulty const ErrInvalidDifficulty = errors.New("non-positive difficulty") //ErrInvalidMixDigest const ErrInvalidMixDigest = errors.New("invalid mix digest") //ErrInvalidPoW const ErrInvalidPoW = errors.New("invalid proof-of-work") )
var ErrInvalidDumpMagic = errors.New("invalid dump magic")
ErrInvalidDumpMagic variable
Functions ¶
func DefaultDataSetDir ¶
func DefaultDataSetDir() string
DefaultDataSetDir return defaut data set directory
func MakeDataset ¶
MakeDataset generates a new ethash dataset and optionally stores it to disk.
Types ¶
type Ethash ¶
type Ethash struct {
// contains filtered or unexported fields
}
Ethash is a consensus engine based on proot-of-work implementing the ethash algorithm.
func New ¶
func New(cachedir string, cachesinmem, cachesondisk int, dagdir string, dagsinmem, dagsondisk int) *Ethash
New creates a full sized ethash PoW scheme.
func NewFakeDelayer ¶
NewFakeDelayer creates a ethash consensus engine with a fake PoW scheme that accepts all blocks as valid, but delays verifications by some time, though they still have to conform to the Ethereum consensus rules.
func NewFakeFailer ¶
NewFakeFailer creates a ethash consensus engine with a fake PoW scheme that accepts all blocks as valid apart from the single one specified, though they still have to conform to the Ethereum consensus rules.
func NewFaker ¶
func NewFaker() *Ethash
NewFaker creates a ethash consensus engine with a fake PoW scheme that accepts all blocks' seal as valid, though they still have to conform to the Ethereum consensus rules.
func NewFullFaker ¶
func NewFullFaker() *Ethash
NewFullFaker creates an ethash consensus engine with a full fake scheme that accepts all blocks as valid, without checking any consensus rules whatsoever.
func NewShared ¶
func NewShared() *Ethash
NewShared creates a full sized ethash PoW shared between all requesters running in the same process.
func NewTester ¶
func NewTester() *Ethash
NewTester creates a small sized ethash PoW scheme useful only for testing purposes.
func (*Ethash) APIs ¶
func (ethash *Ethash) APIs(chain consensus.ChainReader) []rpc.API
APIs implements consensus.Engine, returning the user facing RPC APIs. Currently that is empty.
func (*Ethash) Hashrate ¶
Hashrate implements PoW, returning the measured rate of the search invocations per second over the last minute.
func (*Ethash) Seal ¶
func (ethash *Ethash) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
Seal implements consensus.Engine, attempting to find a nonce that satisfies the block's difficulty requirements.
func (*Ethash) SetThreads ¶
SetThreads updates the number of mining threads currently enabled. Calling this method does not start mining, only sets the thread count. If zero is specified, the miner will use all cores of the machine. Setting a thread count below zero is allowed and will cause the miner to idle, without any work being done.
type OpenCLDevice ¶
OpenCLDevice struct
type OpenCLMiner ¶
type OpenCLMiner struct { sync.RWMutex Work *Work SolutionsHashRate metrics.Meter FoundSolutions metrics.Histogram RejectedSolutions metrics.Counter InvalidSolutions metrics.Counter // contains filtered or unexported fields }
OpenCLMiner struct
func NewCL ¶
func NewCL(deviceIds []int, workerName string, binary bool, version string) *OpenCLMiner
NewCL func
func (*OpenCLMiner) ChangeDAGOnAllDevices ¶
func (c *OpenCLMiner) ChangeDAGOnAllDevices() (err error)
ChangeDAGOnAllDevices generate dag on all devices
func (*OpenCLMiner) CmpDagSize ¶
func (c *OpenCLMiner) CmpDagSize(work *Work) bool
CmpDagSize based on block number
func (*OpenCLMiner) GetFanPercent ¶
func (c *OpenCLMiner) GetFanPercent(deviceID int) float64
GetFanPercent for device
func (*OpenCLMiner) GetHashrate ¶
func (c *OpenCLMiner) GetHashrate(deviceID int) float64
GetHashrate for device
func (*OpenCLMiner) GetTemperature ¶
func (c *OpenCLMiner) GetTemperature(deviceID int) float64
GetTemperature for device
func (*OpenCLMiner) LowMemDevice ¶
func (c *OpenCLMiner) LowMemDevice() bool
LowMemDevice looking low mem devices
func (*OpenCLMiner) MarshalJSON ¶
func (c *OpenCLMiner) MarshalJSON() ([]byte, error)
MarshalJSON for json encoding
func (*OpenCLMiner) Seal ¶
func (c *OpenCLMiner) Seal(stop <-chan struct{}, deviceID int, onSolutionFound func(common.Hash, uint64, []byte, uint64)) error
Seal hashes on GPU
func (*OpenCLMiner) SetEngineClock ¶
func (c *OpenCLMiner) SetEngineClock(values []int)
SetEngineClock set engine clock for selected devices
func (*OpenCLMiner) SetFanPercent ¶
func (c *OpenCLMiner) SetFanPercent(percents []int)
SetFanPercent set fan speed percent for selected devices
func (*OpenCLMiner) SetIntensity ¶
func (c *OpenCLMiner) SetIntensity(values []int)
SetIntensity for each device
func (*OpenCLMiner) SetKernel ¶
func (c *OpenCLMiner) SetKernel(values []int)
SetKernel for each device
func (*OpenCLMiner) SetMemoryClock ¶
func (c *OpenCLMiner) SetMemoryClock(values []int)
SetMemoryClock set memory clock for selected devices
func (*OpenCLMiner) TotalHashRate ¶
func (c *OpenCLMiner) TotalHashRate() (total float64)
TotalHashRate on all GPUs
func (*OpenCLMiner) TotalHashRate1 ¶
func (c *OpenCLMiner) TotalHashRate1() (total float64)
TotalHashRate1 on all GPUs
func (*OpenCLMiner) TotalHashRateMean ¶
func (c *OpenCLMiner) TotalHashRateMean() float64
TotalHashRateMean on all GPUs
type Work ¶
type Work struct { BlockNumber *big.Int HeaderHash common.Hash SeedHash common.Hash Target256 *big.Int MinerTarget *big.Int FixedDifficulty bool ExtraNonce uint64 SizeBits int Time time.Time }
Work struct
func (*Work) MarshalJSON ¶
MarshalJSON for json encoding