Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Forked changes from Ventos -> test
  • Loading branch information
ArqTras committed Mar 21, 2018
0 parents commit cacaf9c
Show file tree
Hide file tree
Showing 95 changed files with 18,773 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
77 changes: 77 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

#NodeJs Ignores

# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

config.json
36 changes: 36 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
MIT License

Copyright (c) 2017 Snipa22 <Alexander Blair, [email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

This work is a derivitive work from Zone117x's node-cryptonote-pool, permission
has been granted from Zone117x via IRC conversation to re-license this code as
MIT for all portions of the work derived from his original source as of 2/11/2017
Original work: https://github.com/zone117x/node-cryptonote-pool

Log snippet:
Feb 11 15:59:02 <Snipa> Hallo! Wanted to reach out as we finally released the pool software w/ the FFS funded at this point. https://github.com/Snipa22/nodejs-pool <redacted>. The following code: https://pb.junaos.xyz/view/cd3d7e27 is what was snagged, and mostly rebuilt along the way for good measure.
Feb 11 15:59:02 <Snipa> I'm not sure how deeply the GPL requires me to go to claim it as "new code" given that the logic behind it all is about the same.
<redacted>
Feb 11 16:09:39 <Snipa> .fr is now 1/5th of the overall mining power, DP is another 1/5th.
Feb 11 16:09:48 <Snipa> We're getting scary-close to the 50% attacks.
Feb 11 16:10:08 <zone117x> You have my permission to MIT
Feb 11 16:10:31 <Snipa> Thank you. I'll get our licenses updated and such today.
Feb 11 16:12:08 <zone117x> What payment systems did you get implemented?
286 changes: 286 additions & 0 deletions README.md

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions SQL_MIGRATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
2/12/2017
---------
```sql
ALTER TABLE pool.config MODIFY item_value TEXT;
```

2/13/2017
---------
```sql
ALTER TABLE pool.payments ADD transfer_fee BIGINT(20) DEFAULT 0 NULL;
```

2/16/2017
---------
```sql
ALTER DATABASE pool DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.balance CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.bans CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.block_log CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.config CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.payments CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.pools CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.port_config CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.ports CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.shapeshiftTxn CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.transactions CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.users CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE pool.xmrtoTxn CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
```

2/25/2017
---------
```sql
ALTER TABLE pool.users ADD enable_email BOOL DEFAULT true NULL;
```
10 changes: 10 additions & 0 deletions coinConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"aeon": {
"funcFile": "./lib/coins/aeon.js",
"paymentFile": "./payment_systems/aeon.js",
"sigDigits": 1000000000000,
"name": "Aeon Coin",
"mixIn": 4,
"shortCode": "AEON"
}
}
14 changes: 14 additions & 0 deletions config_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"pool_id": 0,
"bind_ip": "0.0.0.0",
"hostname": "testpool.com",
"db_storage_path": "CHANGEME",
"coin": "etn",
"mysql": {
"connectionLimit": 20,
"host": "127.0.0.1",
"database": "pool",
"user": "pool",
"password": "98erhfiuehw987fh23d"
}
}
91 changes: 91 additions & 0 deletions debug_scripts/block_add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
"use strict";
let mysql = require("promise-mysql");
let fs = require("fs");
let argv = require('minimist')(process.argv.slice(2));
let config = fs.readFileSync("../config.json");
let coinConfig = fs.readFileSync("../coinConfig.json");
let protobuf = require('protocol-buffers');
const request = require('request');

global.support = require("../lib/support.js")();
global.config = JSON.parse(config);
global.mysql = mysql.createPool(global.config.mysql);
global.protos = protobuf(fs.readFileSync('../lib/data.proto'));
let comms;
let coinInc;


// Config Table Layout
// <module>.<item>

global.mysql.query("SELECT * FROM config").then(function (rows) {
rows.forEach(function (row){
if (!global.config.hasOwnProperty(row.module)){
global.config[row.module] = {};
}
if (global.config[row.module].hasOwnProperty(row.item)){
return;
}
switch(row.item_type){
case 'int':
global.config[row.module][row.item] = parseInt(row.item_value);
break;
case 'bool':
global.config[row.module][row.item] = (row.item_value === "true");
break;
case 'string':
global.config[row.module][row.item] = row.item_value;
break;
case 'float':
global.config[row.module][row.item] = parseFloat(row.item_value);
break;
}
});
}).then(function(){
global.config['coin'] = JSON.parse(coinConfig)[global.config.coin];
coinInc = require("." + global.config.coin.funcFile);
global.coinFuncs = new coinInc();
if (argv.module === 'pool'){
comms = require('../lib/remote_comms');
} else {
comms = require('../lib/local_comms');
}
global.database = new comms();
global.database.initEnv();
global.coinFuncs.blockedAddresses.push(global.config.pool.address);
global.coinFuncs.blockedAddresses.push(global.config.payout.feeAddress);
}).then(function(){
/*
message Block {
required string hash = 1;
required int64 difficulty = 2;
required int64 shares = 3;
required int64 timestamp = 4;
required POOLTYPE poolType = 5;
required bool unlocked = 6;
required bool valid = 7;
optional int64 value = 8;
}
*/
let invalidBlockProto = global.protos.Block.encode({
hash: "88cf2c37e1e4e8a273cbe3ec502b6975fd6c4ebe1e8889ad9d5e53a5e9cde007",
difficulty: 1002932,
shares: 0,
timestamp: Date.now(),
poolType: global.protos.POOLTYPE.PPS,
unlocked: false,
valid: true,
value:0
});
let wsData = global.protos.WSData.encode({
msgType: global.protos.MESSAGETYPE.BLOCK,
key: global.config.api.authKey,
msg: invalidBlockProto,
exInt: 1
});
request.post({url: global.config.general.shareHost, body: wsData}, function (error, response, body) {
console.log(error);
console.log(JSON.stringify(response));
console.log(JSON.stringify(body));
});
});
19 changes: 19 additions & 0 deletions debug_scripts/block_locker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"use strict";
let mysql = require("promise-mysql");
let fs = require("fs");
let argv = require('minimist')(process.argv.slice(2));
let config = fs.readFileSync("../config.json");
let coinConfig = fs.readFileSync("../coinConfig.json");
let protobuf = require('protocol-buffers');

global.support = require("../lib/support.js")();
global.config = JSON.parse(config);
global.mysql = mysql.createPool(global.config.mysql);
global.protos = protobuf(fs.readFileSync('../lib/data.proto'));
let comms;
comms = require('../lib/local_comms');
global.database = new comms();
global.database.initEnv();
global.database.lockBlock(argv.blockID);
console.log("Block "+argv.blockID+" re-locked! Exiting!");
process.exit();
Loading

0 comments on commit cacaf9c

Please sign in to comment.