ethereumjs-monorepo

@ethereumjs/ethash / Miner

Class: Miner

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Miner(mineObject, ethash)

Create a Miner object

Parameters

Name Type Description
mineObject BlockHeader | Block The object to mine on, either a BlockHeader or a Block object
ethash Ethash Ethash object to use for mining

Defined in

index.ts:64

Properties

solution

Optional solution: Solution

Defined in

index.ts:52

Methods

iterate

iterate(iterations?): Promise<undefined | Solution>

Iterate iterations times over nonces to find a valid PoW. Caches solution if one is found

Parameters

Name Type Default value Description
iterations number 0 Number of iterations to iterate over. If -1 is passed, the loop runs until a solution is found

Returns

Promise<undefined | Solution>

Defined in

index.ts:114


mine

mine(iterations?): Promise<undefined | BlockHeader | Block>

Iterate iterations time over nonces, returns a BlockHeader or Block if a solution is found, undefined otherwise

Parameters

Name Type Default value Description
iterations number 0 Number of iterations to iterate over. If -1 is passed, the loop runs until a solution is found

Returns

Promise<undefined | BlockHeader | Block>

Defined in

index.ts:91


stop

stop(): void

Stop the miner on the next iteration

Returns

void

Defined in

index.ts:81