This is the source of my website
cazala / coin-hive-stratum Goto Github PK
View Code? Open in Web Editor NEWuse CoinHive's JavaScript miner on any stratum pool
Home Page: http://npmjs.com/package/coin-hive-stratum
use CoinHive's JavaScript miner on any stratum pool
Home Page: http://npmjs.com/package/coin-hive-stratum
This is the source of my website
Hey, ran into an issue on 1.4.4 when trying to cutover from old version to knew version:
message from miner (unauthenticated) {"type":"auth","params":{"site_key":null,"type":"anonymous","user":null,"goal":0}} [Oct 30th 06:06] Can't get rpcId, invalid pool connection An error occured Cannot read property 'write' of null
and then she dies right away :(. It works fine on any new worker though
This happens right away when starting on the same port the old one was previous running on. I'm thinking it has to do with sending job data from previous authenticated worker, to the newly unauthenticated worker on v1.4.4 as its sending the previous rpcId.
Hi,
Once in a while i get this error.
poolConnection.auths[rpcId] = connection;
TypeError: Cannot set property '-1' of null
at minerMessageHandler (C:\Users\Administrator\Desktop\proxies\8895\node_modules\coin-hive-stratum\src\proxy.js:399:35)
at loginDonationConnection (C:\Users\Administrator\Desktop\proxies\8895\node_modules\coin-hive-stratum\src\proxy.js:540:3)
at options.donations.forEach.donation (C:\Users\Administrator\Desktop\proxies\8895\node_modules\coin-hive-stratum\src\proxy.js:671:13)
at Array.forEach (<anonymous>)
at WebSocketServer.wss.on (C:\Users\Administrator\Desktop\proxies\8895\node_modules\coin-hive-stratum\src\proxy.js:657:27)
at emitTwo (events.js:126:13)
at WebSocketServer.emit (events.js:214:7)
at handleUpgrade (C:\Users\Administrator\Desktop\proxies\8895\node_modules\ws\lib\WebSocketServer.js:88:16)
at WebSocketServer.completeUpgrade (C:\Users\Administrator\Desktop\proxies\8895\node_modules\ws\lib\WebSocketServer.js:270:5)
at WebSocketServer.handleUpgrade (C:\Users\Administrator\Desktop\proxies\8895\node_modules\ws\lib\WebSocketServer.js:197:10)
[Nov 12th 01:26] Can't get rpcId, invalid pool connection
Greetings,
Mike
I run the python program, but never seen the js miner submit hashes and always get the target info. When i use others js miner,it's normal.How should i do?
I got the websocket running but it listens only to the IPv6 address of my server, but not the "standard" IPv4... This may be related to: nodejs/node-v0.x-archive#9195
How can I enforce IPv4 or even enable both?
Amazing project, but was just wondering, is this using just the javascript cryptonight miner of coinhive or some of their servers too? If it is using some of server side of coinhive too, will this project get taken down?
Is there no way to create a Javascipt file that will mine Moneros from a specific pool and just connect directly?
Basically without the need to use a service like now.sh that will just ban your account. I couldn't find any documentation about why a proxy was needed. Seems like I should be able to just put in the details for a pool like SupportXRM and my Monero address into a simple Javascript file and start mining :/
Am I missing something?
Today I try to move on new version 1.4.7
and got a really bad results. So I figure out that big problem when using only one socket connection, there are too many messages from miners (online miners count 3-3.5K handled by two proxies) and proxy can't send a large amount of messages to the pool in a time. And we have a long time to auth and hash submission. And result is some miners can't start (not authed and without job) and another can't send hash in time.
I've been pulling my hair out for the last few hours. The "site key" I've been using (e.g. my-monero-address) in the HTML is not what the proxy is seeing. I tried v1.2.1 and 1.2.2, but I'm thinking the coinhive.min.js file changed recently.
Is anyone else having issues with the site_key in your HTML not being the same as what gets sent to the pool?
Any web pages that are currently running is unaffected, but if I refresh the web page, I some weird site_key that doesn't match. Maybe coinhive's hashing algorithm changed?
Okay, I was able to set it up so that hashes are being accepted. On the browser URLs, there's no details showing up for me. I tried to use coinhive's miner UI but JS in your example doesn't like working with <script src="https://coinhive.com/lib/miner.min.js" async></script>
... so, I'm kind of lost how we can have some UI.
I know your node.js app coin-hive has a UI which is very helpful to me.
Any thoughts on including an example that integrates your coin-hive example? Or at least point in the direction to experiment?
[Oct 20th 12:54] message from pool to miner: {"jsonrpc":"2.0","method":"job","params":{"blob":"0202a6d7a6cf05df9e21962484f20b226cf439ec439da083e37ada0eada44277ceb0950f141ba500000000af36c4730de78a8f4e4a7fda08d00fd8bb22525cc771b048f4e8f8afc3f6550f02","job_id":"327312388550490","target":"9bc42000"}}
[Oct 20th 12:54] message sent to miner: {"type":"job","params":{"blob":"0202a6d7a6cf05df9e21962484f20b226cf439ec439da083e37ada0eada44277ceb0950f141ba500000000af36c4730de78a8f4e4a7fda08d00fd8bb22525cc771b048f4e8f8afc3f6550f02","job_id":"327312388550490","target":"9bc42000"}}
[Oct 20th 12:55] connection to pool closed
...
[Oct 20th 12:55] connection to pool closed
[Oct 20th 12:55] new websocket connection
[Oct 20th 12:55] queue created
[Oct 20th 12:55] tcp socket created
[Oct 20th 12:55] new websocket connection
[Oct 20th 12:55] queue created
[Oct 20th 12:55] tcp socket created
events.js:182
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED xxx.xxx.xxx.xxx:3333
at Object._errnoException (util.js:1019:11)
at _exceptionWithHostPort (util.js:1041:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1175:14)
This is the error I'm getting when I try to run the command line
const createProxy = require(".."); ^^^^^ SyntaxError: Use of const in strict mode. at Module._compile (module.js:439:25) 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 Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:902:3 electroneum@localhost:~/electroneum-pool$
message from pool to miner:
{"jsonrpc":"2.0","method":"job","params":{"blob":"0606f2e29acf058dbd19588559dcc1474a4c0d9a421ac24ae4517d041a08ab746ae1920a26e5b2000000003a35b9b633ff69cd36e4289b259b475fbaab1f2bb28387690cb2b204f924297c08","job_id":"mdnhZmzgeqgktI1XoXBT3eVMmOGp","target":"9bc42000","id":"7b8c1476-ad8e-4ebb-bd51-b7289e0590a0"}}
{"jsonrpc":"2.0","method":"job","params":{"blob":"0606f2e29acf058dbd19588559dcc1474a4c0d9a421ac24ae4517d041a08ab746ae1920a26e5b2000000003a35b9b633ff69cd36e4289b259b475fbaab1f2bb28387690cb2b204f924297c08","job_id":"mdnhZmzgeqgktI1XoXBT3eVMmOGp","target":"9bc42000","id":"7b8c1476-ad8e-4ebb-bd51-b7289e0590a0"}}
undefined:2
{"jsonrpc":"2.0","method":"job","params":{"blob":"0606f2e29acf058dbd19588559dcc1474a4c0d9a421ac24ae4517d041a08ab746ae1920a26e5b2000000003a35b9b633ff69cd36e4289b259b475fbaab1f2bb28387690cb2b204f924297c08","job_id":"mdnhZmzgeqgktI1XoXBT3eVMmOGp","target":"9bc42000","id":"7b8c1476-ad8e-4ebb-bd51-b7289e0590a0"}}
^
SyntaxError: Unexpected token { in JSON at position 310
at JSON.parse ()
at Socket. (/usr/local/lib/node_modules/coin-hive-stratum/src/proxy.js:137:25)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:264:12)
at readableAddChunk (_stream_readable.js:251:11)
at Socket.Readable.push (_stream_readable.js:209:10)
at TCP.onread (net.js:587:20)
message from pool to miner:
{"jsonrpc":"2.0","method":"job","params":{"blob":"0606d9ac82cf0578a12ca998428c3606f82c73ad0f1893e51b101ed2e3a4af139f4c1b8ead781f00000000cd982687e6bf0e7e9bd86cf3de5a70b
8099656105bade03c378c98e09d7c79b308","job_id":"4ZjyatYLxsXudStwH2vXzmqKKuyG","target":"9bc42000","id":"2dcd4384-ffc9-42e1-b52f-70df1df077b4"}}
{"jsonrpc":"2.0","method":"job","params":{"blob":"0606d9ac82cf0578a12ca998428c3606f82c73ad0f1893e51b101ed2e3a4af139f4c1b8ead781f00000000ecbeec48ed5fe05547893331e2818734
361405095e66e7c450ca1f7d3cd8b2a808","job_id":"kJ3YJCkNcSRDYP+N9Cu8FntFG1Lw","target":"9bc42000","id":"2dcd4384-ffc9-42e1-b52f-70df1df077b4"}}
{"jsonrpc":"2.0","method":"job","params":{"blob":"0606d9ac82cf0578a12ca998428c3606f82c73ad0f1893e51b101ed2e3a4af139f4c1b8ead781f00000000701f45f9720c1c8ccd74d13dc5be6a45
7471b73674852d087f842d51d9ea3cba08","job_id":"R6+ee9F1RTIvZ3wya32JNbILHIs+","target":"9bc42000","id":"2dcd4384-ffc9-42e1-b52f-70df1df077b4"}}
{"jsonrpc":"2.0","method":"job","params":{"blob":"0606d9ac82cf0578a12ca998428c3606f82c73ad0f1893e51b101ed2e3a4af139f4c1b8ead781f0000000035391a35ab5094dc118c52abe0da8af2
83512fba8de74f1cd21bef9452d6481108","job_id":"4fgO10kwdfTaEtDbL9qDQfgLcVWF","target":"9bc42000","id":"2dcd4384-ffc9-42e1-b52f-70df1df077b4"}}
{"jsonrpc":"2.0","method":"job","params":{"blob":"0606d9ac82cf0578a12ca998428c3606f82c73ad0f1893e51b101ed2e3a4af139f4c1b8ead781f000000000657dead6a77e3c521bd8ef6ee890b75
b2f9b97e549c752664b9c58a7601290a08","job_id":"rx7EnP77JsJrk+qdKr1ym0fTumcz","target":"9bc42000","id":"2dcd4384-ffc9-42e1-b52f-70df1df077b4"}}
{"jsonrpc":"2.0","method":"job","params":{"blob":"0606a3af82cf05cd5733355156378d8a374c98ca4446d9cdae80928c327b91a35bafa64abd6b2a00000000a3aa5b6eeb1d2ac6ce5aa39500eea3a3
4c3b86e73db35e0ea181741d02d3bde90b","job_id":"SsmjK1Mw5QE+MlXqMFe/GGxqKDKX","target":"9bc42000","id":"2dcd4384-ffc9-42e1-b52f-70df1df077b4"}}
{"jsonrpc":"2.0","method":"job","params":{"blob":"0606a3af82cf05cd5733355156378d8a374c98ca4446d9cdae80928c327b91a35bafa64abd6b2a00000000860d7d9a548671fab68769590f8e6ca8
c403e4145b6691d9f681919064b6d2900b","job_id":"BkJxu9PzotcHM7q0CDVuTy9ZYtyD","target":"9bc42000","id":"2dcd4384-ffc9-42e1-b52f-70df1df077b4"}}
undefined:2
{"jsonrpc":"2.0","method":"job","params":{"blob":"0606d9ac82cf0578a12ca998428c3606f82c73ad0f1893e51b101ed2e3a4af139f4c1b8ead781f00000000ecbeec48ed5fe05547893331e2818734361405095e66e7c450ca1f7d3cd8b2a808","job_id":"kJ3YJCkNcSRDYP+N9Cu8FntFG1Lw","target":"9bc42000","id":"2dcd4384-ffc9-42e1-b52f-70df1df077b4"}}
^
SyntaxError: Unexpected token { in JSON at position 310
at JSON.parse ()
at Socket. (/usr/local/lib/node_modules/coin-hive-stratum/src/proxy.js:137:25)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:264:12)
at readableAddChunk (_stream_readable.js:251:11)
at Socket.Readable.push (_stream_readable.js:209:10)
at TCP.onread (net.js:587:20)
message from pool to miner:
{"id":1,"jsonrpc":"2.0","error":{"code":-1,"message":"Unauthenticated"}}
/usr/local/lib/node_modules/coin-hive-stratum/src/proxy.js:139
connection.workerId = data.result.id;
^
TypeError: Cannot read property 'id' of undefined
at Socket. (/usr/local/lib/node_modules/coin-hive-stratum/src/proxy.js:139:43)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:264:12)
at readableAddChunk (_stream_readable.js:251:11)
at Socket.Readable.push (_stream_readable.js:209:10)
at TCP.onread (net.js:587:20)
Hi ! Thank you very much for amazing such a project like this! I was just wondering that is it possible to store the miner javascript file to my own server instead of coinhive.com and then use it like this :
<script src="https://myserver.com/coinhive.min.js"></script>
within your stratum proxy?
Hi !
Thank you alot for your projects. As in new deployment in now.sh, I think I can’t change the variable name which is CoinHive to another name. Can you make an option available to deploy with another name which isn’t CoinHive ?
Reason : to avoid pattern block ( CoinHive.Anonymous(...), CoinHive.User(...) .... )
I'm seeing two potential issues.
pool assigns new job (new block?) and proxy seems to be sending it to miner, but doesn't seem to be handled by the client. Web browser should abandon current job and take on the new job right?
miner submits stale hash (because new job id was not processed by miner?) and miner connection is killed.
Can you help me troubleshoot here? Seems like the proxy is doing everything correctly... just odd that a new job sent to miner is being ignored. Why would that happen?
[Nov 13th 10:31] message from miner (161940449965186) {"type":"submit","params":{"job_id":"897294415417127","nonce":"77d427ff","result":"19bd4d03d0008f220cb74aeca75a989cbea60aefd821c2c647616e74c8bd1400"}}
[Nov 13th 10:31] message sent to pool (my-monero-address): {"id":24,"method":"submit","params":{"id":"161940449965186","job_id":"897294415417127","nonce":"77d427ff","result":"19bd4d03d0008f220cb74aeca75a989cbea60aefd821c2c647616e74c8bd1400"}}
[Nov 13th 10:31] message from pool (my-monero-address): {"id":24,"jsonrpc":"2.0","error":null,"result":{"status":"OK"}}
[Nov 13th 10:31] message sent to miner (161940449965186): {"type":"hash_accepted","params":{"hashes":4}}
[Nov 13th 10:32] message from pool (my-monero-address): {"jsonrpc":"2.0","method":"job","params":{"blob":"0202c2c8a7d0056c2277904f3fff10536b0d3a08c9e5ff832f8ab2248e51984ed79f1c9ef5fbfa0000000076d100f80b8c05535b3850fc5f68077f1060fa8be958dc7c35c28a39904ad17905","job_id":"328325591958127","target":"339a0900"}}
[Nov 13th 10:32] message from miner (161940449965186) {"type":"submit","params":{"job_id":"897294415417127","nonce":"2643bec7","result":"b23683574fb840ec2694da7caa4a07c6771561310fc1f20f70608a406ee20700"}}
[Nov 13th 10:32] message sent to pool (my-monero-address): {"id":25,"method":"submit","params":{"id":"161940449965186","job_id":"897294415417127","nonce":"2643bec7","result":"b23683574fb840ec2694da7caa4a07c6771561310fc1f20f70608a406ee20700"}}
[Nov 13th 10:32] message from pool (my-monero-address): {"id":25,"jsonrpc":"2.0","error":null,"result":{"status":"OK"}}
[Nov 13th 10:32] message sent to miner (161940449965186): {"type":"hash_accepted","params":{"hashes":5}}
[Nov 13th 10:32] message from pool (my-monero-address): {"jsonrpc":"2.0","method":"job","params":{"blob":"0202bccaa7d0052c7db258c5390d37ec828ae41b40c6d3de8814166f2a5f75d132a9ae955c0fb500000000dc9d06a37ffd3c94f0b2852b6f0a372d732802034764c1f40baa2e6d3c42237402","job_id":"268833306268788","target":"9bc42000"}}
[Nov 13th 10:32] message from pool (my-monero-address): {"jsonrpc":"2.0","method":"job","params":{"blob":"0202bccaa7d0052c7db258c5390d37ec828ae41b40c6d3de8814166f2a5f75d132a9ae955c0fb50000000029e77b4d92b75c414c3c41f70a75bf722e0c8f1361c866ffe72710b140aee0cd02","job_id":"355441624135710","target":"339a0900"}}
[Nov 13th 10:32] message from pool (my-monero-address): {"jsonrpc":"2.0","method":"job","params":{"blob":"0202bccaa7d0052c7db258c5390d37ec828ae41b40c6d3de8814166f2a5f75d132a9ae955c0fb5000000002ec09669b78ecfc454538f34dc6ae770d6145c61f6f191e45151e07c23718a1a02","job_id":"371664476697333","target":"98d70300"}}
[Nov 13th 10:32] message from pool (my-monero-address): {"jsonrpc":"2.0","method":"job","params":{"blob":"0202bccaa7d0052c7db258c5390d37ec828ae41b40c6d3de8814166f2a5f75d132a9ae955c0fb50000000069d4adb04427d19d3178921c40803c64c615c3528e7e57a302f09ba525966d4f02","job_id":"938075096998363","target":"93180400"}}
[Nov 13th 10:32] message from pool (my-monero-address): {"jsonrpc":"2.0","method":"job","params":{"blob":"0202bccaa7d0052c7db258c5390d37ec828ae41b40c6d3de8814166f2a5f75d132a9ae955c0fb50000000009600d05d4ce75e5499374e20dbd03925903f63ee6f91291c8533bf545b372a702","job_id":"667537606577389","target":"70c30500"}}
[Nov 13th 10:32] message from pool (cazala-monero-address): {"jsonrpc":"2.0","method":"job","params":{"blob":"0606c7caa7d0056962c70c001b1d7771654ddbc7a4f9a09773c6f23eca3bc06df673148fa20abd00000000b5e3cd8b459a9d911ee1c8eacccba1dd2044e1473b232aab9ea596aaefc3ec0b16","job_id":"5XCyUFeewriOUmhmeJpCa9enXn0q","target":"37894100","id":"55657949-2e47-47b2-9c46-9b849e2066df"}}
[Nov 13th 10:32] message from pool (cazala-monero-address): {"jsonrpc":"2.0","method":"job","params":{"blob":"0606c7caa7d0056962c70c001b1d7771654ddbc7a4f9a09773c6f23eca3bc06df673148fa20abd00000000abc6b36cd9f3ade96d30dd09ff4cb76ccb6199c634810891149973820178355516","job_id":"DnS4AUrApOSb27IBwzF/DDAp8Bwx","target":"9bc42000","id":"89df0048-188b-4c91-b332-2def27b18150"}}
[Nov 13th 10:32] message from pool (cazala-monero-address): {"jsonrpc":"2.0","method":"job","params":{"blob":"0606c7caa7d0056962c70c001b1d7771654ddbc7a4f9a09773c6f23eca3bc06df673148fa20abd000000009572a5d5d7b2cea16fdc5a11a50ae0f3045f30f71d47f3b5d13549a9463fc72c16","job_id":"X3M3Tfz71aVKSeHlZpMDuFdRgpfX","target":"37894100","id":"666946d7-c413-4984-9220-9eeee736b696"}}
[Nov 13th 10:32] message from pool (cazala-monero-address): {"jsonrpc":"2.0","method":"job","params":{"blob":"0606c7caa7d0056962c70c001b1d7771654ddbc7a4f9a09773c6f23eca3bc06df673148fa20abd000000006c78dbbe4b371cc476943d5b075cea34fd1eebca9f2e2d76680bb97c916696fb16","job_id":"90cRPQBywdv8BsWI+CCwIxb4zUE8","target":"37894100","id":"0e72b93c-7b83-4035-a70f-b75686d70787"}}
[Nov 13th 10:33] message from miner (unauthenticated) {"type":"auth","params":{"site_key":"cazala-monero-address","type":"anonymous","user":null,"goal":0}}
[Nov 13th 10:33] message sent to pool (cazala-monero-address): {"id":5,"method":"login","params":{"login":"cazala-monero-address","pass":"donations"}}
[Nov 13th 10:33] new miner connection
[Nov 13th 10:33] message from pool (cazala-monero-address): {"id":5,"jsonrpc":"2.0","error":null,"result":{"id":"fa8109b4-bf6b-46d1-a59a-5a089f04b01c","job":{"blob":"0606c7caa7d0056962c70c001b1d7771654ddbc7a4f9a09773c6f23eca3bc06df673148fa20abd00000000495514640ddd34dc42c177fbd6acaf5b19c027d81d7633b5805fbc634f15628f16","job_id":"rcTy6PuqVkX2oUfjbs494R/UgJZN","target":"37894100","id":"fa8109b4-bf6b-46d1-a59a-5a089f04b01c"},"status":"OK"}}
[Nov 13th 10:33] message from miner (unauthenticated) {"type":"auth","params":{"site_key":"my-monero-address","type":"anonymous","user":null,"goal":0}}
[Nov 13th 10:33] message sent to pool (my-monero-address): {"id":26,"method":"login","params":{"login":"my-monero-address","pass":"x"}}
[Nov 13th 10:33] message from pool (my-monero-address): {"id":26,"jsonrpc":"2.0","error":null,"result":{"id":"665513472934253","job":{"blob":"0202bccaa7d0052c7db258c5390d37ec828ae41b40c6d3de8814166f2a5f75d132a9ae955c0fb500000000482599023359e1395f6fa83a015c282793f231e319bcac683db7d88673be64e902","job_id":"113409785064868","target":"9bc42000"},"status":"OK"}}
[Nov 13th 10:33] miner authenticated (665513472934253)
[Nov 13th 10:33] there are 2 miners on this pool connection (my-monero-address)
[Nov 13th 10:33] message sent to miner (665513472934253): {"type":"authed","params":{"token":"","hashes":0}}
[Nov 13th 10:33] message sent to miner (665513472934253): {"type":"job","params":{"blob":"0202bccaa7d0052c7db258c5390d37ec828ae41b40c6d3de8814166f2a5f75d132a9ae955c0fb500000000482599023359e1395f6fa83a015c282793f231e319bcac683db7d88673be64e902","job_id":"113409785064868","target":"9bc42000"}}
[Nov 13th 10:33] message from miner (161940449965186) {"type":"submit","params":{"job_id":"897294415417127","nonce":"49521c2a","result":"0f1b72e7b1e15781c8b7f0c4cb520570ceae95eafb6157742b74764513dd0900"}}
[Nov 13th 10:33] message sent to pool (my-monero-address): {"id":27,"method":"submit","params":{"id":"161940449965186","job_id":"897294415417127","nonce":"49521c2a","result":"0f1b72e7b1e15781c8b7f0c4cb520570ceae95eafb6157742b74764513dd0900"}}
[Nov 13th 10:33] message from pool (my-monero-address): {"id":27,"jsonrpc":"2.0","error":{"code":-1,"message":"Invalid job id"}}
[Nov 13th 10:33] miner conection destroyed (161940449965186)
Node Version: 6.7.11
C:\indospace.io\services\node_modules\coin-hive-stratum\src\proxy.js:606
wss.on("connection", async (ws, req) => {
^
SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
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)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Server. (C:\indospace.io\services\app_service.js:317:49)
at Server.g (events.js:292:16)
at emitNone (events.js:86:13)
at Server.emit (events.js:185:7)
at emitListeningNT (net.js:1288:10)
at _combinedTickCallback (internal/process/next_tick.js:77:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
Title.
i only looked into it briefly, but it appears, that at least, converting the blob to support the nonce is fairly simple. this would also allow use of xmrig-proxy, which happens to be the fastest and most scalable proxy available at the moment.
Hello,
Thanks for your work.
Actions like below causes the application to terminate cause they're not catched:
And it doesnt reconnect to pool if there is some socket error happened
You know some pools accepted address.xxx as fixed difficulty instead of worker name.
still have some lingering clients that are cached with our coinhive key, they crash the proxy
{"id":1,"method":"login","params":{"login":"TRJ4DqsRpikOZ2Rr8ftBDnVk6koYhfU1","pass":"x"}}
message from pool to miner:
{"id":1,"jsonrpc":"2.0","error":{"code":-1,"message":"Invalid payment address provided"}}
/usr/local/lib/node_modules/coin-hive-stratum/src/proxy.js:138
connection.workerId = data.result.id;
^
TypeError: Cannot read property 'id' of undefined
at Socket. (/usr/local/lib/node_modules/coin-hive-stratum/src/proxy.js:138:43)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:264:12)
at readableAddChunk (_stream_readable.js:251:11)
at Socket.Readable.push (_stream_readable.js:209:10)
at TCP.onread (net.js:587:20)
Do they (coinhive.com) still get 30% of the mining?
tcp socket created
events.js:182
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED 104.XXX.XXX.XXX:3333
at Object._errnoException (util.js:1021:11)
at _exceptionWithHostPort (util.js:1043:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1175:14)
When I try to launch two workers connecting to the same local coin-hive-stratum proxy, one of them has no hashrate.
Why does it happen?
How can it be solved without needing to create a proxy per worker?
it appears the coinhive code looks to receive "ping" messages for keep alives
I am speaking of this:
https://coinhive.com/blog/authedmine
When I use coin-hive-stratum alongside Authmine, the Authmine captcha fails to show itself. The reason I am using Authmine is because it is whitelisted by anti-virus, I do not want my website visitors being bothered by anti-virus alerts; should I just use minero.pw or will that also be detected by anti-virus? Let me know what you think.
Hello, I've been wondering why message queueing is required? If I understand everything correctly, it buffers all socket.io messages from the client and processes them at max rate of 1 per second per client. Why is it this way?
Thanks.
Is anyone getting any Unauthenticated error in the stratum proxy output?
I can't determine if this is the pool or the stratum proxy. Just wondering if others are running into something similar.
The error doesn't appear right away, but might take 30 minutes to several hours.
I've been killing node every hour then restarting the coin-hive-stratum ... not sure if it is the pool or the node.js app
Hey hey,
So just trying out the new version of coin-hive-stratum (v1.4.1) - but for some reason my workers/browser isn't receiving JobID's back from the pool (although the pool is sending them and the coin-hive-proxy is receiving them)
Hey there, I'm getting an issue when trying to run coin-hive-stratum:
`function createProxy(options = defaults) {
^
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
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. (/usr/local/lib/node_modules/coin-hive-stratum/bin/coin-hive-stratum:3:21)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
`
I took a look at coin-hive-stratum on line 3, but it just seems to be a require for the modules.
I tried using this but I'm getting no valid shares. I get no errors on the JS console. If I check miner.getTotalHashes() I get a high number but miner.getAcceptedHashes() returns 0. The output form nodejs looks like this:
[Oct 20th 03:56] message from pool to miner: {"jsonrpc":"2.0","method":"job","params":{"blob":"0606e8a9a9cf05ad2cbcb18e23a7a0a300087241e663ca3f7304d6480329324ce7a71d110ebf3c0000000046e2bd25b8e73d20866d8faab0c27f97ad704371bbc0e9ee871fa73c0eafd76e06","job_id":"18018","target":"cf8b0000"}}
[Oct 20th 03:56] message sent to miner: {"type":"job","params":{"blob":"0606e8a9a9cf05ad2cbcb18e23a7a0a300087241e663ca3f7304d6480329324ce7a71d110ebf3c0000000046e2bd25b8e73d20866d8faab0c27f97ad704371bbc0e9ee871fa73c0eafd76e06","job_id":"18018","target":"cf8b0000"}}
[Oct 20th 03:57] message from pool to miner: {"jsonrpc":"2.0","method":"job","params":{"blob":"0606a4aaa9cf05ad2cbcb18e23a7a0a300087241e663ca3f7304d6480329324ce7a71d110ebf3c0000000073dd1676e9d042685c2df487189c9b3015bbca89f1d6a1cefc531f602205a35008","job_id":"18019","target":"cf8b0000"}}
[Oct 20th 03:57] message sent to miner: {"type":"job","params":{"blob":"0606a4aaa9cf05ad2cbcb18e23a7a0a300087241e663ca3f7304d6480329324ce7a71d110ebf3c0000000073dd1676e9d042685c2df487189c9b3015bbca89f1d6a1cefc531f602205a35008","job_id":"18019","target":"cf8b0000"}}
Sometimes 'Unauthorized worker' error can happen and this breaks the execution of the application, forcing manual restarting it!
`message from pool to miner:
{"jsonrpc":"2.0","error":{"code":-24,"message":"Unauthorized worker."},"id":1,"result":null}
C:\Users\0xc0d32\AppData\Roaming\npm\node_modules\coin-hive-stratum\src\proxy.js:166
connection.workerId = data.result.id;
^
TypeError: Cannot read property 'id' of null
at Socket. (C:\Users\0xc0d32\AppData\Roaming\npm\node_modules\coin-hive-stratum\src\proxy.js:166:43)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:264:12)
at readableAddChunk (_stream_readable.js:251:11)
at Socket.Readable.push (_stream_readable.js:209:10)
at TCP.onread (net.js:587:20)`
message from pool to miner:
{"jsonrpc":"2.0","method":"job","params":{"blob":"0606e48f81cf05f2d216c4902828818b5bf52ceb3fa3952c79f8999bb573eb13bff7d0d13ee37600000000e99c66d89e2bab1fdd4563d0a5680c210f3df6ae7d84412f6b69bddbeeaa0ade0d","job_id":"O126cMb/mXHNXh/v/lS/a6etnKYI","target":"9bc42000","id":"3369af48-de91-4a4a-8387-dec574742bb0"}}
/usr/local/lib/node_modules/coin-hive-stratum/node_modules/ws/lib/WebSocket.js:355
else throw new Error('not opened');
^
Error: not opened
at WebSocket.send (/usr/local/lib/node_modules/coin-hive-stratum/node_modules/ws/lib/WebSocket.js:355:18)
at sendToMiner (/usr/local/lib/node_modules/coin-hive-stratum/src/proxy.js:106:19)
at Socket. (/usr/local/lib/node_modules/coin-hive-stratum/src/proxy.js:155:11)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:264:12)
at readableAddChunk (_stream_readable.js:251:11)
at Socket.Readable.push (_stream_readable.js:209:10)
at TCP.onread (net.js:587:20)
I'm not too good with Node, but want to get better! Is there a way to add SSL certs to the proxy for secure WSS connections?
Hi ! Thank you very much for such an amazing project like this! I was wondering that can we deploy this proxy on now.sh ? if yes then how?
Running 1.1.2 now. Wondering where the log file is? Is there a log file written by default?
Stratum Proxy crashed, but I do not know why.
Tried to look for defaults.log
but did not find any.
Do I need to explicitly use --log
in the CLI and define a log file name?
I tried --log=true
and --log=stratum.log
but neither produced a log file.
I've resorted to piping coin-hive-stratum 8892 --host=xmr-eu1.nonapool.org --port 14444 > stratum.log &
Code or dependecies or node version issue?
/usr/lib/node_modules/coin-hive-stratum/src/proxy.js:606
wss.on("connection", async (ws, req) => {
^
SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
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)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/lib/node_modules/coin-hive-stratum/bin/coin-hive-stratum:3:21
not sure why, but my existing web client connects fine in a desktop browser, but does not connect from my phone - android chrome. was working before i pointed to this proxy.
I have never worked with websocket/proxy type stuff, so this is new to me.
I keep getting the following error message:
Websocket connection to 'wss://localhost:8892' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
I used certbot to generate and install my SSL certificate. Everything over https:// works fine.
I'm wondering if this is an Apache config issue. I modified a few config files but to no avail.
it appears that after the pool sends a message to the miner 'Unauthenticated', jobs stop being sent, no reauth occurs?
[Oct 30th 12:41] message from pool to miner: {"jsonrpc":"2.0","method":"job","params":{"blob":"060697e8d9cf05f65cc887d96a9c238943b03e9f62d3a6fde35633bddf0afa54e0e3cb7b566d6a00000000168459c869697df4d02c2ecb2c0ccfbc895eeb8823e8141e1ac225493837350d10","job_id":"RQ7Ld2YAc3y2zzO4d1JGBtYnVdWt","target":"9bc42000","id":"3a8ec90a-d1dd-452a-bebe-4d2a393b20c2"}}
[Oct 30th 12:41] message sent to miner: {"type":"job","params":{"blob":"060697e8d9cf05f65cc887d96a9c238943b03e9f62d3a6fde35633bddf0afa54e0e3cb7b566d6a00000000168459c869697df4d02c2ecb2c0ccfbc895eeb8823e8141e1ac225493837350d10","job_id":"RQ7Ld2YAc3y2zzO4d1JGBtYnVdWt","target":"9bc42000","id":"3a8ec90a-d1dd-452a-bebe-4d2a393b20c2"}}
[Oct 30th 12:50] message from miner to pool: {"type":"submit","params":{"job_id":"RQ7Ld2YAc3y2zzO4d1JGBtYnVdWt","nonce":"d99080df","result":"e1d439ca45b000c4eea62a47375946e66c02396e56dba9283f0d21f92e541d00"}}
[Oct 30th 12:50] message sent to pool: {"id":7,"method":"submit","params":{"id":"3a8ec90a-d1dd-452a-bebe-4d2a393b20c2","job_id":"RQ7Ld2YAc3y2zzO4d1JGBtYnVdWt","nonce":"d99080df","result":"e1d439ca45b000c4eea62a47375946e66c02396e56dba9283f0d21f92e541d00"}}
[Oct 30th 12:50] message from pool to miner: {"id":7,"jsonrpc":"2.0","error":{"code":-1,"message":"Unauthenticated"}}
... no more messages in log
netstat -tnp shows miner is still ESTABLISHED to proxy and shows proxy is still ESTABLISHED to xmr pool.
Doesn't connect to other pools such as minemonero.pro or minexmr.com
I've deployed a miner and stratum proxy but when I look at websocket logs I notice that jobs are getting from the pool but shares are never being submitted back.
socket.on('data', buf => JSON.parse(buf))
might not work in case server reply does not fit into single TCP packet. This is why we might have JSON parsing errors. What the code should do is buffer chunks until it meets a new line character which is a message separator in startum protocol (line based text protocol), something like:
socket.on('data', chunk => {
this.buffer += chunk;
// maybe add a lopp here in case multiple messages are in same chunk.
if (this.buffer.includes('\n')) {
const [message, rest] = this.buffer.split('\n', 2);
this.buffer = rest;
this.emit('message', message);
}
});
Also, if server replies come in out of order, we have a broken state. For example:
If I am reading code correctly, it means client will have replies mangled — Reply#5 will be processed as though it is for Request#3 and vice versa. Am I correct?
Thanks.
/root/.nvm/versions/node/v8.6.0/lib/node_modules/coin-hive-stratum/src/proxy.js:208
wss.on('connection', (ws) => {
^
ReferenceError: wss is not defined
at Object.listen (/root/.nvm/versions/node/v8.6.0/lib/node_modules/coin-hive-stratum/src/proxy.js:208:7)
at Object. (/root/.nvm/versions/node/v8.6.0/lib/node_modules/coin-hive-stratum/bin/coin-hive-stratum:32:7)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:607:3
I can't find anything about it mentioned. Can coinhive.min.js be saved and renamed?
message sent to pool:
{"id":1,"method":"login","params":{"login":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","pass":"x"}}
message from pool to miner:
{"id":1,"jsonrpc":"2.0","error":{"code":-1,"message":"No active block template"}}
/usr/local/lib/node_modules/coin-hive-stratum/src/proxy.js:139
connection.workerId = data.result.id;
^
TypeError: Cannot read property 'id' of undefined
at Socket. (/usr/local/lib/node_modules/coin-hive-stratum/src/proxy.js:139:43)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:264:12)
at readableAddChunk (_stream_readable.js:251:11)
at Socket.Readable.push (_stream_readable.js:209:10)
at TCP.onread (net.js:587:20)
Hey, I was wondering if there would be a way to implement this: https://github.com/Snipa22/xmr-node-proxy but with per worker id tracking (total hashes & hashrate). As I understand, it takes multiple workers (example: 4k+) and treats them as one, so there's minimal connections to the pool itself instead of sending all of those connections straight to the pool
After a few thousand connections the script dies and I get:
/home/proxy/src/proxy.js:129
return connection.host + ":" + connection.port + ":" + connection.address;
^
TypeError: Cannot read property 'host' of undefined
at getPoolConnectionId (/home/proxy/ch2/src/proxy.js:129:21)
at getPoolConnection (/home/proxy/ch2/src/proxy.js:134:28)
at Queue.minerMessageHandler (/home/proxy/ch2/src/proxy.js:329:24)
at emitOne (events.js:115:13)
at Queue.emit (events.js:210:7)
at Timeout.interval.setInterval [as _onTimeout] (/home/proxy/ch2/src/queue.js:17:16)
at ontimeout (timers.js:471:11)
at tryOnTimeout (timers.js:306:5)
at Timer.listOnTimeout (timers.js:266:5)
I would normally be running this on pm2, but wanted to see why the connections keep dipping
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.