Browse Source

Disablecb (#19)

* add disablcb mode (#18)

* Make a bit easier

* change to my stratum fork

* try first go with reward recipents active, debug.

* revert wtf

* try again

* forgot print of sendmany

* wtf

* fix

* fixed pool payouts. Now works for disablecb option as normal. Template now enables payment processor by default. gencfg.sh script can take a coin as $1, run wihtout it will use assetchains.json.

* remoce debug prints

* fix

* update with new changes for disablecb

* change to use jl777 FSM branch KMD

* Whitespace

* Revert dependency and template change

* Fix readme and coins template
dev
Web Worker 5 years ago
committed by GitHub
parent
commit
a1af0da4d2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      README.md
  2. 3
      coins.template
  3. 36
      gencfg.sh
  4. 28
      libs/paymentProcessor.js

22
README.md

@ -60,22 +60,38 @@ We need node and npm installed
cd ~
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
```
Now, let's build our stratum and run it. This will install the pool and configure it for all the assetchains on your system automatically. It must be run from the same user as the coin deamons were launched, as it pulls the rpcuser/pass from the conf file in the home directory.
```shell
git clone https://github.com/webworker01/knomp
cd knomp
npm install
cp config_example.json config.json (and configure it)
nano gencfg.sh
```
Edit line 3 in so that it has your own KMD based address, CTRL-X then Y to save and exit
We need to generate the coins files (coin daemon must be running!): `gencfg.sh <coin name>`
You can run just gencfg.sh with no coin name to use the assetchains.json in komodo/src directory for all coins. Make sure you edit the template with the correct values you want before running the config generator.
Finally we are ready to start the pool software
```shell
./gencfg.sh
npm install
cp config_example.json config.json (and configure it)
npm start
```
If all went well the program should start without error and you should be able to browse to your pool website on your server via port 8080.
Disable Coinbase Mode
-------------
This mode uses -pubkey to tell the daemon where the coinbase should be sent, and uses the daemons coinbase transaction rather then having the pool create the coinabse transaction. This enables special coinbase transactions, such as ac_founders and ac_script or new modes with CC vouts in the coinbase not yet created, it will work with all coins, except Full Z support described below.
To enable it, change the value in the `./coins/*.json` to `"disablecb" : true`
The pool fee is taken in the payment processor using this mode, and might not be 100% accurate down to the single satoshi, so the pool address may end up with some small amount of coins over time.
Payment Processing
-------------
Please note that the default configs generated are for solo mining. If you wish to create a public pool please modify the configs like in this [example config](https://github.com/z-classic/z-nomp/blob/master/pool_configs/komodo_example.json)

3
coins.template

@ -3,5 +3,6 @@
"symbol": "COINNAMEVAR",
"algorithm": "equihash",
"txfee": 0.0001,
"peerMagic": "MAGICREVVAR"
"peerMagic": "MAGICREVVAR",
"disablecb": "false"
}

36
gencfg.sh

@ -1,6 +1,6 @@
#!/bin/bash
# Put the address to mine to here
walletaddress=RWEBo1Yp4uGkeXPi1ZGQARfLPkGmoW1MwY
walletaddress=
#Change to path of komodo-cli here
komodoexec=~/komodo/src/komodo-cli
@ -11,6 +11,7 @@ declare -a skip=("BEER" "PIZZA")
# Stratum port to start with
stratumport=3030
cli="komodo-cli"
coinsdir=./coins
poolconfigdir=./pool_configs
coinstpl=coins.template
@ -32,18 +33,39 @@ if [ -f $ufwdisablefile ]; then
rm $ufwdisablefile
fi
~/komodo/src/listassetchains | while read chain; do
conffile="~/.komodo/$chain/$chain.conf"
if [[ -z $1 ]]; then
specificchain=0
else
specificchain=$1
fi
listassetchains () {
if [[ $specificchain = "0" ]]; then
~/komodo/src/listassetchains
else
echo $specificchain
fi
}
if [[ " ${skip[@]} " =~ " ${chain} " ]] || [ ! -f $conffile ]; then
listassetchains | while read chain; do
if [[ " ${skip[@]} " =~ " ${chain} " ]]; then
pointless=0
else
thisconf=$(<$conffile)
string=$(printf '%08x\n' $($komodoexec -ac_name=$chain getinfo | jq '.magic'))
echo "[$chain] Generating config files"
getinfo=$(${cli} -ac_name=$chain getinfo 2>/dev/null)
outcome=$(echo $?)
if [[ $outcome != 0 ]]; then
echo "[$chain] Daemon is not running skipped."
continue
fi
string=$(printf '%08x\n' $(echo $getinfo | jq '.magic'))
magic=${string: -8}
magicrev=$(echo ${magic:6:2}${magic:4:2}${magic:2:2}${magic:0:2})
p2pport=$($komodoexec -ac_name=$chain getinfo | jq '.p2pport')
p2pport=$(echo $getinfo | jq '.p2pport')
thisconf=$(<~/.komodo/$chain/$chain.conf)
rpcuser=$(echo $thisconf | grep -Po "rpcuser=(\S*)" | sed 's/rpcuser=//')
rpcpass=$(echo $thisconf | grep -Po "rpcpassword=(\S*)" | sed 's/rpcpassword=//')

28
libs/paymentProcessor.js

@ -120,6 +120,7 @@ function SetupForPool(logger, poolOptions, setupFinished) {
}
}, true);
}
function validateTAddress (callback) {
daemon.cmd('validateaddress', [poolOptions.tAddress], function(result) {
if (result.error){
@ -137,6 +138,7 @@ function SetupForPool(logger, poolOptions, setupFinished) {
}
}, true);
}
function validateZAddress (callback) {
daemon.cmd('z_validateaddress', [poolOptions.zAddress], function(result) {
if (result.error){
@ -154,6 +156,7 @@ function SetupForPool(logger, poolOptions, setupFinished) {
}
}, true);
}
function getBalance(callback){
daemon.cmd('getbalance', [], function(result){
if (result.error){
@ -559,6 +562,8 @@ function SetupForPool(logger, poolOptions, setupFinished) {
var startPaymentProcess = Date.now();
var poolperc = 0;
var timeSpentRPC = 0;
var timeSpentRedis = 0;
@ -759,8 +764,16 @@ function SetupForPool(logger, poolOptions, setupFinished) {
// get reward for newly generated blocks
if (round.category === 'generate' || round.category === 'immature') {
round.reward = coinsRound(parseFloat(generationTx.amount || generationTx.value));
var minerperc = 1;
if (poolOptions.coin.disablecb && poolOptions.rewardRecipients.length !== 0) {
for (var r in poolOptions.rewardRecipients) {
minerperc = minerperc - (poolOptions.rewardRecipients[r]/100);
}
}
poolperc = roundTo(1 - minerperc,4);
round.reward = coinsRound(parseFloat(generationTx.amount*minerperc || generationTx.value*minerperc));
}
//console.log(round.reward);
});
var canDeleteShares = function(r){
@ -1163,9 +1176,22 @@ function SetupForPool(logger, poolOptions, setupFinished) {
// do final rounding of payments per address
// this forces amounts to be valid (0.12345678)
var totalcoinstosend = 0;
for (var a in addressAmounts) {
addressAmounts[a] = coinsRound(addressAmounts[a]);
totalcoinstosend = totalcoinstosend + addressAmounts[a];
}
if (poolOptions.coin.disablecb && poolOptions.rewardRecipients.length !== 0) {
var totalbr = coinsRound(totalcoinstosend*(poolperc+1));
//console.log(totalbr);
for (var r in poolOptions.rewardRecipients) {
var feetopay = coinsRound(totalbr*(poolOptions.rewardRecipients[r]/100));
addressAmounts[r] = feetopay;
}
}
//console.log(addressAmounts);
// POINT OF NO RETURN! GOOD LUCK!
// WE ARE SENDING PAYMENT CMD TO DAEMON

Loading…
Cancel
Save