ethereumjs-monorepo

@ethereumjs/ethash / Ethash

Class: Ethash

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Ethash(cacheDB?)

Parameters

Name Type
cacheDB? DB<number, DBObject>

Defined in

index.ts:169

Properties

cache

cache: Uint8Array[]

Defined in

index.ts:163


cacheDB

Optional cacheDB: DB<number, DBObject>

Defined in

index.ts:162


cacheSize

Optional cacheSize: number

Defined in

index.ts:166


dbOpts

dbOpts: Object

Defined in

index.ts:161


epoc

Optional epoc: number

Defined in

index.ts:164


fullSize

Optional fullSize: number

Defined in

index.ts:165


seed

Optional seed: Uint8Array

Defined in

index.ts:167

Methods

_verifyPOW

_verifyPOW(header): Promise<boolean>

Parameters

Name Type
header BlockHeader

Returns

Promise<boolean>

Defined in

index.ts:369


cacheHash

cacheHash(): Uint8Array

Returns

Uint8Array

Defined in

index.ts:257


calcDatasetItem

calcDatasetItem(i): Uint8Array

Parameters

Name Type
i number

Returns

Uint8Array

Defined in

index.ts:197


getMiner

getMiner(mineObject): Miner

Returns a Miner object To mine a BlockHeader or Block, use the one-liner await ethash.getMiner(block).mine(-1)

Parameters

Name Type Description
mineObject BlockHeader | Block Object to mine on, either a BlockHeader or a Block

Returns

Miner

Defined in

index.ts:365


headerHash

headerHash(rawHeader): Uint8Array

Parameters

Name Type
rawHeader Uint8Array[]

Returns

Uint8Array

Defined in

index.ts:272


loadEpoc

loadEpoc(number): Promise<void>

Loads the seed and cache given a block number.

Parameters

Name Type
number bigint

Returns

Promise<void>

Defined in

index.ts:279


mkcache

mkcache(cacheSize, seed): Uint8Array[]

Parameters

Name Type
cacheSize number
seed Uint8Array

Returns

Uint8Array[]

Defined in

index.ts:177


run

run(val, nonce, fullSize?): Object

Parameters

Name Type
val Uint8Array
nonce Uint8Array
fullSize? number

Returns

Object

Name Type
hash Uint8Array
mix Uint8Array

Defined in

index.ts:211


verifyPOW

verifyPOW(block): Promise<boolean>

Parameters

Name Type
block Block

Returns

Promise<boolean>

Defined in

index.ts:379