Skip to content

Commit

Permalink
Added KCN coin support
Browse files Browse the repository at this point in the history
  • Loading branch information
MoneroOcean committed May 27, 2024
1 parent 41211e2 commit 1a824bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions deployment/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('daemon', 'coinHashFactorBLOC', '0', 'float', 'BLOC algo hash price factor relative to coinHashFactor');
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('daemon', 'coinHashFactorERG', '0', 'float', 'ERG algo hash price factor relative to coinHashFactor');
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('daemon', 'coinHashFactorRTM', '0', 'float', 'RTM algo hash price factor relative to coinHashFactor');
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('daemon', 'coinHashFactorKCN', '0', 'float', 'KCN algo hash price factor relative to coinHashFactor');
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('daemon', 'coinHashFactorBTRM', '0', 'float', 'BTRM algo hash price factor relative to coinHashFactor');
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('daemon', 'coinHashFactorZEPH', '0', 'float', 'ZEPH algo hash price factor relative to coinHashFactor');
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('daemon', 'coinHashFactorXNA', '0', 'float', 'XNA algo hash price factor relative to coinHashFactor');
Expand Down Expand Up @@ -326,6 +327,7 @@ INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('pool', 'address_2086', '', 'string', 'Address to mine to for 2086 (BLOC) port.');
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('pool', 'address_9053', '', 'string', 'Address to mine to for 9053 (ERG) port.');
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('pool', 'address_9998', '', 'string', 'Address to mine to for 9998 (RTM) port.');
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('pool', 'address_5110', '', 'string', 'Address to mine to for 5110 (KCN) port.');
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('pool', 'address_17767', '', 'string', 'Address to mine to for 17767 (ZEPH) port.');
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('pool', 'address_10225', '', 'string', 'Address to mine to for 10225 (BTRM) port.');
INSERT INTO pool.config (module, item, item_value, item_type, Item_desc) VALUES ('pool', 'address_19001', '', 'string', 'Address to mine to for 19001 (Neurai) port.');
Expand Down
18 changes: 13 additions & 5 deletions lib/coins/xmr.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const port2coin = {
"2086" : "BLOC",
"9053" : "ERG",
"9998" : "RTM",
"5110" : "KCN",
"10225" : "BTRM",
"17767" : "ZEPH",
"19001" : "XNA",
Expand Down Expand Up @@ -83,6 +84,7 @@ const port2blob_num = {
"2086" : 1, // BLOC
"9053" : 103, // ERG
"9998" : 104, // RTM
"5110" : 104, // KCN
"10225": 104, // BTRM
"19001": 101, // XNA
"9766" : 101, // CLORE
Expand Down Expand Up @@ -118,6 +120,7 @@ const port2algo = {
"2086" : "cn-heavy/xhv", // BLOC
"9053" : "autolykos2", // ERG
"9998" : "ghostrider", // RTM
"5110" : "flex", // KCN
"10225": "ghostrider", // BTRM
"19001": "kawpow", // XNA
"9766": "kawpow", // CLORE
Expand Down Expand Up @@ -353,7 +356,7 @@ function Coin(data){
return callback(true, body);
}
});
} else if (port == 8766 || port == 9998 || port == 10225 || port == 19001 || port == 9766) {
} else if (port == 8766 || port == 9998 || port == 5110 || port == 10225 || port == 19001 || port == 9766) {
global.support.rpcPortDaemon2(port, '', { method: 'getblockhash', params: [ blockId ] }, function (body) {
if (!body || !body.result) {
console.error("getPortBlockHeaderByID(" + port + ", " + blockId + "): " + JSON.stringify(body));
Expand Down Expand Up @@ -426,7 +429,7 @@ function Coin(data){
}
return callback(null, body);
});
} else if (port == 8766 || port == 9998 || port == 10225 || port == 19001 || port == 9766) {
} else if (port == 8766 || port == 9998 || port == 5110 || port == 10225 || port == 19001 || port == 9766) {
global.support.rpcPortDaemon2(port, '', { method: 'getblock', params: [ blockHash, 2 ] }, function (body) {
if (!body || !body.result || !(body.result.tx instanceof Array) || body.result.tx.length < 1) {
console.error("getPortBlockHeaderByHash(" + port + ", " + blockHash + "): " + JSON.stringify(body));
Expand All @@ -447,7 +450,7 @@ function Coin(data){
}
body.result.reward *= 100000000;
body.result.reward = parseInt(body.result.reward);
if (port == 9998 || port == 10225) body.result.difficulty *= 0xFFFFFFFF;
if (port == 9998 || port == 5110 || port == 10225) body.result.difficulty *= 0xFFFFFFFF;
return callback(null, body.result);
});
} else if (port == 8545 || port == 8645) {
Expand Down Expand Up @@ -596,7 +599,7 @@ function Coin(data){
return callback(true, body);
}
});
} else if (port == 8766 || port == 9998 || port == 10225 || port == 19001 || port == 9766) {
} else if (port == 8766 || port == 9998 || port == 5110 || port == 10225 || port == 19001 || port == 9766) {
global.support.rpcPortDaemon2(port, '', { method: 'getbestblockhash' }, function (body) {
if (!body || !body.result) {
console.error("getPortLastBlockHeader(" + port + "): " + JSON.stringify(body));
Expand Down Expand Up @@ -652,7 +655,7 @@ function Coin(data){
return callback(body ? body : null);
});

} else if (port == 8766 || port == 9998 || port == 10225 || port == 19001 || port == 9766) {
} else if (port == 8766 || port == 9998 || port == 5110 || port == 10225 || port == 19001 || port == 9766) {
global.support.rpcPortDaemon2(port, '', {
method: 'getblocktemplate',
params: [{
Expand All @@ -661,6 +664,7 @@ function Coin(data){
}]
}, function(body) {
if (body && body.result) switch (parseInt(port)) {
case 5110:
case 9998:
case 10225:
return callback(cnUtil.RtmBlockTemplate(body.result, global.config.pool["address_" + port.toString()]));
Expand Down Expand Up @@ -1024,6 +1028,8 @@ function Coin(data){

if ("ghostrider" in algos_perf) coin_perf["RTM"] = coin_perf["BTRM"] = algos_perf["ghostrider"];

if ("flex" in algos_perf) coin_perf["KCN"] = algos_perf["flex"];

if ("ethash" in algos_perf) coin_perf["ETC"] = algos_perf["ethash"];
if ("etchash" in algos_perf) coin_perf["ETC"] = algos_perf["etchash"];

Expand Down Expand Up @@ -1078,6 +1084,7 @@ function Coin(data){
case 19001: return multiHashing.kawpow(convertedBlob, Buffer.from(nonce, 'hex'), Buffer.from(mixhash, 'hex')); // XNA
case 9766: return multiHashing.kawpow(convertedBlob, Buffer.from(nonce, 'hex'), Buffer.from(mixhash, 'hex')); // CLORE
case 9998: return multiHashing.cryptonight(convertedBlob, 18); // RTM
case 5110: return multiHashing.cryptonight(convertedBlob, 19); // KCN
case 10225: return multiHashing.cryptonight(convertedBlob, 18); // BTRM
case 8545: return multiHashing.ethash(convertedBlob, Buffer.from(nonce, 'hex'), blockTemplate.height); // ETH
case 8645: return multiHashing.etchash(convertedBlob, Buffer.from(nonce, 'hex'), blockTemplate.height); // ETC
Expand Down Expand Up @@ -1195,6 +1202,7 @@ function Coin(data){
case 9053: return "erg"; // ERG
case 9231: return "cryptonote_loki"; // XEQ
case 9998: return "raptoreum"; // RTM
case 5110: return "flex"; // KCN
case 10225: return "raptoreum"; // BTRM
//case 11181: return "aeon"; // Aeon
case 11898: return "forknote2"; // TRTL
Expand Down

0 comments on commit 1a824bd

Please sign in to comment.