Skip to content

introduce poolOptions for legacy, p2sh and bech32 keys #604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions coins/00_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "Example",
"symbol": "EXM",
"algorithm": "x99",
"peerMagic": "0f0f0f0f",
"peerMagicTestnet": "f0f0f0f0",

"mainnet": {
"bech32": "ex",
"bip32": {
"public": "0f0f0f0f"
},
"pubKeyHash": "00",
"scriptHash": "ff"
},

"testnet": {
"bech32": "tex",
"bip32": {
"public": "f0f0f0f0"
},
"pubKeyHash": "0f",
"scriptHash": "f0"
}
}
20 changes: 19 additions & 1 deletion coins/chaincoin.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,23 @@
"symbol": "CHC",
"algorithm": "c11",
"peerMagic": "a3d27a03",
"peerMagicTestnet": "fbc21102"
"peerMagicTestnet": "fbc21102",

"mainnet": {
"bech32": "chc",
"bip32": {
"public": "0488b21e"
},
"pubKeyHash": "1c",
"scriptHash": "04"
},

"testnet": {
"bech32": "tchc",
"bip32": {
"public": "043587cf"
},
"pubKeyHash": "50",
"scriptHash": "2c"
}
}
11 changes: 11 additions & 0 deletions init.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,17 @@ var buildPoolConfigs = function(){
var coinProfile = JSON.parse(JSON.minify(fs.readFileSync(coinFilePath, {encoding: 'utf8'})));
poolOptions.coin = coinProfile;
poolOptions.coin.name = poolOptions.coin.name.toLowerCase();
if (coinProfile.mainnet) {
poolOptions.coin.mainnet.bip32.public = Buffer.from(coinProfile.mainnet.bip32.public, 'hex').readUInt32LE(0);
poolOptions.coin.mainnet.pubKeyHash = Buffer.from(coinProfile.mainnet.pubKeyHash, 'hex').readUInt8(0);
poolOptions.coin.mainnet.scriptHash = Buffer.from(coinProfile.mainnet.scriptHash, 'hex').readUInt8(0);
}
if (coinProfile.testnet) {
poolOptions.coin.testnet.bip32.public = Buffer.from(coinProfile.testnet.bip32.public, 'hex').readUInt32LE(0);
poolOptions.coin.testnet.pubKeyHash = Buffer.from(coinProfile.testnet.pubKeyHash, 'hex').readUInt8(0);
poolOptions.coin.testnet.scriptHash = Buffer.from(coinProfile.testnet.scriptHash, 'hex').readUInt8(0);
}


if (poolOptions.coin.name in configs){

Expand Down
1 change: 0 additions & 1 deletion libs/poolWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var net = require('net');

var MposCompatibility = require('./mposCompatibility.js');
var ShareProcessor = require('./shareProcessor.js');
var Stratum = require('stratum-pool');

module.exports = function(logger){

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"url": "https://github.com/zone117x/node-open-mining-portal.git"
},
"dependencies": {
"stratum-pool": "git://github.com/zone117x/node-stratum-pool.git",
"stratum-pool": "git://github.com/zone117x/node-stratum-pool.git -b dev",
"dateformat": "1.0.12",
"node-json-minify": "*",
"redis": "0.12.1",
Expand Down