Skip to content

Instantly share code, notes, and snippets.

View svasva's full-sized avatar

Vitaly A. Sorokin svasva

View GitHub Profile
{
# network ports
"listen" : [
# HTTP JSON-RPC protocol, port 8337
{ "port" : 9012, "protocol" : "http-json" }
],
# database settings
"database" : {
"engine" : "mysql",
Thu Aug 29 2013 11:51:54 GMT+0000 (UTC):audit:BTC:tadzio@tlen.pl client balance 4.97935707
Thu Aug 29 2013 11:51:54 GMT+0000 (UTC):audit:BTC:tadzio@tlen.pl traded balance -5.068823673393284
Thu Aug 29 2013 11:51:54 GMT+0000 (UTC):audit:BTC:tadzio@tlen.pl held balance 0
Thu Aug 29 2013 11:51:54 GMT+0000 (UTC):audit:BTC:tadzio@tlen.pl mining balance 0
Thu Aug 29 2013 11:51:54 GMT+0000 (UTC):audit:BTC:tadzio@tlen.pl total balance -0.0894666033932845
[
{
"account" : "a.eslampanah@live.com",
"address" : "ZMyxhNLXmxnEiyMTyoELQEY7P1jHgWf3PU",
"category" : "receive",
"amount" : 1281.32206876,
"confirmations" : 14329,
"blockhash" : "00000000000c37871fc77d981fe78641140141fcae87e9d9f6c6cdea39c24fbe",
"blockindex" : 1,
"blocktime" : 1377478004,
Wed Aug 28 2013 19:48:07 GMT+0000 (UTC):audit:ZET:longhorn client balance -8589.02767036
Wed Aug 28 2013 19:48:07 GMT+0000 (UTC):audit:ZET:longhorn traded balance -9159.136807339999
Wed Aug 28 2013 19:48:07 GMT+0000 (UTC):audit:ZET:longhorn held balance 0
Wed Aug 28 2013 19:48:07 GMT+0000 (UTC):audit:ZET:longhorn mining balance 19133.41377499002
Processing ZET mining took 0.824 seconds
Processing BOC mining took 1.387 seconds
Wed Aug 28 2013 14:36:44 GMT+0000 (UTC):audit: mike@space-sci.de client balance 1137521.8939538398
Wed Aug 28 2013 14:36:44 GMT+0000 (UTC):audit: mike@space-sci.de traded balance 8.516106394854221
** Smart Collections charged with MongoDB Oplog **
LISTENING
Meteor.startup ->
Meteor.publish 'hashrates', ->
return unless @userId
Hashrates.find({userId: @userId})
Meteor.publish 'top_hrates', (currId) ->
sel = { wrkName: '__total__', hashrate: {$gt: 0} }
sel.currId = currId if currId
opt =
sort: { hashrate: -1 }
Meteor.processCurrs = ->
Currencies.find().forEach (curr) ->
console.log "Processing", curr.name
Meteor.setTimeout -> curr.client().processTransactions()
Meteor.setInterval Meteor.processCurrs, 30*1000
@Workers.fetchHashrates = (curr) ->
Meteor._mining.getWorkerHashrates curr.miningTable, curr.hashrateInterval, curr.shareDiff, (hRates) ->
console.log curr.name, hRates
setHashrate = (userId, name, wrkName, hashrate) ->
sel =
userId: userId
wrkName: wrkName
currId: curr._id
if id = Hashrates.findOne(sel, {fields: {_id: 1}})?._id
Mysql = Npm.require 'mysql'
Future = Npm.require 'fibers/future'
class Mining
constructor: (host, port, dbname, dbuser, dbpass) ->
@dbSettings =
host: host
port: port
user: dbuser
password: dbpass
setHrates = function (curr) {
console.log(curr.name, hRates);
setHashrate = function(userId, name, wrkName, hashrate) {
var id, sel, _ref;
sel = {
userId: userId,
wrkName: wrkName,
currId: curr._id
};
if (id = (_ref = Hashrates.findOne(sel, {