We will be sunsetting Advisor during Jan, 2026 and will instead be providing information in Snyk Security DB.

You can begin to take advantage of Snyk Security DB today for a unified, package-centric experience.

How to use the @nimiq/core.Log function in @nimiq/core

To help you get started, we’ve selected a few @nimiq/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github skypool-org / skypool-nimiq-miner / index.js View on Github external
// for special packaging by skypool owners
global.skypool_package = false;

process.env.UV_THREADPOOL_SIZE = 128;
const os = require('os');
const util = require('util');
const ip = require('ip');
const EventEmitter = require('events').EventEmitter;
const Miner = require('./Miner.js');
const Log = require('@nimiq/core').Log;
const setTimeoutPromise = util.promisify(setTimeout);
const CPUType = require('./CPUType');

async function logWithoutExit(text) {
    for (;;) {
        Log.e(text);
        await setTimeoutPromise(2000);
    }
}

let miner = null;
let autoRestartInterval = null;
let switchInedx = 0;

const autoDetectCPU = async () => {
    const addon = require('./build/Release/detectCPU');
github skypool-org / skypool-nimiq-miner / Miner.js View on Github external
const util = require('util');
const os = require('os');
const atob = require('atob');
const WebSocketClient = require('websocket').client;
const Nimiq = require('@nimiq/core');
const Log = Nimiq.Log;
const BigNumber = Nimiq.BigNumber;
let NodeNative;
const P = require('./Protocol.js');
const setTimeoutPromise = util.promisify(setTimeout);

const RANGE = 4096;
const WORKLOADS_PER_THREAD_PC = 75; // 1 thread is 75 * 4096 nonces
const DIFFICULT_PER_THREAD_PC = 2; // 1 thread is 2 difficulty, one share equal to 2*thread*Math.pow(2 ,16) Hashes, 2*thread*65536

class Miner {

    constructor(server, address, name, threads, percent, event, cpu) {
        /** miner metadata */
        this._version = 8;
        this._platform = [os.platform(), os.arch(), os.release()].join(' ');