Home Reference Source Test
public class | source

Miner

Extends:

Observable → Miner

Direct Subclass:

BasePoolMiner

Indirect Subclass:

NanoPoolMiner, SmartPoolMiner

Constructor Summary

Public Constructor
public

constructor(blockchain: BaseChain, accounts: Accounts, mempool: Mempool, time: Time, minerAddress: Address, extraData: Uint8Array)

Member Summary

Public Members
public get
public set
public set

extraData: Uint8Array

public get

extraData: Uint8Array

public get

hashrate: number

public get

numBlocksMined: number

public get
public set

shareCompact: number

public set

threads(threads: number)

public get

threads: number

public get

throttleAfter: number

public set

throttleAfter(throttleAfter: number)

public get

throttleWait: number

public set

throttleWait(throttleWait: number)

public get

working: boolean

Method Summary

Public Methods
public

async getNextBlock(address: Address, extraData: Uint8Array): Promise<Block>

public

async onWorkerShare(obj: {hash: Hash, nonce: number, block: Block})

public
public
Protected Methods
protected

async _getNextBody(interlinkSize: number, address: Address, extraData: Uint8Array): BlockBody

protected

async _getNextHeader(nextTarget: BigNumber, interlink: BlockInterlink, body: BlockBody): Promise<BlockHeader>

protected

_getNextInterlink(nextTarget: BigNumber): Promise<BlockInterlink>

protected

_getNextTimestamp(): number

Inherited Summary

From class Observable
public static get

WILDCARD: string: string

public

bubble(observable: Observable, types: ...string)

public

fire(type: string, args: ...*): Promise | null

public

off(type: string, id: number)

public

on(type: string, callback: Function): number

Public Constructors

public constructor(blockchain: BaseChain, accounts: Accounts, mempool: Mempool, time: Time, minerAddress: Address, extraData: Uint8Array) source

Override:

Observable#constructor

Params:

NameTypeAttributeDescription
blockchain BaseChain
accounts Accounts
mempool Mempool
time Time
minerAddress Address
extraData Uint8Array
  • optional
  • default: new Uint8Array(0)

Listen:

*

Mempool#transaction-added

*

Mempool#transaction-ready

Public Members

public get address: Address source

public set address: Address source

public set extraData: Uint8Array source

public get extraData: Uint8Array source

public get hashrate: number source

public get numBlocksMined: number source

public get shareCompact: * source

public set shareCompact: number source

public set threads(threads: number) source

public get threads: number source

public get throttleAfter: number source

public set throttleAfter(throttleAfter: number) source

public get throttleWait: number source

public set throttleWait(throttleWait: number) source

public get working: boolean source

Public Methods

public async getNextBlock(address: Address, extraData: Uint8Array): Promise<Block> source

Params:

NameTypeAttributeDescription
address Address
  • optional
extraData Uint8Array
  • optional

Return:

Promise<Block>

public async onWorkerShare(obj: {hash: Hash, nonce: number, block: Block}) source

Params:

NameTypeAttributeDescription
obj {hash: Hash, nonce: number, block: Block}

public startWork() source

public stopWork() source

Protected Methods

protected async _getNextBody(interlinkSize: number, address: Address, extraData: Uint8Array): BlockBody source

Params:

NameTypeAttributeDescription
interlinkSize number
address Address
  • optional
extraData Uint8Array
  • optional

Return:

BlockBody

protected async _getNextHeader(nextTarget: BigNumber, interlink: BlockInterlink, body: BlockBody): Promise<BlockHeader> source

Params:

NameTypeAttributeDescription
nextTarget BigNumber
interlink BlockInterlink
body BlockBody

Return:

Promise<BlockHeader>

Params:

NameTypeAttributeDescription
nextTarget BigNumber

Return:

Promise<BlockInterlink>

protected _getNextTimestamp(): number source

Return:

number