kawpow

package
v0.49.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2025 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Kawpow specific constants
	C_epochLength = 7500 // Blocks per epoch

)

Variables

View Source
var ErrInvalidDumpMagic = errors.New("invalid dump magic")

Functions

func SeedHash

func SeedHash(block uint64) []byte

SeedHash is the seed to use for generating a verification cache and the mining dataset.

Types

type Kawpow

type Kawpow struct {
	// contains filtered or unexported fields
}

Kawpow is a proof-of-work consensus engine using the kawpow hash algorithm

func New

func New(config params.PowConfig, notify []string, noverify bool, logger *log.Logger) *Kawpow

New creates a full sized kawpow PoW scheme and starts a background thread for remote mining, also optionally notifying a batch of remote services of new work packages.

func NewFakeDelayer

func NewFakeDelayer(delay time.Duration) *Kawpow

NewFakeDelayer creates a kawpow 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 Quai consensus rules.

func NewFakeFailer

func NewFakeFailer(fail uint64) *Kawpow

NewFakeFailer creates a kawpow 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 Quai consensus rules.

func NewFaker

func NewFaker() *Kawpow

NewFaker creates a kawpow consensus engine with a fake PoW scheme that accepts all blocks' seal as valid, though they still have to conform to the Quai consensus rules.

func NewFullFaker

func NewFullFaker() *Kawpow

NewFullFaker creates an kawpow consensus engine with a full fake scheme that accepts all blocks as valid, without checking any consensus rules whatsoever.

func NewShared

func NewShared() *Kawpow

NewShared creates a full sized kawpow PoW shared between all requesters running in the same process.

func NewTester

func NewTester(notify []string, noverify bool) *Kawpow

NewTester creates a small sized kawpow PoW scheme useful only for testing purposes.

func (*Kawpow) ComputePowHash

func (kawpow *Kawpow) ComputePowHash(header *types.WorkObjectHeader) (common.Hash, error)

func (*Kawpow) ComputePowLight

func (kawpow *Kawpow) ComputePowLight(header *types.WorkObjectHeader) (mixHash, powHash common.Hash)

ComputePowLight computes the kawpow hash and returns mixHash and powHash

func (*Kawpow) Mine

func (kawpow *Kawpow) Mine(workObject *types.WorkObject, abort <-chan struct{}, found chan *types.WorkObject)

func (*Kawpow) MineToThreshold

func (kawpow *Kawpow) MineToThreshold(workObject *types.WorkObject, workShareThreshold int, abort <-chan struct{}, found chan *types.WorkObject)

func (*Kawpow) Seal

func (kawpow *Kawpow) Seal(header *types.WorkObject, results chan<- *types.WorkObject, stop <-chan struct{}) error

Seal implements consensus.Engine, attempting to find a nonce that satisfies the header's difficulty requirements.

func (*Kawpow) SetThreads

func (kawpow *Kawpow) SetThreads(threads int)

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.

func (*Kawpow) Threads

func (kawpow *Kawpow) Threads() int

Threads returns the number of mining threads currently enabled. This doesn't necessarily mean that mining is running!

func (*Kawpow) VerifyKawpowShare

func (kawpow *Kawpow) VerifyKawpowShare(headerHash common.Hash, nonce uint64, blockNumber uint64) (common.Hash, common.Hash, error)

VerifyKawpowShare validates a Kawpow share for pool mining. This function is used by mining pools to validate shares without requiring a full WorkObject.

Parameters: - headerHash: The Kawpow header hash (seal hash) from RavencoinBlockHeader.GetKAWPOWHeaderHash() - nonce: The 64-bit nonce value - mixHash: The mix hash submitted by the miner - blockNumber: The block height for epoch calculation

Returns: - calculatedMixHash: The mix hash calculated by the Kawpow algorithm - powHash: The proof-of-work hash to compare against the target - error: Any error that occurred during calculation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL