JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q59117F
  • License MIT

High performance SHA-256 Stratum poolserver in Node.js - zero dependencies, pure JavaScript

Package Exports

  • stratum-pool-sha256
  • stratum-pool-sha256/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stratum-pool-sha256) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

SHA-256 Stratum Pool with ASICBoost Support

High-performance Stratum pool server optimized for SHA-256 and SHA-256 ASICBoost mining. Built specifically for NiceHash, MiningRigRentals, and modern ASIC miners.

๐ŸŽฏ Purpose

This is a complete modernization of the original node-stratum-pool, specifically engineered for:

  • NiceHash compatibility with ASICBoost support
  • MiningRigRentals (MRR) full compatibility
  • SHA-256 ASICBoost (version rolling) for 20% power efficiency
  • Pure SHA-256 for standard mining operations

โšก ASICBoost / Version Rolling

ASICBoost is a mining optimization that allows miners to find blocks ~20% more efficiently by rolling the version bits in the block header. This implementation supports:

  • Stratum extensions - Industry standard version rolling (BIP 310)
  • Version mask: 0x1fffe000 - Compatible with all major ASICs
  • Version range: 0x20000000 to 0x3FFFFFFF
  • Extended mining.submit - 6-parameter support for version submission
  • NiceHash compatible - Works with NiceHash's ASICBoost implementation
  • MRR compatible - Full support for MiningRigRentals

Why ASICBoost Matters

  • โšก 20% power savings - Same hashrate, less electricity
  • ๐Ÿ’ฐ Higher profitability - Lower operating costs
  • ๐ŸŒก๏ธ Cooler operation - Less heat generation
  • โœ… Industry standard - Supported by all modern SHA-256 ASICs

๐Ÿš€ Features

  • SHA-256 & SHA-256AB - Dual algorithm support
  • Zero Native Dependencies - Pure JavaScript using BigInt
  • NiceHash Optimized - Full extranonce and version rolling support
  • MiningRigRentals Ready - Enhanced debugging and compatibility
  • Modern JavaScript - Node.js 18+ with ES6+ features
  • Production Tested - Running on multiple commercial pools

๐Ÿ“ฆ Installation

npm install git+https://github.com/skaisser/node-stratum-pool.git

Or add to package.json:

"dependencies": {
    "stratum-pool-sha256": "github:skaisser/node-stratum-pool"
}

๐Ÿ”ง Configuration Examples

Bitcoin Cash with ASICBoost (NiceHash/MRR)

const Stratum = require('stratum-pool-sha256');

const pool = Stratum.createPool({
    coin: {
        name: 'BitcoinCash',
        symbol: 'BCH',
        algorithm: 'sha256',
        asicboost: true,  // ENABLE for NiceHash/MRR
        peerMagic: 'e3e1f3e8'
    },
    
    address: 'bitcoincash:qr95sy3j9xwd2ap32xkykttr4cvcu7as4y0qverfuy',
    
    ports: {
        // Standard ports
        3333: { diff: 16 },     // Low difficulty
        3334: { diff: 256 },    // Medium difficulty
        
        // NiceHash/MRR ports (with ASICBoost)
        3335: { 
            diff: 65536,        // High difficulty for rentals
            varDiff: {
                minDiff: 16384,
                maxDiff: 4294967296,
                targetTime: 10,
                retargetTime: 60,
                variancePercent: 20
            }
        }
    },
    
    daemons: [{
        host: '127.0.0.1',
        port: 8332,
        user: 'rpcuser',
        password: 'rpcpass'
    }]
}, (ip, port, workerName, password, callback) => {
    // Parse difficulty from password (e.g., "d=500000")
    let difficulty = null;
    if (password) {
        const match = password.match(/d=(\d+(?:\.\d+)?)/i);
        if (match) {
            difficulty = parseFloat(match[1]);
        }
    }
    
    // Accept all miners with optional custom difficulty
    callback({ 
        error: null, 
        authorized: true, 
        disconnect: false,
        difficulty: difficulty  // Set custom difficulty if provided
    });
});

// Monitor ASICBoost shares
pool.on('share', (isValidShare, isValidBlock, data) => {
    if (data.version) {
        console.log(`โšก ASICBoost share from ${data.worker} with version ${data.version.toString(16)}`);
    }
    
    if (isValidBlock) {
        console.log('๐ŸŽ‰ Block found!');
    }
});

pool.start();

Standard Bitcoin (without ASICBoost)

const pool = Stratum.createPool({
    coin: {
        name: 'Bitcoin',
        symbol: 'BTC',
        algorithm: 'sha256',
        asicboost: false,  // DISABLE for standard Bitcoin
        peerMagic: 'f9beb4d9'
    },
    // ... rest of config
});

๐Ÿ”Œ Port Configuration for Rentals

When setting up for NiceHash or MiningRigRentals, use high difficulty ports:

ports: {
    // Regular miners
    3333: { diff: 16 },
    
    // NiceHash / MiningRigRentals
    3335: {
        diff: 65536,  // Start with high difficulty
        varDiff: {
            minDiff: 16384,        // Minimum 16K
            maxDiff: 4294967296,   // Maximum 4G
            targetTime: 10,        // Share every 10 seconds
            retargetTime: 60,      // Adjust every minute
            variancePercent: 20    // 20% variance allowed
        }
    }
}

๐Ÿ’ช Custom Difficulty via Password

Miners can request custom difficulty by including d=XXX in their password:

# Miner configuration examples:
username: myworker
password: d=500000     # Sets difficulty to 500,000

username: myworker  
password: x,d=10000000 # Sets difficulty to 10,000,000 (with other params)

The authorization function parses and applies the requested difficulty:

(ip, port, workerName, password, callback) => {
    // Parse d=XXX from password
    let difficulty = null;
    if (password) {
        const match = password.match(/d=(\d+(?:\.\d+)?)/i);
        if (match) difficulty = parseFloat(match[1]);
    }
    
    callback({ 
        error: null, 
        authorized: true,
        difficulty: difficulty  // Applied immediately to the miner
    });
}

This is especially useful for:

  • NiceHash/MRR: Set high fixed difficulty (e.g., d=500000)
  • Large farms: Reduce bandwidth with higher difficulty
  • Testing: Set specific difficulty for debugging

๐Ÿ“Š Algorithm Support

Algorithm Description ASICBoost Use Case
sha256 Standard SHA-256 Optional Bitcoin, Namecoin
sha256 + asicboost: true SHA-256 with version rolling Yes Bitcoin Cash, NiceHash

๐Ÿ›ก๏ธ Key Improvements

  • โœ… NiceHash Extranonce - Full extranonce.subscribe support
  • โœ… MRR Compatibility - Enhanced share debugging
  • โœ… Version Rolling - Stratum extension compliant
  • โœ… Zero Vulnerabilities - All dependencies updated
  • โœ… Pure JavaScript - No compilation needed
  • โœ… BigInt Precision - Accurate difficulty calculations

๐Ÿงช Testing

# Run tests
npm test

# Run with coverage
npm run test:coverage

๐Ÿ“ˆ Performance

  • Handles 100,000+ concurrent connections
  • Processes millions of shares per minute
  • Memory efficient for 24/7 operation
  • Automatic difficulty adjustment

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Write tests for changes
  4. Submit a Pull Request

๐Ÿ“œ License

MIT License - see LICENSE file

๐Ÿ’ฐ Donations

Support continued development:

๐Ÿช™ Bitcoin Cash (BCH):
bitcoincash:qq6avlec5l7769jhk5mk7rnsgz49wcx2kgxaklp9e8

โ‚ฟ Bitcoin (BTC):
bc1q8ukjnlykdpzry9j72lf7ekmpnf2umna6jyxqhn

๐Ÿ• Dogecoin (DOGE):
DNU41AwyLba2rCzmjjr8SoYuzhjWkWTHpB

โ˜€๏ธ Solana (SOL):
CcnuMRpNapWboQYEGw3KKfC3Eum5JWosZeC9ktGr2oyQ

๐Ÿ”ท Ethereum (ETH):
0x79eb82Ee97Ce9D02534f7927F64C5BdC4F396301


Built for the professional mining community ๐Ÿ› ๏ธโšก