@ethereumjs/ethash / Miner
• new Miner(mineObject
, ethash
)
Create a Miner object
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 |
• Optional
solution: Solution
▸ iterate(iterations?
): Promise
<undefined
| Solution
>
Iterate iterations
times over nonces to find a valid PoW. Caches solution if one is found
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 |
Promise
<undefined
| Solution
>
undefined
if no solution was found, or otherwise a Solution
object▸ mine(iterations?
): Promise
<undefined
| BlockHeader
| Block
>
Iterate iterations
time over nonces, returns a BlockHeader
or Block
if a solution is found, undefined
otherwise
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 |
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▸ stop(): void
Stop the miner on the next iteration
void