zone117x / node-cryptonote-pool

Mining pool for CryptoNote based coins such as Bytecoin and Monero
GNU General Public License v2.0
826 stars 1.14k forks source link

problem with node init.js #293

Open nickcocchiarella opened 6 years ago

nickcocchiarella commented 6 years ago

When I type this sudo node init.js

I get this

Failed to read config file config.json

SyntaxError: Unexpected token / /home/user123/node-cryptonote-pool/lib/logger.js:16 var logDir = config.logging.files.directory; ^

ReferenceError: config is not defined at Object. (/home/user123/node-cryptonote-pool/lib/logger.js:16:14) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object. (/home/user123/node-cryptonote-pool/init.js:10:1) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10)

However, in my directory, I got this - I have this;

user123@ubuntu:~/node-cryptonote-pool$ dir
config.json  lib      node_modules   package.json  redisBlocksUpgrade.js
init.js      LICENSE  npm-debug.log  README.md     website_example
user123@ubuntu:~/node-cryptonote-pool$ 

So you can see I have the config.json - wondering if it's at the correct place or not? or something I am missing.

p2svn commented 6 years ago

did you run npm update ?

nickcocchiarella commented 6 years ago

Yes, it's now running I fixed an issue with it earlier, however this is the new error I am getting following fixing the previous issue (radis server now installed). module.js:356 Module._extensions[extension](this, filename); ^ Error: /home/user123/pool/node_modules/bignum/binding/bignum.node: undefined symbol: node_module_register at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/home/user123/pool/node_modules/bignum/index.js:4:11) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) 2018-02-19 08:10:42 [master] Pool fork 24 died, spawning replacement worker...

p2svn commented 6 years ago

Try with node 0.10.48

nvm install 0.10.48 nvm use 0.10.48 nvm use default

Then, rebuild source

cd node-cryptonode-pool
rm -rf node_modules
npm update
nickcocchiarella commented 6 years ago

Hi! That fix seems to have done something this is new error?

2018-02-19 09:22:20 [pool] (Thread 18) Error polling getblocktemplate {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect"} 2018-02-19 09:22:20 [pool] (Thread 21) Error polling getblocktemplate {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect"} 2018-02-19 09:22:20 [pool] (Thread 22) Error polling getblocktemplate {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect"} 2018-02-19 09:22:20 [pool] (Thread 20) Error polling getblocktemplate {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect"} 2018-02-19 09:22:20 [pool] (Thread 23) Error polling getblocktemplate {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect"} 2018-02-19 09:22:20 [pool] (Thread 24) Error polling getblocktemplate {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect"}

nickcocchiarella commented 6 years ago

That is nothing to do with you, this is the deamon config. let me reconfigure and i'll come back.

nickcocchiarella commented 6 years ago

Now getting the same error, after doing what you said again;

sudo node init.js Failed to read config file config.json

SyntaxError: Unexpected token /

/home/user123/node-cryptonote-pool/lib/logger.js:16 var logDir = config.logging.files.directory; ^ ReferenceError: config is not defined at Object. (/home/user123/node-cryptonote-pool/lib/logger.js:16:14) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/home/user123/node-cryptonote-pool/init.js:10:1) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10)

p2svn commented 6 years ago

hi ! please make sure that you install enough lib. Ubuntu 16: `apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev

apt-get install libboost-all-dev git npm nodejs nodejs-legacy libminiupnpc-dev redis-server

add-apt-repository ppa:bitcoin/bitcoin

apt-get update

apt-get install libdb4.8-dev libdb4.8++-dev`

Ubuntu 14 `apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev

apt-get install libboost-all-dev git npm nodejs nodejs-legacy libminiupnpc-dev redis-server

add-apt-repository ppa:bitcoin/bitcoin

apt-get update

apt-get install libdb4.8-dev libdb4.8++-dev

curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh

source ~/.profile

nvm install 0.10.25

nvm use 0.10.25`

nickcocchiarella commented 6 years ago

`sudo node init.js Failed to read config file config.json

SyntaxError: Unexpected string /home/user123/node-cryptonote-pool/lib/logger.js:16 var logDir = config.logging.files.directory; ^

ReferenceError: config is not defined at Object. (/home/user123/node-cryptonote-pool/lib/logger.js:16:14) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object. (/home/user123/node-cryptonote-pool/init.js:10:1) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10)`

This still don't work.

p2svn commented 6 years ago

you need rebuild source again and edit in config.json

nickcocchiarella commented 6 years ago

gyp ERR! build error gyp ERR! stack Error:make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:269:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Linux 4.4.0-112-generic gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild" gyp ERR! cwd /home/user123/node-cryptonote-pool/node_modules/multi-hashing gyp ERR! node -v v4.2.6 gyp ERR! node-gyp -v v3.0.3 gyp ERR! not ok cryptonote-pool@0.0.1 /home/user123/node-cryptonote-pool └── cryptonote-util@0.0.3 (git://github.com/romankosoj/node-cryptonote-util.git#b5474a8adff6786d2e3f86c5003c0833ca59aa5d)

npm ERR! Linux 4.4.0-112-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "update" npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! code ELIFECYCLE

npm ERR! multi-hashing@0.0.9 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the multi-hashing@0.0.9 install script 'node-gyp rebuild'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the multi-hashing package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs multi-hashing npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls multi-hashing npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /home/user123/node-cryptonote-pool/npm-debug.log `

p2svn commented 6 years ago

which ubuntu you use ? 16 or 14 ?

p2svn commented 6 years ago

use node 0.10.48

nickcocchiarella commented 6 years ago

The same with 48. I'm on ubuntu 16.

npm ERR! Linux 4.4.0-112-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "update" npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! code ELIFECYCLE

npm ERR! multi-hashing@0.0.9 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the multi-hashing@0.0.9 install script 'node-gyp rebuild'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the multi-hashing package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs multi-hashing npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls multi-hashing npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /home/user123/node-cryptonote-pool/npm-debug.log

p2svn commented 6 years ago

did you do rm -rf node_modules before npm update ?

nickcocchiarella commented 6 years ago

Yes

nickcocchiarella commented 6 years ago

544 sudo npm update 545 nvm install 0.10.48 546 nvm use 0.10.48 547 nvm use default 548 rm -rf node_modules 549 sudo rm -rf node_modules 550 sudo npm update 551 history

p2svn commented 6 years ago

why sudo ? run without sudo

p2svn commented 6 years ago

npm update

nickcocchiarella commented 6 years ago

I'm using ubuntu, ubuntu is required for sudo

nickcocchiarella commented 6 years ago

npm ERR! error rolling back errno: 3, npm ERR! error rolling back code: 'EACCES', npm ERR! error rolling back path: '/home/user123/node-cryptonote-pool/node_modules/cryptonote-util' } npm ERR! Linux 4.4.0-112-generic npm ERR! argv "/home/user123/.nvm/v0.10.48/bin/node" "/home/user123/.nvm/v0.10.48/bin/npm" "update" npm ERR! node v0.10.48 npm ERR! npm v2.15.1 npm ERR! path npm-debug.log.3522203672 npm ERR! code EACCES npm ERR! errno 3

npm ERR! Error: EACCES, open 'npm-debug.log.3522203672' npm ERR! { [Error: EACCES, open 'npm-debug.log.3522203672'] errno: 3, code: 'EACCES', path: 'npm-debug.log.3522203672' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request: npm ERR! /home/user123/node-cryptonote-pool/npm-debug.log user123@ubuntu:~/node-cryptonote-pool$

p2svn commented 6 years ago

npm not required root permision.

nickcocchiarella commented 6 years ago

user123@ubuntu:~/node-cryptonote-pool$ npm update npm ERR! tar.unpack untar error /home/user123/.npm/multi-hashing/0.0.9/package.tgz npm ERR! Linux 4.4.0-112-generic npm ERR! argv "/home/user123/.nvm/v0.10.48/bin/node" "/home/user123/.nvm/v0.10.48/bin/npm" "update" npm ERR! node v0.10.48 npm ERR! npm v2.15.1 npm ERR! path /home/user123/node-cryptonote-pool/node_modules/cryptonote-util npm ERR! code EACCES npm ERR! errno 3

npm ERR! Error: EACCES, rmdir '/home/user123/node-cryptonote-pool/node_modules/cryptonote-util' npm ERR! { [Error: EACCES, rmdir '/home/user123/node-cryptonote-pool/node_modules/cryptonote-util'] npm ERR! errno: 3, npm ERR! code: 'EACCES', npm ERR! path: '/home/user123/node-cryptonote-pool/node_modules/cryptonote-util' } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! error rolling back Error: EACCES, rmdir '/home/user123/node-cryptonote-pool/node_modules/cryptonote-util' npm ERR! error rolling back { [Error: EACCES, rmdir '/home/user123/node-cryptonote-pool/node_modules/cryptonote-util'] npm ERR! error rolling back errno: 3, npm ERR! error rolling back code: 'EACCES', npm ERR! error rolling back path: '/home/user123/node-cryptonote-pool/node_modules/cryptonote-util' } npm ERR! Linux 4.4.0-112-generic npm ERR! argv "/home/user123/.nvm/v0.10.48/bin/node" "/home/user123/.nvm/v0.10.48/bin/npm" "update" npm ERR! node v0.10.48 npm ERR! npm v2.15.1 npm ERR! path npm-debug.log.3522203672 npm ERR! code EACCES npm ERR! errno 3

npm ERR! Error: EACCES, open 'npm-debug.log.3522203672' npm ERR! { [Error: EACCES, open 'npm-debug.log.3522203672'] errno: 3, code: 'EACCES', path: 'npm-debug.log.3522203672' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request: npm ERR! /home/user123/node-cryptonote-pool/npm-debug.log

p2svn commented 6 years ago

change to user root.

nickcocchiarella commented 6 years ago

Switched to root; root@ubuntu:/home/user123/node-cryptonote-pool# node init.js Failed to read config file config.json

SyntaxError: Unexpected string

/home/user123/node-cryptonote-pool/lib/logger.js:16 var logDir = config.logging.files.directory; ^ ReferenceError: config is not defined at Object. (/home/user123/node-cryptonote-pool/lib/logger.js:16:14) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/home/user123/node-cryptonote-pool/init.js:10:1) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) root@ubuntu:/home/user123/node-cryptonote-pool#

p2svn commented 6 years ago

did you edit config_example.json and change it into name config.json ?

nickcocchiarella commented 6 years ago

yes

nickcocchiarella commented 6 years ago

root@ubuntu:/home/user123/node-cryptonote-pool# dir build init.js LICENSE node_modules README.md website_example config.json lib logs package.json redisBlocksUpgrade.js root@ubuntu:/home/user123/node-cryptonote-pool#

p2svn commented 6 years ago

ahhh ! got big problem

Failed to read config file config.json

SyntaxError: Unexpected string

have error when you edit haha. check spelling.

nickcocchiarella commented 6 years ago

default script: Failed to read config file config.json

SyntaxError: Unexpected token /

/home/user123/node-cryptonote-pool/lib/logger.js:16 var logDir = config.logging.files.directory; ^ ReferenceError: config is not defined at Object. (/home/user123/node-cryptonote-pool/lib/logger.js:16:14) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/home/user123/node-cryptonote-pool/init.js:10:1) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) root@ubuntu:/home/user123/node-cryptonote-pool#

p2svn commented 6 years ago

let me see your config.js file

nickcocchiarella commented 6 years ago

`root@ubuntu:/home/user123/node-cryptonote-pool# cat config.json / Used for storage in redis so multiple coins can share the same redis instance. / "coin": "monero",

/ Used for front-end display / "symbol": "MRO",

"logging": {

"files": {

    /* Specifies the level of log output verbosity. This level and anything
       more severe will be logged. Options are: info, warn, or error. */
    "level": "info",

    /* Directory where to write log files. */
    "directory": "logs",

    /* How often (in seconds) to append/flush data to the log files. */
    "flushInterval": 5
},

"console": {
    "level": "info",
    /* Gives console output useful colors. If you direct that output to a log file
       then disable this feature to avoid nasty characters in the file. */
    "colors": true
}

},

/ Modular Pool Server / "poolServer": { "enabled": true,

/* Set to "auto" by default which will spawn one process/fork/worker for each CPU
   core in your system. Each of these workers will run a separate instance of your
   pool(s), and the kernel will load balance miners using these forks. Optionally,
   the 'forks' field can be a number for how many forks will be spawned. */
"clusterForks": "auto",

/* Address where block rewards go, and miner payments come from. */
"poolAddress": "4AsBy39rpUMTmgTUARGq2bFQWhDhdQNekK5v4uaLU699NPAnx9CubEJ82AkvD5ScoAZNYRwBxybayainhyThHAZWCdKmPYn"

/* Poll RPC daemons for new blocks every this many milliseconds. */
"blockRefreshInterval": 1000,

/* How many seconds until we consider a miner disconnected. */
"minerTimeout": 900,

"ports": [
    {
        "port": 3333, //Port for mining apps to connect to
        "difficulty": 100, //Initial difficulty miners are set to
        "desc": "Low end hardware" //Description of port
    },
    {
        "port": 5555,
        "difficulty": 2000,
        "desc": "Mid range hardware"
    },
    {
        "port": 7777,
        "difficulty": 10000,
        "desc": "High end hardware"
    }
],

/* Variable difficulty is a feature that will automatically adjust difficulty for
   individual miners based on their hashrate in order to lower networking and CPU
   overhead. */
"varDiff": {
    "minDiff": 2, //Minimum difficulty
    "maxDiff": 100000,
    "targetTime": 100, //Try to get 1 share per this many seconds
    "retargetTime": 30, //Check to see if we should retarget every this many seconds
    "variancePercent": 30, //Allow time to vary this % from target without retargeting
    "maxJump": 100 //Limit diff percent increase/decrease in a single retargetting
},

/* Feature to trust share difficulties from miners which can
   significantly reduce CPU load. */
"shareTrust": {
    "enabled": true,
    "min": 10, //Minimum percent probability for share hashing
    "stepDown": 3, //Increase trust probability % this much with each valid share
    "threshold": 10, //Amount of valid shares required before trusting begins
    "penalty": 30 //Upon breaking trust require this many valid share before trusting
},

/* If under low-diff share attack we can ban their IP to reduce system/network load. */
"banning": {
    "enabled": true,
    "time": 600, //How many seconds to ban worker for
    "invalidPercent": 25, //What percent of invalid shares triggers ban
    "checkThreshold": 30 //Perform check when this many shares have been submitted
},
/* [Warning: several reports of this feature being broken. Proposed fix needs to be tested.] 
    Slush Mining is a reward calculation technique which disincentivizes pool hopping and rewards 
    'loyal' miners by valuing younger shares higher than older shares. Remember adjusting the weight!
    More about it here: https://mining.bitcoin.cz/help/#!/manual/rewards */
"slushMining": {
    "enabled": false, //Enables slush mining. Recommended for pools catering to professional miners
    "weight": 300, //Defines how fast the score assigned to a share declines in time. The value should roughly be equivalent to the average round duration in seconds divided by 8. When deviating by too much numbers may get too high for JS.
    "lastBlockCheckRate": 1 //How often the pool checks the timestamp of the last block. Lower numbers increase load but raise precision of the share value
}

},

/ Module that sends payments to miners according to their submitted shares. / "payments": { "enabled": true, "interval": 600, //how often to run in seconds "maxAddresses": 50, //split up payments if sending to more than this many addresses "mixin": 3, //number of transactions yours is indistinguishable from "transferFee": 5000000000, //fee to pay for each transaction "minPayment": 100000000000, //miner balance required before sending payment "denomination": 100000000000 //truncate to this precision and store remainder },

/ Module that monitors the submitted block maturities and manages rounds. Confirmed blocks mark the end of a round where workers' balances are increased in proportion to their shares. / "blockUnlocker": { "enabled": true, "interval": 30, //how often to check block statuses in seconds

/* Block depth required for a block to unlocked/mature. Found in daemon source as
   the variable CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW */
"depth": 60,
"poolFee": 1.8, //1.8% pool fee (2% total fee total including donations)
"devDonation": 0.1, //0.1% donation to send to pool dev - only works with Monero
"coreDevDonation": 0.1 //0.1% donation to send to core devs - only works with Monero

},

/ AJAX API used for front-end website. / "api": { "enabled": true, "hashrateWindow": 600, //how many second worth of shares used to estimate hash rate "updateInterval": 3, //gather stats and broadcast every this many seconds "port": 8117, "blocks": 30, //amount of blocks to send at a time "payments": 30, //amount of payments to send at a time "password": "test" //password required for admin stats },

/ Coin daemon connection details. / "daemon": { "host": "127.0.0.1", "port": 18081 },

/ Wallet daemon connection details. / "wallet": { "host": "127.0.0.1", "port": 8082 },

/ Redis connection into. / "redis": { "host": "127.0.0.1", "port": 6379, "auth": null //If set, client will run redis auth command on connect. Use for remote db } `

nickcocchiarella commented 6 years ago

I've just changed it to the default one on the page, same error.

p2svn commented 6 years ago

clear all comment line Need build with clean config See this. https://raw.githubusercontent.com/zone117x/node-cryptonote-pool/master/config_example.json

nickcocchiarella commented 6 years ago

This seems to have brought it alive. Which is good. Let's see if I can get the deamon sync'd to it.

nickcocchiarella commented 6 years ago

what's the command to open up 8117 on ubuntu? you got it handy?

p2svn commented 6 years ago

have 2 part: Daemon RPC: ./monerod ( it rpc bind port default is 18081 for monero ) Wallet RPC: ./monero-wallet-rpc --rpc-bind-port 8082 --wallet-file path_to_your_wallet --confirm-bind-port

nickcocchiarella commented 6 years ago

I'm getting this error Error: Failed to parse block at Object.BlockTemplate.nextBlob (/root/pool/lib/pool.js:130:23) at Object.Miner.getJob (/root/pool/lib/pool.js:303:41) at handleMinerMethod (/root/pool/lib/pool.js:514:28) at handleMessage (/root/pool/lib/pool.js:648:13) at Socket.socket.on.on.on.pushMessage (/root/pool/lib/pool.js:702:25) at Socket.emit (events.js:95:17) at Socket. (_streamreadable.js:765:14) at Socket.emit (events.js:92:17) at emitReadable (_stream_readable.js:427:10) at emitReadable (_stream_readable.js:423:5)

MoNo7 commented 6 years ago

initial issue was just missing ; on the preceeding line before the log file is set in var logDir=

new issue is with cryptonote-util in package.json