How to use the Miner function from bindings

Find comprehensive JavaScript bindings.Miner code examples handpicked from public code repositorys.

7
8
9
10
11
12
13
14
15
16
class Miner extends Nimiq.Observable {

    constructor(deviceOptions) {
        super();

        this._miner = new NativeMiner.Miner();
        this._devices = this._miner.getDevices();
        this._devices.forEach((device, idx) => {
            const options = deviceOptions.forDevice(idx);
            if (!options.enabled) {
fork icon11
star icon12
watch icon2

+ 3 other calls in file

23
24
25
26
27
28
29
30
31
32
this._workId = 0;

allowedDevices = Array.isArray(allowedDevices) ? allowedDevices : [];
memorySizes = Array.isArray(memorySizes) ? memorySizes : [];

const miner = new NativeMiner.Miner(allowedDevices, memorySizes);
const workers = miner.getWorkers();

this._hashes = new Array(workers.length).fill(0);
this._lastHashRates = this._hashes.map(_ => []);
fork icon11
star icon0
watch icon2

27
28
29
30
31
32
33
34
35
36
allowedDevices = Array.isArray(allowedDevices) ? allowedDevices : [];
memorySizes = Array.isArray(memorySizes) ? memorySizes : [];
threads = Array.isArray(threads) ? threads : [];
cacheSizes = Array.isArray(cacheSizes) ? cacheSizes : [];

const miner = new NativeMiner.Miner(allowedDevices, memorySizes, threads, cacheSizes);
const workers = miner.getWorkers();

this._hashes = [];
this._lastHashRates = [];
fork icon11
star icon0
watch icon1

35
36
37
38
39
40
41
42
43
44
        memorySizes.push(options.memory);
        threads.push(options.threads);
    }
}

const miner = new NativeMiner.Miner(allowedDevices, memorySizes, threads);
const workers = miner.getWorkers();

this._hashes = [];
this._lastHashRates = [];
fork icon0
star icon0
watch icon3

Other functions in bindings

Sorted by popularity

function icon

bindings.createKey is the most popular function in bindings (8616 examples)