aquahash

package
v1.7.17 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2025 License: GPL-3.0 Imports: 23 Imported by: 6

Documentation

Overview

Package aquahash implements the aquahash proof-of-work consensus engine.

Index

Constants

View Source
const (
	ModeNormal   = ethashdag.ModeNormal
	ModeShared   = ethashdag.ModeShared
	ModeTest     = ethashdag.ModeTest
	ModeFake     = ethashdag.ModeFake
	ModeFullFake = ethashdag.ModeFullFake
)

Variables

View Source
var (
	BlockReward = params.BlockReward
)

Aquahash proof-of-work protocol constants.

Functions

func CalcDifficulty

func CalcDifficulty(config *params.ChainConfig, time uint64, parent, grandparent *types.Header) *big.Int

CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have when created at time given the parent block's time and difficulty.

func SeedHash

func SeedHash(block uint64, version byte) []byte

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

Types

type Aquahash

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

Aquahash is a consensus engine based on proot-of-work implementing the aquahash algorithm.

func New

func New(config *Config) *Aquahash

New creates a full sized aquahash PoW scheme.

func NewFakeDelayer

func NewFakeDelayer(delay time.Duration) *Aquahash

NewFakeDelayer creates a aquahash 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 Aquachain consensus rules.

func NewFakeFailer

func NewFakeFailer(fail uint64) *Aquahash

NewFakeFailer creates a aquahash 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 Aquachain consensus rules.

func NewFaker

func NewFaker() *Aquahash

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

func NewFullFaker

func NewFullFaker() *Aquahash

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

func NewSharedTesting added in v1.7.17

func NewSharedTesting() *Aquahash

NewSharedTesting creates a full sized aquahash PoW shared between all requesters running in the same process.

func NewTester

func NewTester() *Aquahash

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

func (*Aquahash) APIs

func (aquahash *Aquahash) APIs(chain consensus.ChainReader) []rpc.API

APIs implements consensus.Engine, returning the user facing RPC APIs. Currently that is empty.

func (*Aquahash) Author

func (aquahash *Aquahash) Author(header *types.Header) (common.Address, error)

Author implements consensus.Engine, returning the header's coinbase as the proof-of-work verified author of the block.

func (*Aquahash) CalcDifficulty

func (aquahash *Aquahash) CalcDifficulty(chain consensus.ChainReader, time uint64, parent, grandparent *types.Header) *big.Int

CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have when created at time given the parent block's time and difficulty.

func (*Aquahash) Finalize

func (aquahash *Aquahash) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)

Finalize implements consensus.Engine, accumulating the block and uncle rewards, setting the final state and assembling the block.

func (*Aquahash) Name added in v1.7.17

func (aquahash *Aquahash) Name() string

func (*Aquahash) Prepare

func (aquahash *Aquahash) Prepare(chain consensus.ChainReader, header *types.Header) error

Prepare implements consensus.Engine, initializing the difficulty field of a header to conform to the aquahash protocol. The changes are done inline.

func (*Aquahash) Seal

func (aquahash *Aquahash) 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 (*Aquahash) SetThreads

func (aquahash *Aquahash) 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 (*Aquahash) Threads

func (aquahash *Aquahash) Threads() int

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

func (*Aquahash) VerifyHeader

func (aquahash *Aquahash) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error

VerifyHeader checks whether a header conforms to the consensus rules of the stock Aquachain aquahash engine.

func (*Aquahash) VerifyHeaders

func (aquahash *Aquahash) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)

VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers concurrently. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications.

func (*Aquahash) VerifySeal

func (aquahash *Aquahash) VerifySeal(chain consensus.ChainReader, header *types.Header) error

VerifySeal implements consensus.Engine, checking whether the given block satisfies the PoW difficulty requirements.

func (*Aquahash) VerifyUncles

func (aquahash *Aquahash) VerifyUncles(chain consensus.ChainReader, block *types.Block) error

VerifyUncles verifies that the given block's uncles conform to the consensus rules of the stock Aquachain aquahash engine.

type Config

type Config = ethashdag.Config

Config are the configuration parameters of the aquahash.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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