Git Product home page Git Product logo

node-stratum-pool's Introduction

This repo is looking for maintainers! Please reach out if interested.


High performance Stratum poolserver in Node.js. One instance of this software can startup and manage multiple coin pools, each with their own daemon and stratum port :)

Notice

This is a module for Node.js that will do nothing on its own. Unless you're a Node.js developer who would like to handle stratum authentication and raw share data then this module will not be of use to you. For a full featured portal that uses this module, see NOMP (Node Open Mining Portal). It handles payments, website front-end, database layer, mutli-coin/pool support, auto-switching miners between coins/pools, etc.. The portal also has an MPOS compatibility mode so that the it can function as a drop-in-replacement for python-stratum-mining.

Build Status

NPM

Why

This server was built to be more efficient and easier to setup, maintain and scale than existing stratum poolservers which are written in python. Compared to the spaghetti state of the latest stratum-mining python server, this software should also have a lower barrier to entry for other developers to fork and add features or fix bugs.

Features

  • Daemon RPC interface
  • Stratum TCP socket server
  • Block template / job manager
  • P2P to get block notifications as peer node
  • Optimized generation transaction building
  • Connecting to multiple daemons for redundancy
  • Process share submissions
  • Session managing for purging DDoS/flood initiated zombie workers
  • Auto ban IPs that are flooding with invalid shares
  • POW (proof-of-work) & POS (proof-of-stake) support
  • Transaction messages support
  • Vardiff (variable difficulty / share limiter)
  • When started with a coin deamon that hasn't finished syncing to the network it shows the blockchain download progress and initializes once synced

Hashing algorithms supported:

  • SHA256 (Bitcoin, Freicoin, Peercoin/PPCoin, Terracoin, etc..)
  • Scrypt (Litecoin, Dogecoin, Feathercoin, etc..)
  • Scrypt-Jane (YaCoin, CopperBars, Pennies, Tickets, etc..)
  • Scrypt-N (Vertcoin [VTC])
  • Quark (Quarkcoin [QRK])
  • X11 (Darkcoin [DRK], Hirocoin, Limecoin)
  • X13 (MaruCoin, BoostCoin)
  • X16R (PexaCoin, RavenCoin)
  • X16RV2 (PexaCoin, RavenCoin)
  • NIST5 (Talkcoin)
  • Keccak (Maxcoin [MAX], HelixCoin, CryptoMeth, Galleon, 365coin, Slothcoin, BitcointalkCoin)
  • Skein (Skeincoin [SKC])
  • Groestl (Groestlcoin [GRS])

May be working (needs additional testing):

  • ? Blake (Blakecoin [BLC])
  • ? Fugue (Fuguecoin [FC])
  • ? Qubit (Qubitcoin [Q2C], Myriadcoin [MYR])
  • ? SHAvite-3 (INKcoin [INK])
  • ? Sha1 (Sha1coin [SHA], Yaycoin [YAY])

Not working currently:

  • Groestl - for Myriadcoin
  • Keccak - for eCoin & Copperlark
  • Hefty1 (Heavycoin [HVC])

Requirements

  • node v0.10+
  • coin daemon (preferably one with a relatively updated API and not some crapcoin :p)

Example Usage

Install as a node module by cloning repository

git clone https://github.com/zone117x/node-stratum-pool node_modules/stratum-pool
npm update

Module usage

Create the configuration for your coin:

Possible options for algorithm: sha256, scrypt, scrypt-jane, scrypt-n, quark, x11, keccak, blake, skein, groestl, fugue, shavite3, hefty1, qubit, or sha1.

var myCoin = {
    "name": "Dogecoin",
    "symbol": "DOGE",
    "algorithm": "scrypt",
    "nValue": 1024, //optional - defaults to 1024
    "rValue": 1, //optional - defaults to 1
    "txMessages": false, //optional - defaults to false,

    /* Magic value only required for setting up p2p block notifications. It is found in the daemon
       source code as the pchMessageStart variable.
       For example, litecoin mainnet magic: http://git.io/Bi8YFw
       And for litecoin testnet magic: http://git.io/NXBYJA */
     "peerMagic": "fbc0b6db" //optional
     "peerMagicTestnet": "fcc1b7dc" //optional
};

If you are using the scrypt-jane algorithm there are additional configurations:

var myCoin = {
    "name": "Freecoin",
    "symbol": "FEC",
    "algorithm": "scrypt-jane",
    "chainStartTime": 1375801200, //defaults to 1367991200 (YACoin) if not used
    "nMin": 6, //defaults to 4 if not used
    "nMax": 32 //defaults to 30 if not used
};

If you are using the scrypt-n algorithm there is an additional configuration:

var myCoin = {
    "name": "Execoin",
    "symbol": "EXE",
    "algorithm": "scrypt-n",
    /* This defaults to Vertcoin's timetable if not used. It is required for scrypt-n coins that
       have modified their N-factor timetable to be different than Vertcoin's. */
    "timeTable": {
        "2048": 1390959880,
        "4096": 1438295269,
        "8192": 1485630658,
        "16384": 1532966047,
        "32768": 1580301436,
        "65536": 1627636825,
        "131072": 1674972214,
        "262144": 1722307603
    }
};

If you are using the keccak algorithm there are additional configurations (The rare normalHashing keccak coins such as Copperlark and eCoin don't appear to work yet - only the popular ones like Maxcoin are):

var myCoin = {
    "name": "eCoin",
    "symbol": "ECN",
    "algorithm": "keccak",

    /* This is not required and set to false by default. Some coins such as Copperlark and eCoin
       require it to be set to true. Maxcoin and most others are false. */
    "normalHashing": true
};

Create and start new pool with configuration options and authentication function

var Stratum = require('stratum-pool');

var pool = Stratum.createPool({

    "coin": myCoin,

    "address": "mi4iBXbBsydtcc5yFmsff2zCFVX4XG7qJc", //Address to where block rewards are given

    /* Block rewards go to the configured pool wallet address to later be paid out to miners,
       except for a percentage that can go to, for examples, pool operator(s) as pool fees or
       or to donations address. Addresses or hashed public keys can be used. Here is an example
       of rewards going to the main pool op, a pool co-owner, and NOMP donation. */
    "rewardRecipients": {
        "n37vuNFkXfk15uFnGoVyHZ6PYQxppD3QqK": 1.5, //1.5% goes to pool op
        "mirj3LtZxbSTharhtXvotqtJXUY7ki5qfx": 0.5, //0.5% goes to a pool co-owner

        /* 0.1% donation to NOMP. This pubkey can accept any type of coin, please leave this in
           your config to help support NOMP development. */
        "22851477d63a085dbc2398c8430af1c09e7343f6": 0.1
    },

    "blockRefreshInterval": 1000, //How often to poll RPC daemons for new blocks, in milliseconds


    /* Some miner apps will consider the pool dead/offline if it doesn't receive anything new jobs
       for around a minute, so every time we broadcast jobs, set a timeout to rebroadcast
       in this many seconds unless we find a new job. Set to zero or remove to disable this. */
    "jobRebroadcastTimeout": 55,

    //instanceId: 37, //Recommend not using this because a crypto-random one will be generated

    /* Some attackers will create thousands of workers that use up all available socket connections,
       usually the workers are zombies and don't submit shares after connecting. This features
       detects those and disconnects them. */
    "connectionTimeout": 600, //Remove workers that haven't been in contact for this many seconds

    /* Sometimes you want the block hashes even for shares that aren't block candidates. */
    "emitInvalidBlockHashes": false,

    /* Enable for client IP addresses to be detected when using a load balancer with TCP proxy
       protocol enabled, such as HAProxy with 'send-proxy' param:
       http://haproxy.1wt.eu/download/1.5/doc/configuration.txt */
    "tcpProxyProtocol": false,

    /* If a worker is submitting a high threshold of invalid shares we can temporarily ban their IP
       to reduce system/network load. Also useful to fight against flooding attacks. If running
       behind something like HAProxy be sure to enable 'tcpProxyProtocol', otherwise you'll end up
       banning your own IP address (and therefore all workers). */
    "banning": {
        "enabled": true,
        "time": 600, //How many seconds to ban worker for
        "invalidPercent": 50, //What percent of invalid shares triggers ban
        "checkThreshold": 500, //Check invalid percent when this many shares have been submitted
        "purgeInterval": 300 //Every this many seconds clear out the list of old bans
    },

    /* Each pool can have as many ports for your miners to connect to as you wish. Each port can
       be configured to use its own pool difficulty and variable difficulty settings. varDiff is
       optional and will only be used for the ports you configure it for. */
    "ports": {
        "3032": { //A port for your miners to connect to
            "diff": 32, //the pool difficulty for this port

            /* Variable difficulty is a feature that will automatically adjust difficulty for
               individual miners based on their hashrate in order to lower networking overhead */
            "varDiff": {
                "minDiff": 8, //Minimum difficulty
                "maxDiff": 512, //Network difficulty will be used if it is lower than this
                "targetTime": 15, //Try to get 1 share per this many seconds
                "retargetTime": 90, //Check to see if we should retarget every this many seconds
                "variancePercent": 30 //Allow time to very this % from target without retargeting
            }
        },
        "3256": { //Another port for your miners to connect to, this port does not use varDiff
            "diff": 256 //The pool difficulty
        }
    },

    /* Recommended to have at least two daemon instances running in case one drops out-of-sync
       or offline. For redundancy, all instances will be polled for block/transaction updates
       and be used for submitting blocks. Creating a backup daemon involves spawning a daemon
       using the "-datadir=/backup" argument which creates a new daemon instance with it's own
       RPC config. For more info on this see:
          - https://en.bitcoin.it/wiki/Data_directory
          - https://en.bitcoin.it/wiki/Running_bitcoind */
    "daemons": [
        {   //Main daemon instance
            "host": "127.0.0.1",
            "port": 19332,
            "user": "litecoinrpc",
            "password": "testnet"
        },
        {   //Backup daemon instance
            "host": "127.0.0.1",
            "port": 19344,
            "user": "litecoinrpc",
            "password": "testnet"
        }
    ],


    /* This allows the pool to connect to the daemon as a node peer to receive block updates.
       It may be the most efficient way to get block updates (faster than polling, less
       intensive than blocknotify script). It requires the additional field "peerMagic" in
       the coin config. */
    "p2p": {
        "enabled": false,

        /* Host for daemon */
        "host": "127.0.0.1",

        /* Port configured for daemon (this is the actual peer port not RPC port) */
        "port": 19333,

        /* If your coin daemon is new enough (i.e. not a shitcoin) then it will support a p2p
           feature that prevents the daemon from spamming our peer node with unnecessary
           transaction data. Assume its supported but if you have problems try disabling it. */
        "disableTransactions": true

    }

}, function(ip, port , workerName, password, callback){ //stratum authorization function
    console.log("Authorize " + workerName + ":" + password + "@" + ip);
    callback({
        error: null,
        authorized: true,
        disconnect: false
    });
});

Listen to pool events

/*

'data' object contains:
    job: 4, //stratum work job ID
    ip: '71.33.19.37', //ip address of client
    port: 3333, //port of the client
    worker: 'matt.worker1', //stratum worker name
    height: 443795, //block height
    blockReward: 5000000000, //the number of satoshis received as payment for solving this block
    difficulty: 64, //stratum worker difficulty
    shareDiff: 78, //actual difficulty of the share
    blockDiff: 3349, //block difficulty adjusted for share padding
    blockDiffActual: 3349 //actual difficulty for this block


    //AKA the block solution - set if block was found
    blockHash: '110c0447171ad819dd181216d5d80f41e9218e25d833a2789cb8ba289a52eee4',

    //Exists if "emitInvalidBlockHashes" is set to true
    blockHashInvalid: '110c0447171ad819dd181216d5d80f41e9218e25d833a2789cb8ba289a52eee4'

    //txHash is the coinbase transaction hash from the block
    txHash: '41bb22d6cc409f9c0bae2c39cecd2b3e3e1be213754f23d12c5d6d2003d59b1d,

    error: 'low share difficulty' //set if share is rejected for some reason
*/
pool.on('share', function(isValidShare, isValidBlock, data){

    if (isValidBlock)
        console.log('Block found');
    else if (isValidShare)
        console.log('Valid share submitted');
    else if (data.blockHash)
        console.log('We thought a block was found but it was rejected by the daemon');
    else
        console.log('Invalid share submitted')

    console.log('share data: ' + JSON.stringify(data));
});



/*
'severity': can be 'debug', 'warning', 'error'
'logKey':   can be 'system' or 'client' indicating if the error
            was caused by our system or a stratum client
*/
pool.on('log', function(severity, logKey, logText){
    console.log(severity + ': ' + '[' + logKey + '] ' + logText);
});

Start pool

pool.start();

Credits

  • vekexasia - co-developer & great tester
  • LucasJones - got p2p block notify working and implemented additional hashing algos
  • TheSeven - answering an absurd amount of my questions, found the block 1-16 problem, provided example code for peer node functionality
  • pronooob - knowledgeable & helpful
  • Slush0 - stratum protocol, documentation and original python code
  • viperaus - scrypt adaptions to python code
  • ahmedbodi - more algo adaptions to python code
  • steveshit - ported X11 hashing algo from python to node module

Donations

To support development of this project feel free to donate :)

  • BTC: 1KRotMnQpxu3sePQnsVLRy3EraRFYfJQFR
  • LTC: LKfavSDJmwiFdcgaP1bbu46hhyiWw5oFhE
  • VTC: VgW4uFTZcimMSvcnE4cwS3bjJ6P8bcTykN
  • MAX: mWexUXRCX5PWBmfh34p11wzS5WX2VWvTRT
  • QRK: QehPDAhzVQWPwDPQvmn7iT3PoFUGT7o8bC
  • DRK: XcQmhp8ANR7okWAuArcNFZ2bHSB81jpapQ
  • DOGE: DBGGVtwAAit1NPZpRm5Nz9VUFErcvVvHYW
  • Cryptsy Trade Key: 254ca13444be14937b36c44ba29160bd8f02ff76

License

Released under the GNU General Public License v2

http://www.gnu.org/licenses/gpl-2.0.html

node-stratum-pool's People

Contributors

aciddude avatar ahmedbodi avatar bart-is avatar bitbandi avatar bluecircle avatar bmatusiak avatar bolkin avatar bricecarpentier avatar chrisfranko avatar cpuchainorg avatar cremator avatar danielzuwala avatar darcymei avatar darkcoinproject avatar dogui1718 avatar earlz avatar hashunlimited avatar jonnybravo0311 avatar lucasjones avatar minkcrypto avatar romanornr avatar sirsavary avatar stackout avatar suchpool avatar valera-rozuvan avatar vekexasia avatar zone117x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-stratum-pool's Issues

Abusing users are coming!

Hi
I am running a Darkcoin pool.
Yesterday there was some ridiculous hashrate increase and the pool didn't notice that this was abusing user.

Actually darkcoin's difficulty starts from 0.01 for normal 280x gpu.
It may go up 0.02 but I saw difficuclty upto 0.32 for some person. It's impossible!

Actually shares with difficulty 0.08 is very rare, since one miner rig can't handle 8 gpu I think.

When I block that person, he changed IP, ID, and constantly pushed hashes to my pool overnight.

Why is this abusing happen?
I saw other types of abusing on maxcoin pool which isn't running by node-stratum
and I was so tired of monitoring the pool. I launched darkcoin with node-stratum hoping that it may block abusing users well.

It doesn't work well I think.
I think each user's hash must be checked by their difficulty value and block them.
Is it possible?
Or find them by investigating some accumulated average statistics.

I can say more things about abusing people.
There are two types.
One is inputting same difficulty many many times, and the other is inputting shares with false difficulty value.

  1. Inputting same difficulty as 128 and 10 times a second with one worker name. As looking at my experience, this can't be the normal situation even when many miner rigs are using same worker name. Their difficulty value must be lowered to minimum when they use same worker name for many rigs. I learned it from python based stratum-mining Maxcoin pool.

  2. Inputting shares with false difficulty value is what I am experiencing with Darkcoin.
    The code I saw on node-stratum is just checking the minimal difficulty of every share must pass, not based on the difficulty what miner inserted. Is it right? Python based stratum-mining project works same as this too.

Please advise me. This is really big problem that many pool operators are experiencing.
I saw some dogecoin pool told that they suffered with abusing shares and he fixed it.
Sadly, he didn't open the code, I don't know what to do, abusing users are hoping pools until they are blocked.
And other maxcoin pool operator told me that he is blocking abusing users by monitoring
the log. He said some tips for finding abusing users is that abusing users' share never exceed some diff. Their shares never log 'Yay!'. Well, it's about the python based stratum-mining project but you will find hint that what I'm saying. 'Yay!' log in stratum-mining project is just for test code that which checks the share difficulty is greater than some value.

Many pool operators modified stratum for strict check and they didn't share it I think. If Maxcoin's biggest pool 1gh didn't block abusing or modify the stratum, many abusing users would stick to that pool, isn't it? But many of them came to my pool.

One day when I was happy with my pool, abusing users just inputted about 25% shares of my pool and found any blocks for two days. I noticed abusing that day, and still now, couldn't get any perfect solutions.

I think this kind of things must be took seriously for stratum.
Please help, I want to contribute code when I find the solution.

feature: add network difficulty during emit('share')

Hi,

Can you also add the network difficulty during emit('share')? Same as what you did with the block height.

Or maybe much better if you can also add the calculated share per submitted 'share'. Same with MPOS where you can see the shares per minute submitted.

Thanks!

Banning not working with cluster option

Banning not working with cluster option.

Client is banned but can connect to other node child process.
For easy testing, I created 32 processes and could see client banned, connecting to other fork process, submit shares.

I'm not familiar with nodejs but I think some type of propagating "banned IP", "coin name" to master process would be needed.

MPOS mode needs to pool/flush mysql queries to prevent socket exhaustion

Hi I see some logs like "XXXXX has somehow had a socket error"
Sometimes XXXXXX is user name, but sometimes it's just "undefined".

When I run a small pool, it's okay with just one process.
When it gets bigger, the above message comes out frequently and I had to use cluster option to expand processes.

And, when it gets much bigger, I had to create x4 processes.
I am using 8 core server, so I create 32 node child processes.

The problem is, it continually happen time to time even running 32 node processes.
My node-stratum based coin workers are about 300 concurrently, so it's not that big.

I think the problem is, client waits new job but node process not responds
in some amount of time.
(I adapted latest "30 seconds resend job" code also but this problem not solved)

The main problem might be the DB works since it inserts many shares for MPOS compatible in synchronous. It may block thread for a while, isn't it?

Does this happen to just normal node-stratum only?
Or only for MPOS compatible stratum servers.

I want to know problems in detail.
Thanks.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Nonresponsive coin-daemon causes application crash

If node-stratum is passed information for a coin-daemon that does not respond to an RPC request, node-stratum still attempts to read the non-existent response, causing an application crash. Should be an easy fix, will submit a PR shortly.

"Detected updated block transactions" not too fast ?

On production server I see many of Detected updated block transactions

2014-03-11 03:03:24 [system]:   [dogecoin (Fork 25)] Detected updated block transactions
2014-03-11 03:03:24 [system]:   [dogecoin (Fork 25)] Detected updated block transactions
2014-03-11 03:03:25 [system]:   [dogecoin (Fork 25)] Detected updated block transactions
2014-03-11 03:03:25 [system]:   [dogecoin (Fork 25)] Detected updated block transactions
2014-03-11 03:03:26 [system]:   [dogecoin (Fork 25)] Detected updated block transactions
2014-03-11 03:03:26 [system]:   [dogecoin (Fork 25)] Detected updated block transactions
2014-03-11 03:03:27 [system]:   [dogecoin (Fork 25)] Detected updated block transactions
2014-03-11 03:03:27 [system]:   [dogecoin (Fork 25)] Detected updated block transactions
2014-03-11 03:03:28 [system]:   [dogecoin (Fork 25)] Detected updated block transactions
2014-03-11 03:03:28 [system]:   [dogecoin (Fork 25)] Detected updated block transactions

But on daemon debug.log I only see few new transactions in every minute (about 2-3).

BTW
check for block is going every 1s but update block i sometimes refresh few time in one second for every fork.

How to run?

Are these actually two files on the main page?
how to run the node?

DIFFrence of opinion between vertminer and node-stratum on share difficulty

Sumbitting what vertminer thinks is a Diff 62 share node-stratum thinks is a diff 58 share

2014-04-11 00:42:57 [Pool] [Vertcoin] (Thread 3) Share accepted a low diff 58 off by 3.26%

Vertminer = 58 Node-stratum = 54

[2014-04-10 20:02:39] Accepted 04683b74 Diff 58/57 GPU 0 2014-04-11 01:02:54 [Pool] [Vertcoin] (Thread 3) Share accepted a low diff 54 off by 5.18%

Is it vertminer that is incorrect or is it node-stratum?

There is also a concern that this might also pass on a block that barely meets network difficulty.

Ugly error when wrong RPC username/password

This is what I get when I have a wrong RPC username/password in the config file :

2014-03-21 21:05:45 [system]:   [Pool Fork 0 (Darkcoin)] Invalid RPC username or password

/home/daniel/share/www/dev-node-open-mining-portal/node_modules/stratum-pool/lib/daemon.js:144
                var returnObj = {error: error, response: result.result, instan
                                                               ^
TypeError: Cannot read property 'result' of undefined
    at itemFinished (/home/daniel/share/www/dev-node-open-mining-portal/node_modules/stratum-pool/lib/daemon.js:144:64)
    at /home/daniel/share/www/dev-node-open-mining-portal/node_modules/stratum-pool/lib/daemon.js:158:17
    at IncomingMessage.<anonymous> (/home/daniel/share/www/dev-node-open-mining-portal/node_modules/stratum-pool/lib/daemon.js:89:21)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

Wrong issue. Sorry.

Wrong issue again.

It was my fault. I got solution from IRC.

I can't delete issue, so please close it.

Invalid share submitted

I tried to run this stratum node and I've been able to do the setup. So far my worker can connect to it, and even submit valid share, but it doesn't last more than 1 minute. After that it is full of invalid share with a negative difficulty, like

2014-02-01 01:02:46 [client]: [USDE] Invalid share submitted, share data: {"job":"15","ip":"192.168.1.202","worker":"xxx","difficulty":-2.471070400000002,"error":"low difficulty share"}

and on the cgminer side, it shows me lots of hardware error. I never had such errors with the python stratum server, and my rig work as expected on classic pool.

Any idea why is that ?

Wrong address gets inserted in the block

I have specified my address to have the payouts sent to in my pool config:

  address: "mmpfRad7hCSKwuYdGH4Qna4ojJs8dVXnQK"

I'm also connecting to a local instance of bitcoind -testnet:

  daemon: {
    host: "localhost",
    port: 18332,
    user: "rpcuser",
    password: "rpcpasswd"
  }

And are then connecting a cgminer instance to it. It all seems to be working alright and sooner rather than later I will submit a block to bitcoind. For example I submitted this block today:


Block header:
02 00 00 00 3E CD 13 E8 74 CE 15 56 9B 31 98 36 F6 4B 22 E3 94 EB 68 BE C1 D2 5E 2C AB DA EC BD 00 00 00 00 B1 1F 7E 6F 07 7A 46 84 B7 A5 5B 58 80 49 5C 9A 35 BB DB 30 A0 3F 64 07 C3 8B 0C BD D9 FE 5D 46 51 83 FC 52 DF A5 4B 1B EA 7F 74 8B

Num transactions:
04

Transaction #1:
01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF 28 04 50 C4 02 00 06 2F 50 32 53 48 2F 04 51 83 FC 52 08 F8 00 00 00 CA 03 00 00 0D 2F 6E 6F 64 65 53 74 72 61 74 75 6D 2F 00 00 00 00 01 00 F2 05 2A 01 00 00 00 19 76 A9 14 45 2A 28 D1 F5 6C 46 2B CC 60 A6 AF 82 AE DD D0 38 39 B4 B5 88 AC 00 00 00 00

Transaction #2:
01 00 00 00 06 71 47 57 9F FC 9A C7 3C 86 D5 6D B3 22 56 2E 28 05 4F 14 AB 1A D8 42 C2 AD 7A 10 CD 00 04 35 5A 00 00 00 00 6B 48 30 45 02 20 1B EB 37 B6 29 A2 B8 C1 B4 91 CC 63 C0 AB 05 36 31 12 F4 38 57 BE B7 84 77 0D FA 13 19 65 BA 10 02 21 00 82 0E 2B C7 53 9A 35 56 C4 81 C8 19 58 00 1D A4 DD F2 A3 AD FB 26 FC CF 15 5A AE 51 E6 39 74 F3 01 21 02 2D F7 BB B6 F6 A2 E8 D3 2C BE 58 C4 33 6E 1B 0C 50 CC 08 65 62 BF D9 E2 F7 D3 98 34 AD EB 08 59 FF FF FF FF 93 EA 5B FE DB 6E 6E 58 92 07 4E 61 EC EF AD C4 15 01 FA 56 9C EB CC 1A 6E D2 65 64 D1 0D 37 88 01 00 00 00 6C 49 30 46 02 21 00 FD 38 72 0A 69 07 07 43 8C 3A 1A C7 4A 93 F0 71 54 77 67 59 2A 55 F0 0D 44 5A 29 14 68 40 8D 19 02 21 00 FD BB DE C8 0E C4 89 B0 F1 49 A5 1A C0 31 AB C8 77 DE E9 0B 30 42 C3 46 85 30 B0 E6 10 41 B2 07 01 21 03 B3 C6 A3 0E 7D 4B DA 34 1C 8C EE 94 BF 6A 10 34 C7 9F 6C E6 6C E5 6C 68 24 62 04 15 4D 51 A2 C7 FF FF FF FF 63 2F 84 3D 05 58 0C 5A CA FD 3B B7 3F A9 E6 9B C9 7A 20 DF 4A 07 B4 6D 7A 05 30 84 83 AD 3C D8 00 00 00 00 6B 48 30 45 02 21 00 E8 05 6C 71 86 24 3A BC 8A 44 BE E7 FA C1 81 12 60 4F A7 A9 D0 D5 C1 97 DC 6F 70 46 DD 77 88 81 02 20 69 18 A8 34 2A A1 67 AE 8C 6F 92 5D 97 CC CF 05 4F FC 77 0E 8E 94 D5 0F B7 EB E1 8C 5D A1 2A 02 01 21 02 C6 41 1B 85 2A 5A 00 C1 FB 41 12 8D DE 96 86 3B 54 35 FE 11 DF A8 E6 17 F7 48 93 11 45 51 6F 2E FF FF FF FF 6B CF 67 EC C4 FF 29 6F 8A 6A E5 5C D9 B1 79 0A 62 CF 64 05 2B 80 01 6E 6C A7 E8 F0 DB C2 7E F4 01 00 00 00 6C 49 30 46 02 21 00 C5 63 55 EF 7E 35 04 BC 69 04 4B 4D A7 4E D8 40 1E A8 21 C1 41 F5 E8 0D D6 2E E8 41 EF E3 5E BF 02 21 00 AF D5 5F 2A D7 54 9C 6B ED F6 55 4C E3 A1 DD C2 25 E8 F7 11 8E 81 86 83 62 07 25 9F DB 83 74 E6 01 21 02 13 14 69 13 4B A8 1B 56 A9 8C D4 30 4B 88 42 9F 53 DE 0B E7 29 27 70 65 96 4E C5 B9 A3 C1 3D D1 FF FF FF FF 2C 0E 01 0B E5 9D A8 6F ED 70 EB A6 2F 12 EB 37 34 D8 95 86 FA D6 35 FD 44 11 66 24 A8 75 89 DE 00 00 00 00 6C 49 30 46 02 21 00 AC DB 71 61 BF D0 C8 A0 C0 2C 55 F5 79 AB E5 58 92 3E 91 3C 6E 01 59 9E 35 C2 45 3D 19 2C B1 17 02 21 00 E9 15 40 B2 C1 30 AB D4 14 8E 54 C6 69 E9 3C 9D 4F 62 C3 BF B5 57 C6 0B 86 EE 8C 9C C2 EB 53 E2 01 21 02 D2 F5 44 42 08 DA 94 CF 41 A8 F1 FB 72 E5 49 29 E9 78 AC C3 B3 82 05 59 C3 FD C5 D6 B1 E7 D2 B6 FF FF FF FF 13 A8 C0 C8 A9 9C 28 19 1E 3F 3C 10 0D A7 1E 1C 85 FC 03 48 B6 AF 27 B7 B7 CA BA 78 91 E0 05 46 00 00 00 00 6B 48 30 45 02 21 00 DC 23 80 B5 4B 20 EE 9E E6 5E A2 CF 80 CA F4 49 F7 CA 41 57 88 D1 CA 3C 3E 27 D3 46 D0 8C 62 F6 02 20 0F 6F AE BB CC 76 A7 90 69 EE 7A CA 9B 7B AD 11 C0 1D CA FA E7 6D 4A A9 F1 B0 41 83 BA 83 21 2D 01 21 02 63 40 15 35 B6 79 BE A9 D1 1E D1 CA 07 3C 33 47 3E 58 50 49 8C 2E AE 6A B8 2A 71 0C 23 A8 7F 8B FF FF FF FF 01 45 A0 67 C6 00 00 00 00 19 76 A9 14 B1 F4 0C 2A 54 5E 78 13 6F DB 1A F2 20 0F 63 77 A5 58 97 C4 88 AC 00 00 00 00

Transaction #3:
01 00 00 00 02 3D 50 96 C8 3E 74 81 4C F2 1C 63 BC B4 E5 6F 20 79 5A 39 23 30 E5 9E 53 70 3D 94 40 F6 32 12 C4 00 00 00 00 6A 47 30 44 02 20 58 45 F9 8A 47 48 6A 87 BF A4 7A 04 67 64 87 7A 95 4A 65 69 6D 22 8C 21 EB 86 30 68 A6 0B FA 45 02 20 38 1C 17 89 1E 90 44 FD 28 E6 FB 14 8C AC 12 DB DB D1 C6 0D 9F 83 B9 76 26 0F EA 35 09 B6 24 BF 01 21 02 63 54 49 65 C0 62 96 D7 42 86 9C 19 24 7D CA D1 D3 1F DD 2C D1 F6 EA 4A 68 1C 59 42 62 39 EA 7A FF FF FF FF 60 EF EF 98 37 09 73 AD D5 8A 73 D5 AC E6 A5 C4 DF DC FF 9C 04 70 05 31 68 87 7F 88 86 07 0A 4F 00 00 00 00 6B 48 30 45 02 21 00 A6 F9 22 E0 1C 6A F8 EE BD 26 93 B8 0D C0 32 0F BE EF 84 99 6D 0E 68 6E FB F0 9E ED 86 D8 E9 8A 02 20 4C 3B 16 97 A3 2D 12 9A 9B 01 95 50 30 91 E3 2F 2C 59 22 C9 D2 6C 1A 41 86 90 F7 9A 0B DB F1 65 01 21 02 1E F3 6A 8D FC C6 0B BB AC DE BB B2 24 9F 2B EA 1E 54 45 E6 8A C0 0D 7F 74 AF 5D 96 A1 A0 87 91 FF FF FF FF 01 00 C2 EB 0B 00 00 00 00 19 76 A9 14 CE FD AD 16 58 CD C5 C6 89 06 F6 B0 90 48 B0 7F C4 43 41 AF 88 AC 00 00 00 00

Transaction #4:
01 00 00 00 02 29 86 F2 66 B6 70 59 27 58 88 E0 EA C5 98 A5 F1 F3 CD 1D B7 6B 37 6F D2 F6 D8 D4 ED 7A 18 47 52 00 00 00 00 6A 47 30 44 02 20 1B D6 E2 80 74 66 47 11 4E 18 E0 13 48 36 35 4C A3 B2 D9 83 7A EE E8 37 C4 4D B0 FB 3F AC 93 5B 02 20 33 3B 7A BC 91 8B DC 7B C1 BC 15 83 E0 ED 32 C2 1A 02 36 E3 E8 F7 22 01 D6 8D 43 8C 69 38 D1 80 01 21 02 BF BE DE A3 22 8C 71 68 9D F7 34 E6 9B 3F 70 CD 14 D9 08 50 52 3F C2 44 87 D1 FE B0 4F E9 C5 0D FF FF FF FF 29 86 F2 66 B6 70 59 27 58 88 E0 EA C5 98 A5 F1 F3 CD 1D B7 6B 37 6F D2 F6 D8 D4 ED 7A 18 47 52 01 00 00 00 6A 47 30 44 02 20 40 66 28 E6 5D 54 CC F8 79 42 9D E6 99 52 37 33 20 9E 9A D2 B1 A9 74 FD 30 60 EE 59 D1 77 19 C4 02 20 44 7B 25 15 1A CC 5B 22 6E 2F B2 58 80 CD 44 DB 81 6F 21 5D 1A 3A 40 EB 92 0A E1 34 2F 77 B9 49 01 21 03 9F 91 10 D2 55 BE 03 3C 53 A9 C9 E1 B3 2F 4F F5 33 44 C6 37 1C BB 5A 37 A0 25 2E 15 03 87 9A 24 FF FF FF FF 02 00 E1 F5 05 00 00 00 00 19 76 A9 14 D7 33 1B C1 3C BF 14 04 46 CC 11 08 85 B4 47 A1 12 C0 36 58 88 AC 01 00 00 00 00 00 00 00 19 76 A9 14 8D E1 8A 42 7D BA 91 1E AC F8 02 75 BA 66 9C D4 E5 3C 51 71 88 AC 00 00 00 00

The first transaction is the one that sends the block-solving-reward to my address of choice, however when decoding the transaction (using https://blockchain.info/decode-tx) I get this result:

{
   "lock_time":0,
   "inputs":[
      {
         "prev_out":{
            "index":4294967295,
            "hash":"0000000000000000000000000000000000000000000000000000000000000000"
         },
         "script":"0450c40200062f503253482f045183fc5208f8000000ca0300000d2f6e6f64655374726174756d2f"
      }
   ],
   "vout_sz":1,
   "hash":"e3c2e7b674df562675e6535e9bce3db439fd8309a3e646882665cbc8a8fcf68a",
   "vin_sz":1,
   "out":[
      {
         "address":"17Ji8XY8tB15Ao51Yi62xerUsKGRfgCb5s",
         "script_string":"OP_DUP OP_HASH160 452a28d1f56c462bcc60a6af82aeddd03839b4b5 OP_EQUALVERIFY OP_CHECKSIG",
         "value":5000000000,
         "script":"76a914452a28d1f56c462bcc60a6af82aeddd03839b4b588ac"
      }
   ],
   "size":125,
   "version":1
}

So for some reason, node-stratum is sending my bitcoins to 17Ji8XY8tB15Ao51Yi62xerUsKGRfgCb5s instead of mmpfRad7hCSKwuYdGH4Qna4ojJs8dVXnQK.

bitcoind -testnet validateaddress mmpfRad7hCSKwuYdGH4Qna4ojJs8dVXnQK gives { "isvalid" : true ... }

Store "last miner difficulty" for bugged miners that submit low shares after vardiff increase

Hi, I am testing aphrodite coin.

It's current net hash difficulty is 156.
When I set pool's default difficulty to 128 to lower, it says sometimes "low share difficulty" rejected.

Does minimum share difficulty needs to be bigger than net hash difficulty?
And how can I achieve this since net difficulty seems to change time to time.

Is there anyone who can answer about "difficulty"?

switchpool

it will be very useful to have ability to switch pools without disconnecting workers or restarting the server

Block share is not marked/returned anymore

Hi zone,

this pool server is great work. It's really time to move away from the hard maintainable python solutions.

  1. One of your last version worked well. But now the registed event ...

pool.on('share', function(isValidShare, isValidBlock, data){

... does not deliver any blockshares. Blocks are correctly submitted to coindaemon, but blockshares do not show up anymore with this event. Problem is not limited to a specific coin. Any idea? Regular shares correctly propagate to this event.

  1. You added variable shareDiff. Vardiff difficulty is limit to 512. But some shares occur with shareDiff 1000 or even 5000. Is data.shareDiff calculated correctly and should this diff be used to reward miner instead of data.difficulty?

Thank you very much,
PPanther

Accepted untracked stratum share from (null)

I'm starting to create a new pool for darkcoin but this is the first time I've seen this log from sgminer. But it the share hash(?) appeared once after a difficulty change.

(Kindly disregard "(null)". It is a problem with darkcoin sgminer version)

[15:20:56] Accepted untracked stratum share from (null)
[15:20:56] Accepted untracked stratum share from (null)
[15:20:57] (null) difficulty changed to 0.001736
[15:20:57] Accepted 44040000 Diff 0/0 GPU 4
[15:20:57] Accepted untracked stratum share from (null)

Is this normal?

Btw, my config is:

var pool = stratum.createPool({
        name: "Darkcoin",
        symbol: "drk",
        algorithm: "x11",
        reward: "POW",
        txMessages: false,
        address: "MydArkCo1nadDr3ss",
        stratumPort: "3333",
        difficulty: 0.000868,
        blockRefreshInterval: 2,
        daemon: {
                host: "127.0.0.1",
                port: 9998,
                user: "rpcuser",
                password: "rpcpass"
        },
        varDiff: {
                enabled: true,
                minDifficulty: 0.000868,
                maxDifficulty: 300,
                daemonDiffUpdateFrequency: 3600, //3600
                targetTime: 30,
                retargetTime: 120,
                variancePercent: 20
        }
}, function(ip, wokerName, password, callback) {
        console.log("Authorize " + wokerName + ":" + password + "@" + ip);
        callback({
                error: null,
                authorized: true,
                disconnect: false
        });
});

[Windows] Process finished with exit code -1073740940

Upon startup stratum-pool crashes with no useful error and brings down the rest of the application with it. This has only occurred on my Windows 8 machine and did not appear on my Debian 7 server but I am still trying to replicate on Debian. Before the crash, I get the following output:

debug: [system] Starting pool for LuckyCoin [LKY]
debug: [system] Connecting to daemon(s)
debug: [system] Daemon instance 0 is running on testnet
debug: [system] Connected to daemon via RPC

Sometimes the last line does not show, leading me to believe the error is occurring while the pool initialization is happening. Going to try changing some things with the coin daemon to see if I get different results.

address_to_pubkeyhash buffer 'cksumA = addr.slice(-4);' 'start out of bounds'

i am getting a error

debug: [system] VarDiff enabled and setup
debug: [system] Connecting to daemon
debug: [system] Connected to daemon
buffer.js:560
  if (start < 0) throw new Error('start out of bounds');
^
Error: start out of bounds
    at Buffer.slice (buffer.js:560:24)
    at Object.exports.address_to_pubkeyhash (/home/ubuntu/projects/ftc/node_modules/stratum-pool/lib/util.js:198:23)
    at Object.exports.script_to_address (/home/ubuntu/projects/ftc/node_modules/stratum-pool/lib/util.js:226:21)
    at module.exports._this.stratumServer.stratum.Server.port (/home/ubuntu/projects/ftc/node_modules/stratum-pool/lib/pool.js:187:26)
    at _parallel (/home/ubuntu/projects/ftc/node_modules/stratum-pool/node_modules/async/lib/async.js:530:17)
    at async.each (/home/ubuntu/projects/ftc/node_modules/stratum-pool/node_modules/async/lib/async.js:116:25)
    at i (/home/ubuntu/projects/ftc/node_modules/stratum-pool/node_modules/async/lib/async.js:24:16)
    at _parallel (/home/ubuntu/projects/ftc/node_modules/stratum-pool/node_modules/async/lib/async.js:527:21)
    at module.exports._this.daemon.cmd.mode (/home/ubuntu/projects/ftc/node_modules/stratum-pool/lib/pool.js:70:21)
    at IncomingMessage. (/home/ubuntu/projects/ftc/node_modules/stratum-pool/lib/daemon.js:89:21)

breaks at var cksumA = addr.slice(-4);

exports.address_to_pubkeyhash = function(addr){
    addr = base58.decode(addr);

    if (addr.length != 25){
        console.log('invalid address length for ' + addr);
        throw 'invalid address length';
    }

    if (!addr)
        return null;

    var ver = addr[0];
    var cksumA = addr.slice(-4);
    var cksumB = exports.doublesha(addr.slice(0, -4)).slice(0, 4);

    if (cksumA.toString('hex') != cksumB.toString('hex'))
        throw 'checksum did not match';

    return [ver, addr.slice(1,-4)];
};

npm update broken , fails on a node-stratum-pool error

here is node-mining-open-portal npm update results.. i posted there but i think this belongs here.

sudo npm update.

....
....

[email protected] node_modules/request/node_modules/hawk
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
npm http GET https://registry.npmjs.org/base58-native
npm http 304 https://registry.npmjs.org/base58-native
npm http GET https://registry.npmjs.org/bindings
[email protected] node_modules/mysql/node_modules/bignumber.js
npm http 304 https://registry.npmjs.org/bindings

[email protected] install /root/node-open-mining-portal-master/node_modules/stratum-pool/node_modules/multi-hashing
node-gyp rebuild
Traceback (most recent call last):
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in
sys.exit(gyp.script_main())
AttributeError: 'module' object has no attribute 'script_main'
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.11.0-19-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/node-open-mining-portal-master/node_modules/stratum-pool/node_modules/multi-hashing
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR! npm owner ls multi-hashing
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.11.0-19-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "update"
npm ERR! cwd /root/node-open-mining-portal-master
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/node-open-mining-portal-master/npm-debug.log
npm ERR! not ok code 0

Scrypt-jane needs modified to support custom params from coin-creators

Ultracoin is scryptjane based coin.

When I run ultracoin pool, all shares are rejected saying that "low difficulty share"

By investigating other pools, they seems like running python based
stratum-mining project and starts from 16 difficulty.

I changed default difficulty up and down but no luck.

Currently, node-stratum doesn't work well with scrypt-jane algo I think.

auto useradd function?

Is node-stratum have option to add worker name to DB automatically?
I don't mean the username, only the worker name.

I haven't run the codes yet but I couldn't find any option about it.
I think this project is great.

Vardiff doesn't work due to a simple mistake

There is a simple mistake in pool.js that causes the varDiff options to not be passed to the varDiff constructor. The fix is to replace options.ports[port] by options.ports[port].varDiff:

function SetupVarDiff(){
  Object.keys(options.ports).forEach(function(port) {
    _this.setVarDiff(port, new varDiff(port, options.ports[port].varDiff));
  });
}

x11 abusing happens. really!

Today I opened givecoin pool. It is x11 algo coin like darkcoin.

See this man.

[deleted image]

It's impossible. One 280x gpu can output about 2MH/s so he is
operating 41053 gpus if it's not abusing.

That man used only one worker, and it's submitting difficulty was 1.28
which I had set for highest difficulty value that can't be reached on normal situation.

My pool stat is all messed up by him.
[deleted image]

(I locked his account and changed to xxxxxx_locked now)

I ran my pool with latest NOMP which fixed all x11 algo problems.
This is real abusing isn't it?

The NOMP doesn't send solution field to DB, and I didn't set log type to "debug" so I have very little logs to trace.
I attached share_archive DB data.
[file deleted]

I don't have original share DB, since it's cleaned up by cronjob already. share_archive has almost all data except "reason" why our_result is 'N'

This would help analyzing this man's behaviour.
This man seems like inputted normal hash but his difficulty increased at some point incredibly.

He frequently got our_result = 'N' value, I think it might the problem of "Low difficulty share". not sure because data is lost.
Maybe exploit lies on precision problem, x11 uses very low difficulty values and some difficulty checking logic might not handle it properly.

I think this man used real machine, since he found 22 blocks out of 94.
Actually he had to find more blocks about 99% because his hashrate is so big. It was almost net hash!

I am sure he mined at good manner at first, but changed difficulty value at some point,
and this ridiculous thing happened.

I'm tired of abusing things.
I think there is some exploit in NOMP but don't know how.

Cannot find module 'async'

new bie to nodejs, test run your code, and got this, how can I solve this?

root@test-server:/mnt/stratum-mining/node_modules# node testlitecoinpool.js

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'async'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object. (/mnt/stratum-mining/node_modules/stratum-pool/lib/pool.js:2:13)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)

at Module.require (module.js:354:17)

seems module async is missing, not sure if this nodejs lib or your lib, tried npm install async , but no luck, any suggestion?

npm ERR! message failed to fetch from registry: scrypt256-hash/0.0.3

npm http GET https://github.com/zone117x/node-quark-hash/archive/master.tar.gz
npm http GET https://github.com/zone117x/node-x11-hash/archive/master.tar.gz
npm http 200 https://github.com/zone117x/node-scrypt-jane-hash/archive/master.tar.gz
npm http 200 https://github.com/zone117x/node-scrypt256-hash/archive/master.tar.gz
npm http 200 https://github.com/zone117x/node-x11-hash/archive/master.tar.gz
npm http 200 https://github.com/zone117x/node-quark-hash/archive/master.tar.gz
npm http GET https://registry.npmjs.org/scrypt256-hash/0.0.3
npm http GET https://registry.npmjs.org/scrypt-jane-hash/0.0.2
npm http GET https://registry.npmjs.org/x11-hash/0.0.1
npm http GET https://registry.npmjs.org/quark-hash/0.0.3

npm ERR! Error: failed to fetch from registry: scrypt256-hash/0.0.3
npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR! at Request. (/usr/lib/nodejs/request/main.js:212:58)
npm ERR! at Request.emit (events.js:88:20)
npm ERR! at ClientRequest. (/usr/lib/nodejs/request/main.js:412:12)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.onIncoming (http.js:1261:11)
npm ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR! http://bugs.debian.org/npm
npm ERR! or use
npm ERR! reportbug --attach /root/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.2.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "update"
npm ERR! cwd /root
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: scrypt256-hash/0.0.3
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/npm-debug.log

ReferenceError: c is not defined

node-stratum-portal can't run
here is output

 $ node init.js 
2014-03-03 05:03:16 [system]:   [blocknotify] Block listener is enabled, starting server on port 8117
2014-03-03 05:03:16 [system]:   [blocknotify] Block notify listener server started on port 8117
2014-03-03 05:03:16 [system]:   [casinocoin (Fork 0)] Starting pool for casinocoin [CSC]
2014-03-03 05:03:16 [system]:   [casinocoin (Fork 0)] VarDiff enabled and setup
2014-03-03 05:03:16 [system]:   [casinocoin (Fork 0)] Connecting to daemon(s)
2014-03-03 05:03:16 [system]:   [casinocoin (Fork 0)] Daemon instance 0 is running on live blockchain
2014-03-03 05:03:16 [network]:  [casinocoin (Fork 0)] Current block height at 258960 with difficulty of 1.31704817
2014-03-03 05:03:16 [system]:   [casinocoin (Fork 0)] Connected to daemon via RPC
2014-03-03 05:03:16 [system]:   [casinocoin (Fork 0)] Block polling every 100 milliseconds

node-stratum-portal-new/node_modules/stratum-pool/lib/stratum.js:267
        c.setKeepAlive(true);
        ^
ReferenceError: c is not defined
    at StratumServer.net.createServer.allowHalfOpen (node-stratum-portal-new/node_modules/stratum-pool/lib/stratum.js:267:9)
    at new StratumServer (node-stratum-portal-new/node_modules/stratum-pool/lib/stratum.js:285:5)
    at StartStratumServer (node-stratum-portal-new/node_modules/stratum-pool/lib/pool.js:340:31)
    at node-stratum-portal-new/node_modules/stratum-pool/lib/pool.js:322:29
    at node-stratum-portal-new/node_modules/stratum-pool/lib/pool.js:423:21
    at itemFinished (node-stratum-portal-new/node_modules/stratum-pool/lib/daemon.js:57:36)
    at IncomingMessage.<anonymous> (node-stratum-portal/node_modules/stratum-pool/lib/daemon.js:98:25)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)
2014-03-03 05:03:16 [system]:   [workerFork] fork with PID 19770 died

instanceId, extraNonce collision problem.

I am using cluster option (32 fork), random instanceId value, and I run two separated stratum server for same coin.

In that case, instanceId value may collide between fork processes. So extranonce value may collide, and of course, there is some probability of collision between two stratum server as well.

Not only my pool, all other pool would collide on extranonce value time to time.
If two pool use same instanceId, higher hashrate pool would be advantageous than lower hashrate pool. it's not absolute, I mean just probability meaning.

By running some weeks of mining pool, I found that instanceId is important. To not collide instanceId with other pool, I had to test instanceId time to time and it made big change on block finding luck. really!

To lower the overlapping works, I think some other method needs to be inserted rather than just using random.

  • For using separate stratum server
    It would be better to make an option to set instanceId as range number.
    Stratum server1 : 015
    Stratum server2 : 16
    31
    something like this.
  • For using many fork processes
    Especially, NOMP uses process forking, it's not good to use random number for each instances since some of them may collide in high probability which will not happen on multi-threaded programs.
    Preparing instanceId values in a randomly and uniformly method before fork in init.js and setting these values for each fork instances would be the best method I think.

This would lower the collision probability in fork processes, stratum servers in one pool, and among all other pools.

address not used

I can't find anywhere in the source code where the address is actually used. Are the minting of coin actually working or is that something that is not implemented yet? If not, could you point me in the right direction and I'll try to make a pull request.

JobManager's newBlock event never gets emitted

It seems to boil down to a race condition between SetupDaemonInterface in pool.js:

_this.daemon = new daemon.interface(options.daemon);
_this.daemon.once('online', function(){ ...

and the following code inside daemon.js:

(function init(){
    isOnline(function(online){
        if (online)
            _this.emit('online');
    });
})();

If I understand it correctly, the online event gets emitted before the listener is actually registered.

has no method 'setKeepAlive'

Hi
Thanks for fast fix #16 issue ... but now I heve this problem:

...
2014-03-03 09:03:59 [system]:   [casinocoin (Fork 0)] Block polling every 100 milliseconds

/home/pool_csc/node-stratum-portal-new/node_modules/stratum-pool/lib/stratum.js:267
        socket.setKeepAlive(true);
               ^
TypeError: Object function init(){
        _socketServer = socketServer = net.createServer({allowHalfOpen: true}, function(socket){
            handleNewClient(socket);
        });
        _socketServer.listen(options.port, function(){
            _this.emit('started');
        });
    } has no method 'setKeepAlive'
...

maybe I miss something ?

Peercoin not working with NOMP

I get this message for peercoin.

(Thread 1) Could not start pool, error with init batch RPC call: {"code":-32700,"message":"Parse error"}

I think peercoin doesn't provide batch rpc call. Some other fallback function would be needed.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Lot of invalid low difficulty share rejects

I launched this software on a live pool replacing the previous python's software but I was getting tons of low difficulty share rejects. I believe they were wrong because it didn't happen with the previous software. I had vardiff disabled to don't introduce unnecessary variables. Do you think you can help? I really like this software and I'd love to switch to it but it doesn't seem to work reliably. I can offer some BTC bounty if you can fix it + if you could add some features that I need (I messaged you on Skype but you didn't reply yet). Thanks!

Consuming a lot of CPU and Memory

The current version(16807d3) is currently using 35% of a single CPU core and 10% of 4GB memory per minute.

I'll continue to do test from revision to revision to see what causes this issue.

Btw, there is no miner connected to the stratum.

Add keccak hashing algo

I saw jobManager.js, line 72

case 'max':
return 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000'

code. and other 'max' related things.
max is coin name not the algorithm.

wecoin, helixcoin is using keccak algorithm as maxcoin
so this name would be better set as 'keccak'.

I know node-max-hashing library is not implemented yet but just leaving issue for future works since it would be hard to change later.

blocknotifyListener causing crashes

blocknotify="node /root/nomp/scripts/blockNotify.js localhost:8117 PASSOWRD dogecoin" results in this error when there are miners mining on the node:

the node completely crashes on the spot.

undefined:0

^
SyntaxError: Unexpected end of input
at Object.parse (native)
at Socket. (/root/nomp/libs/blocknotifyListener.js:35:40)
at Socket.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)

x11 addon needs fixed

It works with darkcoin, but not hirocoin. sph-miner is able to create valid hirocoin shares using the x11 algo which indicates our node x11 add is broken.

(Hirocoin) Submitted blocks all failed

I m using Hirocoin a x11 algo.
When submitting block, i have rejected blocks

share data: {"job":"6e","ip":"192.168.0.39","worker":"indianpath","difficulty":0.02,"height":23427,"reward":40000000000,"networkDifficulty":1285978.442432458}
Valid share submitted
share data: {"job":"6e","ip":"192.168.0.41","worker":"tearsofhell","difficulty":0.04,"height":23427,"reward":40000000000,"networkDifficulty":1285978.442432458}
Valid share submitted
share data: {"job":"6e","ip":"192.168.0.21","worker":"spads","difficulty":0.02,"height":23427,"reward":40000000000,"networkDifficulty":1285978.442432458}
<2014-03-23, 01:02:24> debug: [debugBlockSubmit] {"extraNonce1":"78000006","extraNonce2":"1e000000","nTime":"532e3290","nonce":"0056f990","headerBuffer":"02000000873ce9d1f8f18a37e5bc15d9c70d2cb4cbb886a49dbd75025f67f00300000000b165012d7c27c63bf75b420e5617eee015a05acb0a94f84f028389ac1370c29090322e53cb0b0d1c90f95600","headerHash":"2d39350c2f5af287b4e67c0f1dd43d4cb592cd78f6ec9e2e9c8d6c0a00000000","blockHex":"02000000873ce9d1f8f18a37e5bc15d9c70d2cb4cbb886a49dbd75025f67f00300000000b165012d7c27c63bf75b420e5617eee015a05acb0a94f84f028389ac1370c29090322e53cb0b0d1c90f956000102000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2602835b062f503253482f0491322e5308780000061e0000000d2f6e6f64655374726174756d2f000000000100902f50090000001976a9140f363244c07b7bd04f28a095ab11b2a449257fd588ac000000002868747470733a2f2f6769746875622e636f6d2f7a6f6e65313137782f6e6f64652d7374726174756d","blockHash":"9cf04a8deb16b256d4fe9be5dc9aec3b70561660a3d9b680af9900f3dbc02f27"}
<2014-03-23, 01:02:24> debug: [submitblock] raw submit results [{"error":null,"response":"rejected","instance":{"host":"localhost","port":9347,"user":"treize","password":"xxxxxx","index":0}}]
<2014-03-23, 01:02:24> debug: [submitblock] Submitted Block using submitblock to daemon instance 0
Valid share submitted
share data: {"job":"6e","ip":"192.168.0.39","worker":"indianpath","difficulty":0.02,"height":23427,"reward":40000000000,"networkDifficulty":1285978.442432458,"solution":"9cf04a8deb16b256d4fe9be5dc9aec3b70561660a3d9b680af9900f3dbc02f27"}

or i habe block decode failed.

<2014-03-23, 02:30:33> debug: [submitblock] raw submit results [{"error":{"code":-22,"message":"Block decode failed"},"response":null,"instance":{"host":"localhost","port":9347,"user":"treize","password":"xxxxxx","index":0}}]
<2014-03-23, 02:30:33> error: [submitblock] rpc error with daemon instance 0 when submitting block with submitblock {"code":-22,"message":"Block decode failed"}
Valid share submitted
share data: {"job":"12c","ip":"192.168.0.41","worker":"tearsofhell","difficulty":0.04,"height":23529,"reward":40000500000,"networkDifficulty":1813234.8633512103,"solution":"d8d5ee149edebaa29a08bc58eb6812b3390b02beab9538df1c50f1162c21e1f5"}

I havent had any accepted block since so something must be wrong. I hope Hirocoin is supported since it uses x11?

Bug: Block found but does not set isValidBlock=true during pool.on('share')

[2014-02-28 14:27:02.655] [INFO] console - Block listener received blocknotify data
[2014-02-28 14:27:02.658] [INFO] console - Block listener connection ended
[2014-02-28 14:27:02.663] [INFO] console - debug: [system] Detected new block
[2014-02-28 14:29:56.708] [INFO] console - debug: [debugBlockSubmit] {"extraNonce1":"10000000","extraNonce2":"5c000000","nTime":"53102c36","nonce":"0099e2d9","headerBuffer":"020000003b274f3a6c5893a33321cba53e9cdb2661c48907ce1a29e43bad4c0100000000d3d18efdcc9f27a449f6e0955ea3c00ce1c178d13dc60a753fd4b99069b5a21e362c1053fac7011cd9e29900","headerHash":"e4203478dbf861cf2c7b255e94d537724390387e5731194bc57a9d0100000000","blockHex":"020000003b274f3a6c5893a33321cba53e9cdb2661c48907ce1a29e43bad4c0100000000d3d18efdcc9f27a449f6e0955ea3c00ce1c178d13dc60a753fd4b99069b5a21e362c1053fac7011cd9e299000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff26027062062f503253482f04362c105308100000005c0000000d2f6e6f64655374726174756d2f000000000100371789000000001976a914cc95e3472d394d940569d5e18dd685b8a26b841a88ac00000000","blockHash":"9430ac0e55cf68b603a45fda614b4139d573ff075955d5ee76c4812b7bbb838a"}
[2014-02-28 14:29:56.967] [INFO] console - debug: [submitblock] Submitted Block using submitblock to daemon instance 0
[2014-02-28 14:29:57.026] [INFO] console - Block listener has incoming connection
[2014-02-28 14:29:57.030] [INFO] console - Block listener received blocknotify data
[2014-02-28 14:29:57.032] [INFO] console - Block listener connection ended
[2014-02-28 14:29:57.036] [INFO] console - debug: [system] Detected new block
[2014-02-28 14:30:07.961] [INFO] console - debug: [system] Detected updated block transactions
[2014-02-28 14:36:40.141] [INFO] console - Block listener has incoming connection
[2014-02-28 14:36:40.147] [INFO] console - Block listener received blocknotify data
[2014-02-28 14:36:40.150] [INFO] console - Block listener connection ended

Fails to install on Windows

I tried to install stratum-pool from NPM but received an OpenSSL related error. I installed OpenSSL and the install progressed much farther but I ran into an error because chmod is not a program on Windows. Here is the error from NPM: http://pastebin.com/ZHwPvjnr

Add bad-auth flood attack detection to IP banning feature

Hello,

I have been testing NOMP/stratum-pool coming from python stratum-mining and do not see any immediate way I can catch an incoming flood of bad auths. With stratum-mining I can catch it in the logs with fail2ban which then automatically adds an appropriate iptables rule.

from a fail2ban config file for stratum

#2014-01-27 09:10:36,081 DEBUG DB_Mysql # Checking username/password for xxx.xxx
#2014-01-27 09:10:36,082 INFO DBInterface # Authentication for xxx.xxx failed
#2014-01-27 09:10:36,082 INFO mining # Worker is not authorized: IP xxx.xxx.xxx.xxx
#
#new stratum
failregex = Failed worker authorization: IP <HOST>
            Failed message: .*? from <HOST>

So fail2ban simply tails the log and looks for certain strings. Even if this was put to stdout I could use it with forever and redirect it to an appropriate log file.

And as I was DoSed with a flood of bad auths this would be important to have :)

Does an issue need to be opened for NOMP as well?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.