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.SerialBuffer 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 / Miner.js View on Github external
const startNonce4096 = taskObject.workrange4096queue.shift();
            // if this task run out
            if (startNonce4096 === undefined) {
                this._taskQueue.shift();
                continue;
            }
            // if this task run to threshold, pull next task
            if (taskObject.workrange4096queue.length === this._workrange4096pullThreshold) {
                this._pull();
            }
            const startNonce = startNonce4096 * RANGE;
            const endNonce = startNonce + RANGE;

            percentTime = new Date();

            const result = await this._multiMine(new Nimiq.SerialBuffer(taskObject.header), this._compact, startNonce, endNonce);
            percentDuration = new Date() - percentTime;

            if (result && taskObject.timeNonce36 === this._timeNonce36) {
                Log.i(Miner, `mined a share, timeNonce36 ${taskObject.timeNonce36}, nonce ${result.nonce}`);
                this._push(
                    taskObject.timeNonce36,
                    result.nonce,
                    taskObject.index,
                );
            }
            this._currHashrate += RANGE;

            if (this._percentX > 0) {
                await setTimeoutPromise(percentDuration * this._percentX);
            }