Skip to content

Latest commit

 

History

History
113 lines (62 loc) · 2.71 KB

File metadata and controls

113 lines (62 loc) · 2.71 KB

@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:63

Properties

solution

Optional solution: Solution

Defined in

index.ts:51

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>

  • undefined if no solution was found, or otherwise a Solution object

Defined in

index.ts:113


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>

  • undefined if no solution was found within the iterations, or a BlockHeader or Block with valid PoW based upon what was passed in the constructor

Defined in

index.ts:90


stop

stop(): void

Stop the miner on the next iteration

Returns

void

Defined in

index.ts:80