![NPM Package](https://camo.githubusercontent.com/c15a5880d9c582f39e9afed766e1222a6af97a083e7df19ba7d153351d7844b2/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f40726176656e6974652f726176656e636f696e2d7374726174756d2d7365727665722e7376673f7374796c653d666c61742d737175617265)
Stratum Conversion to TypeScript from Ravencoin Stratum Server.
# Using npm
npm install @ravenite/ravencoin-stratum-server
# Using yarn
yarn add @ravenite/ravencoin-stratum-server
import { createPool } from '@ravenite/ravencoin-stratum-server'
const options = {...}
function authorizeFn() {...}
const pool = new createPool(options, authorizeFn)
pool.start()
Authorize Function Example
function authorizeFn(
ip,
port,
workerName,
password,
extraNonce1,
version,
callback
) {
// Your Auth Handler
handlers.auth(port, workerName, password, function(authorized) {
var authString = authorized ? 'Authorized' : 'Unauthorized ';
logger.debug(
'AUTH>TRUE> authstr [%s] worker [%s] passwd [%s] ip [%s]',
authString,
workerName,
password,
functions.anonymizeIP(ip)
);
// Callback to Stratum Server
callback({
error: null,
authorized: authorized,
disconnect: false,
});
});
}
{
"address": "xxxxxx",
"blockRefreshInterval": 400,
"coin": {
"algorithm": "kawpow",
"name": "ravencoin",
"reward": "POS",
"symbol": "RVN"
},
"connectionTimeout": 600,
"daemons": [
{
"host": "127.0.0.1",
"port": 8766,
"user": "user1",
"password": "pass1"
}
],
"feePercent": 0,
"initStats": {
"updateInterval": 900,
"historicalRetention": 43200,
"hashrateWindow": 900
},
"jobRebroadcastTimeout": 25,
"p2p": {
"enabled": false,
"host": "127.0.0.1",
"port": 8767,
"disableTransactions": true
},
"ports": {
"10008": {
"diff": 0.05,
"varDiff": {
"minDiff": 0.025,
"maxDiff": 1024,
"targetTime": 10,
"retargetTime": 60,
"variancePercent": 30,
"maxJump": 25
}
},
"10016": {
"diff": 0.1,
"varDiff": {
"minDiff": 0.05,
"maxDiff": 1024,
"targetTime": 10,
"retargetTime": 60,
"variancePercent": 30,
"maxJump": 25
}
},
"10032": {
"diff": 0.2,
"varDiff": {
"minDiff": 0.1,
"maxDiff": 1024,
"targetTime": 10,
"retargetTime": 60,
"variancePercent": 30,
"maxJump": 50
}
},
"10256": {
"diff": 1024000000,
"varDiff": {
"minDiff": 1024000000,
"maxDiff": 20480000000,
"targetTime": 10,
"retargetTime": 60,
"variancePercent": 30,
"maxJump": 25
}
}
},
"rewardRecipients": {
"xxxxxx": 0.5
},
"tcpProxyProtocol": false,
"testnet": true
}
Property |
Type |
address |
string // pool address |
api |
any (optional) |
banning |
Banning (optional) |
blockRefreshInterval |
number |
coin |
Coin |
connectionTimeout |
number |
daemons |
Daemon[] |
feePercent |
number |
jobRebroadcastTimeout |
number |
kawpow_validator |
string (optional) |
kawpow_wrapper_host |
string (optional) |
kawpow_wrapper_port |
number (optional) |
p2p |
P2p |
poolAddressScript |
any |
ports |
Record<string, Port> |
rewardRecipients |
Record<string, number> // address:percentage |
tcpProxyProtocol |
boolean |
testnet |
boolean (optional) |
Property |
Type |
diff |
number |
tls |
tls.TLSSocket |
varDiff |
object |
Property |
Type |
maxDiff |
number |
maxJump |
number |
minDiff |
number |
retargetTime |
number |
targetTime |
number |
variancePercent |
number |
Property |
Type |
Value |
algorithm |
string // kawpow |
kawpow |
name |
string // ravencoin |
ravencoin |
peerMagic |
string (optional) |
|
peerMagicTestnet |
string (optional) |
|
reward |
string |
'POS' 'POW' |
symbol |
string |
RVN |
Property |
Type |
enabled |
boolean (optional) |
host |
string |
port |
number |
disableTransactions |
boolean (optional) |
Property |
Type |
host |
string |
port |
number |
user |
string |
password |
string |
Code released under the GPL-3.0 license.