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:
0x20000000to0x3FFFFFFF - 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.gitOr 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
- Fork the repository
- Create your feature branch
- Write tests for changes
- 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 ๐ ๏ธโก