Home Reference Source
public class | source

InterfaceBlockchainMiningWorkers

Extends:

InterfaceBlockchainMiningBasicInterfaceBlockchainMining → InterfaceBlockchainMiningWorkers

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public
public
public

block: *

public
public

end: *

public

start: *

public

workers: *

Private Members
private
private

_nonce: *

private
private

Method Summary

Public Methods
public
public

async decreaseWorkers(number: *)

public

async increaseWorkers(number: *)

public

mine(block: *, difficultyTarget: *, start: *, end: *): *

public

async setWorkers(newWorkers: *)

public

async startMining()

public

async stopMining()

Private Methods
private

_getWorker(): {}

private

_puzzleReceived(worker: *, event: *): boolean

private

Inherited Summary

From class InterfaceBlockchainMiningBasic
public get
public set
public get
public set
public get
public
public
public
public
public
public
private
private
private
private
private
private
private
public

async loadMinerAddress(defaultAddress: *, Wallet: *): boolean

public

async mineNextBlock(suspend: *)

public
public

async saveMinerAddress(minerAddress: *): boolean

public

async startMining()

public
private
private

_setAddress(newAddress: *, save: boolean): *

private
From class InterfaceBlockchainMining
public
public
public

block: *

public
public
public
private
public

calculateHash(nonce: *): *

public

async getNextBlock(): *

public

async mine(block: *, difficulty: *): Promise<boolean>

Simple Mining with no Workers

public

async mineBlock(block: *, difficulty: *)

Mine a specific Block

public

async mineNextBlock(suspend: *)

mine next block

private

async _mineNonces(start: *, end: *): {"result": *, "hash": *, "nonce": *}

private

Public Constructors

public constructor() source

Override:

InterfaceBlockchainMining#constructor

Public Members

public WORKER_NONCES_WORK: number source

public bestHash: * source

Override:

InterfaceBlockchainMining#bestHash

public bestHashNonce: * source

Override:

InterfaceBlockchainMining#bestHashNonce

public block: * source

Override:

InterfaceBlockchainMining#block

public difficulty: * source

Override:

InterfaceBlockchainMining#difficulty

public end: * source

public start: * source

public workers: * source

Private Members

private _hashesPerSecond: number source

Override:

InterfaceBlockchainMining#_hashesPerSecond

private _nonce: * source

Override:

InterfaceBlockchainMiningBasic#_nonce

private _workerFinished: boolean source

private _workerResolve: * source

Public Methods

public checkFinished(): boolean source

Return:

boolean

public async decreaseWorkers(number: *) source

Params:

NameTypeAttributeDescription
number *

public async increaseWorkers(number: *) source

Params:

NameTypeAttributeDescription
number *

public mine(block: *, difficultyTarget: *, start: *, end: *): * source

Simple Mining with no Workers

Override:

InterfaceBlockchainMining#mine

Params:

NameTypeAttributeDescription
block *
difficultyTarget *
start *
end *

Return:

*

public async setWorkers(newWorkers: *) source

Params:

NameTypeAttributeDescription
newWorkers *

public async startMining() source

Override:

InterfaceBlockchainMiningBasic#startMining

public async stopMining() source

Override:

InterfaceBlockchainMiningBasic#stopMining

Private Methods

private _getWorker(): {} source

Return:

{}

private _puzzleReceived(worker: *, event: *): boolean source

Params:

NameTypeAttributeDescription
worker *
event *

Return:

boolean

private _suspendMiningWorking() source