node-open-mining-portal icon indicating copy to clipboard operation
node-open-mining-portal copied to clipboard

Can't compile stratum-pool

Open Marekkon5 opened this issue 7 years ago • 10 comments

Hello, I got error:

`module.js:471 throw err; ^

Error: Cannot find module 'stratum-pool' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (/home/pi/node-open-mining-portal/libs/poolWorker.js:1:77) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) `

so if I understand it good, I need stratum-pool. So I tried sudo npm install stratum-pool

but no luck. Log (because it is too long): https://pastebin.com/RyFVF5D4 (debug.log) and https://pastebin.com/Qh8pteU0 (simply output) thanks.

Node: 6.10.3 NPM: 3.10.10

Marekkon5 avatar May 18 '17 18:05 Marekkon5

Seems that nobody has a solution for it. Did you fix the problem is also have that same problem

I am on node 8.x and NPM 5.x

mario1987 avatar Jul 05 '17 20:07 mario1987

Cannot find module 'stratum-pool'

Install stratum-pool via npm.

Why You use not required node and npm? https://github.com/zone117x/node-open-mining-portal Requirements Node.js v0.10+

NOMP did not work with newer Node. 0.10.x or maybe 0.12.x

ghost avatar Jul 06 '17 06:07 ghost

Current Node version it only works with is 0.10.x

krisklosterman avatar Jul 06 '17 16:07 krisklosterman

Would love to get a pull request with updates to work with latest node version and NPM modules.

zone117x avatar Jul 06 '17 17:07 zone117x

I have node-multi-hashing updated here, but still needs a few updates https://github.com/krisklosterman/node-multi-hashing It compiles with 8.1.3 but it needs a little touching up, when thats done I can create a pull request. @zone117x I just pulled it into nomp and when i started nomp I am getting this error

buffer.js:125
      throw new Error(
      ^

Error: If encoding is specified then the first argument must be a string
    at new Buffer (buffer.js:125:13)
    at Object.exports.uint256BufferFromHash (/Users/seion/node-stratum-pool/lib/util.js:54:19)
    at Object.exports.CreateGeneration (/Users/seion/node-stratum-pool/lib/transactions.js:222:14)
    at new BlockTemplate (/Users/seion/node-stratum-pool/lib/blockTemplate.js:68:47)
    at JobManager.processTemplate (/Users/seion/node-stratum-pool/lib/jobManager.js:154:32)
    at /Users/seion/node-stratum-pool/lib/pool.js:576:62
    at itemFinished (/Users/seion/node-stratum-pool/lib/daemon.js:156:36)
    at /Users/seion/node-stratum-pool/lib/daemon.js:169:17
    at parseJson (/Users/seion/node-stratum-pool/lib/daemon.js:85:17)
    at IncomingMessage.<anonymous> (/Users/seion/node-stratum-pool/lib/daemon.js:95:17)
2017-07-06 13:07:34 [Master]	[PoolSpawner] Fork 2 died, spawning replacement worker...

krisklosterman avatar Jul 06 '17 17:07 krisklosterman

Looks like I am going to have to update node-stratum-pool to the new nodejs 8 api

new Buffer() is depreciated

krisklosterman avatar Jul 06 '17 17:07 krisklosterman

Not sure if this is a good fix or not If anyone wants to help me maybe we can setup a slack channel and try to clean all this up

exports.uint256BufferFromHash = function(hex){

    var fromHex;

    if (hex != 0) {
        fromHex = Buffer.from(hex, 'hex');
    } else {
        fromHex = Buffer.alloc(32);
        fromHex.fill(0);
    }

    return exports.reverseBuffer(fromHex);
};

it was:

exports.uint256BufferFromHash = function(hex){

    var fromHex = new Buffer(hex, 'hex');

    if (fromHex.length != 32){
        var empty = new Buffer(32);
        empty.fill(0);
        fromHex.copy(empty);
        fromHex = empty;
    }

    return exports.reverseBuffer(fromHex);
};

It does not like the 0 that is passed in.

2017-07-06 13:58:51 [Pool] [verium] (Thread 1) Share accepted at diff 0.03/2.00000769 by ##HIDDEN### [::1] 2017-07-06 13:58:52 [Pool] [verium] (Thread 1) Daemon instance 0 rejected a supposedly valid block node(27397,0x7fffe01313c0) malloc: *** error for object 0x7fff5fbf4ce0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug 2017-07-06 13:58:57 [Master] [PoolSpawner] Fork 0 died, spawning replacement worker...

krisklosterman avatar Jul 06 '17 17:07 krisklosterman

https://join.slack.com/nomp/shared_invite/MjA5Nzk0MzE2NDcwLTE0OTkzNjY3NTMtMTc5ODY1OTQ5OA

krisklosterman avatar Jul 06 '17 18:07 krisklosterman

I am still running into this on Ubuntu 16.04

Simplexletalis avatar Jan 23 '18 07:01 Simplexletalis

In case anyone is still having the uint256BufferFromHash error, I was able to fix it by installing the latest node-stratum-pool module directly from Github:

npm install https://github.com/zone117x/node-stratum-pool/tarball/master

archived-2 avatar Aug 12 '18 17:08 archived-2