Pages:
Author

Topic: [OFFLINE]P2Pmining.com-Hybrid P2Pool-NO FEE!!!-BTC/NMC/IXC/I0C/DEV/LTC - page 2. (Read 56628 times)

sr. member
Activity: 409
Merit: 251
Crypt'n Since 2011
You need to set the id column in you database table to auto increment.
legendary
Activity: 1140
Merit: 1000
The Real Jude Austin
Delete

dbf_user = request.getUser()
dbuser_items = dbf_user.split('+')


Replace

pdb_c.execute("""INSERT INTO lminer_data (id,address,hashrate,timestamp,difficulty,ontime) VALUES (NULL, %s , %s , UNIX_TIMESTAMP() , %s, %s)""", (dbuser_items[0], db_diff * on_time, db_diff , on_time ) )

With

pdb_c.execute("""INSERT INTO lminer_data (id,address,hashrate,timestamp,difficulty,ontime) VALUES (NULL, %s , %s , UNIX_TIMESTAMP() , %s, %s)""", (user, db_diff * on_time, db_diff , on_time ) )

Good Luck!



Did this.

I had to add the columns difficulty and ontime to my table.

Once I did this I now get the error saying that id can't be NULL.
sr. member
Activity: 409
Merit: 251
Crypt'n Since 2011
Delete

dbf_user = request.getUser()
dbuser_items = dbf_user.split('+')


Replace

pdb_c.execute("""INSERT INTO lminer_data (id,address,hashrate,timestamp,difficulty,ontime) VALUES (NULL, %s , %s , UNIX_TIMESTAMP() , %s, %s)""", (dbuser_items[0], db_diff * on_time, db_diff , on_time ) )

With

pdb_c.execute("""INSERT INTO lminer_data (id,address,hashrate,timestamp,difficulty,ontime) VALUES (NULL, %s , %s , UNIX_TIMESTAMP() , %s, %s)""", (user, db_diff * on_time, db_diff , on_time ) )

Good Luck!

legendary
Activity: 1140
Merit: 1000
The Real Jude Austin
I'll check on that error, must be a change to the newer version of p2pool. I'll post a fix soon.

Thank you!
sr. member
Activity: 409
Merit: 251
Crypt'n Since 2011
I'll check on that error, must be a change to the newer version of p2pool. I'll post a fix soon.
legendary
Activity: 1140
Merit: 1000
The Real Jude Austin
to modify the p2pool code to run a litecoin pool with p2pool mining

add the following after line 420 received_header_hashes.add(header_hash) in work.py  

Code:
              try:
                    dbf_user = request.getUser()
                    dbuser_items = dbf_user.split('+')
                    db_diff = bitcoin_data.target_to_difficulty(target) * 1000000000
                    proxy_db = MySQLdb.connect(host="localhost",user="jason",passwd="p2pool2012",db="p2pmining")
                    pdb_c = proxy_db.cursor()
                    pdb_c.execute("""INSERT INTO lminer_data (id,address,hashrate,timestamp,difficulty,ontime) VALUES (NULL, %s , %s , UNIX_TIMESTAMP() , %s, %s)""", (dbuser_items[0], db_diff * on_time, db_diff , on_time ) )
                    proxy_db.close()
                except:
                    log.err(None, 'Error with database:')
                ###


 Indent (spaces) the code to line up with line 420
Change the database info to match your database. As you can see, you will need a table called lminer_data.

Also make sure you add import MySQLdb somewhere at the beginning of the work.py file with the other imports and also make sure you have python mysql support installed. No changes to the main.py required.


I did this and now I get this in the P2Pool console:

Code:
2013-09-25 08:44:51.865402 > --- ---
2013-09-25 08:44:51.865414 >   File "/root/p2pool/p2pool/work.py", line 423, in got_response
2013-09-25 08:44:51.865426 >     dbf_user = request.getUser()
2013-09-25 08:45:14.890163 > exceptions.NameError: global name 'request' is not defined

sr. member
Activity: 448
Merit: 250
I can't write my own Python, lol.

Post a bounty Smiley

I'd be happy to write a simple logging function for a bit of a tip.
legendary
Activity: 1140
Merit: 1000
The Real Jude Austin
And what about Bitcoin mining?

With my changes, you can have a different logging function for each instance of p2pool that you run, bitcoin, litecoin, terracoin, etc. No specific changes need to be made to the p2pool codebase for each coin.

I can't write my own Python, lol.
sr. member
Activity: 448
Merit: 250
And what about Bitcoin mining?

With my changes, you can have a different logging function for each instance of p2pool that you run, bitcoin, litecoin, terracoin, etc. No specific changes need to be made to the p2pool codebase for each coin.
legendary
Activity: 1140
Merit: 1000
The Real Jude Austin
to modify the p2pool code to run a litecoin pool with p2pool mining

add the following after line 420 received_header_hashes.add(header_hash) in work.py  

Code:
              try:
                    dbf_user = request.getUser()
                    dbuser_items = dbf_user.split('+')
                    db_diff = bitcoin_data.target_to_difficulty(target) * 1000000000
                    proxy_db = MySQLdb.connect(host="localhost",user="jason",passwd="p2pool2012",db="p2pmining")
                    pdb_c = proxy_db.cursor()
                    pdb_c.execute("""INSERT INTO lminer_data (id,address,hashrate,timestamp,difficulty,ontime) VALUES (NULL, %s , %s , UNIX_TIMESTAMP() , %s, %s)""", (dbuser_items[0], db_diff * on_time, db_diff , on_time ) )
                    proxy_db.close()
                except:
                    log.err(None, 'Error with database:')
                ###


 Indent (spaces) the code to line up with line 420
Change the database info to match your database. As you can see, you will need a table called lminer_data.

Also make sure you add import MySQLdb somewhere at the beginning of the work.py file with the other imports and also make sure you have python mysql support installed. No changes to the main.py required.


And what about Bitcoin mining?

sr. member
Activity: 448
Merit: 250
Another option would be to clone from my github repo at https://github.com/daemondazz/p2pool and then write an external python module to perform the logging for you. This is the module that I use to log shares to a Django database:

Code:
## FILE: share_logger.py

import csv, time
from django.core.management import call_command

FALLBACK_FILE = '/tmp/p2pool-shares.csv'


def logger(submitted_hash, submitted_diff, found_block, found_share, miner_username, miner_rate, debug=False):
    args = (time.time(), submitted_hash, submitted_diff, found_block, found_share, miner_username, int(miner_rate))
    try:
        call_command('pool_logshare', *args)
    except:
        if debug:
            raise
        fh = csv.writer(open(FALLBACK_FILE, 'ab'))
        fh.writerow(args)
        print 'Share Logger: WARNING: Wrote share submission to %s' % FALLBACK_FILE

This can then be utilised by passing in the --share-logging-function argument to p2pool:

/usr/bin/python /var/lib/p2pool/p2pool/run_p2pool.py [otheroptions] --share-logging-function share_logger.logger

I have submitted the changes in my repo back to forrestv for inclusion upstream.
sr. member
Activity: 409
Merit: 251
Crypt'n Since 2011
to modify the p2pool code to run a litecoin pool with p2pool mining

add the following after line 420 received_header_hashes.add(header_hash) in work.py  

Code:
              try:
                    dbf_user = request.getUser()
                    dbuser_items = dbf_user.split('+')
                    db_diff = bitcoin_data.target_to_difficulty(target) * 1000000000
                    proxy_db = MySQLdb.connect(host="localhost",user="jason",passwd="p2pool2012",db="p2pmining")
                    pdb_c = proxy_db.cursor()
                    pdb_c.execute("""INSERT INTO lminer_data (id,address,hashrate,timestamp,difficulty,ontime) VALUES (NULL, %s , %s , UNIX_TIMESTAMP() , %s, %s)""", (dbuser_items[0], db_diff * on_time, db_diff , on_time ) )
                    proxy_db.close()
                except:
                    log.err(None, 'Error with database:')
                ###


 Indent (spaces) the code to line up with line 420
Change the database info to match your database. As you can see, you will need a table called lminer_data.

Also make sure you add import MySQLdb somewhere at the beginning of the work.py file with the other imports and also make sure you have python mysql support installed. No changes to the main.py required.
legendary
Activity: 1140
Merit: 1000
The Real Jude Austin
Does anyone have the modified main.py for this to work?

I am not a Python expert, at all.

I have a modified work.py but when I run run_p2pool.py I get this error:

Code:
2013-09-25 02:56:48.747774 >   File "/root/p2pool/p2pool/main.py", line 213, in main
2013-09-25 02:56:48.747785 >     wb = work.WorkerBridge(node, my_pubkey_hash, args.donation_percentage, merged_urls, args.worker_fee)
2013-09-25 02:56:48.747799 > exceptions.TypeError: __init__() takes exactly 17 arguments (6 given)

I know this is in relation to my work.py file which can be seen here:
http://pastebin.com/ab5JgmMw

Here is the default main.py:
https://github.com/forrestv/p2pool/blob/master/p2pool/main.py

Am I supposed to replace the entire line 213 on main.py with starting at line 17 through 49 from work.py?

I don't quite understand how to implement it.

Any help would be greatly appreciated.
full member
Activity: 208
Merit: 100
sr. member
Activity: 448
Merit: 250
Should be pretty close, although I'm still testing and haven't tested very thoroughly yet:

Code:
CREATE TABLE `devcoin_blocks` (
  `id` int(11) NOT NULL,
  `txid` varchar(64) DEFAULT NULL,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` varchar(16) DEFAULT NULL,
  `amount` decimal(16,8) DEFAULT NULL,
  `confirmations` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `devcoin_payouts` (
  `id` int(11) NOT NULL,
  `address` varchar(48) DEFAULT NULL,
  `amount` decimal(16,8) DEFAULT NULL,
  `txid` varchar(64) DEFAULT NULL,
  `paid` varchar(48) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `devcoin_reg` (
  `BTC_address` varchar(48) NOT NULL,
  `NMC_address` varchar(48) DEFAULT NULL,
  PRIMARY KEY (`BTC_address`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `i0coin_blocks` (
  `id` int(11) NOT NULL,
  `txid` varchar(64) DEFAULT NULL,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` varchar(16) DEFAULT NULL,
  `amount` decimal(16,8) DEFAULT NULL,
  `confirmations` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `i0coin_payouts` (
  `id` int(11) NOT NULL,
  `address` varchar(48) DEFAULT NULL,
  `amount` decimal(16,8) DEFAULT NULL,
  `txid` varchar(64) DEFAULT NULL,
  `paid` varchar(48) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `i0coin_reg` (
  `BTC_address` varchar(48) NOT NULL,
  `NMC_address` varchar(48) DEFAULT NULL,
  PRIMARY KEY (`BTC_address`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `ixcoin_blocks` (
  `id` int(11) NOT NULL,
  `txid` varchar(64) DEFAULT NULL,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` varchar(16) DEFAULT NULL,
  `amount` decimal(16,8) DEFAULT NULL,
  `confirmations` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `ixcoin_payouts` (
  `id` int(11) NOT NULL,
  `address` varchar(48) DEFAULT NULL,
  `amount` decimal(16,8) DEFAULT NULL,
  `txid` varchar(64) DEFAULT NULL,
  `paid` varchar(48) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `ixcoin_reg` (
  `BTC_address` varchar(48) NOT NULL,
  `NMC_address` varchar(48) DEFAULT NULL,
  PRIMARY KEY (`BTC_address`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `lminer_hist` (
  `id` int(11) NOT NULL,
  `address` varchar(48) DEFAULT NULL,
  `hashrate` bigint(20) DEFAULT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `lpayouts` (
  `id` int(11) DEFAULT NULL,
  `address` varchar(48) DEFAULT NULL,
  `amount` decimal(16,8) DEFAULT NULL,
  `txid` varchar(64) DEFAULT NULL,
  `paddress` varchar(48) DEFAULT NULL,
  `paid` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `lpool_blocks` (
  `id` int(11) NOT NULL,
  `txid` varchar(64) DEFAULT NULL,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` varchar(16) DEFAULT NULL,
  `amount` decimal(16,8) DEFAULT NULL,
  `confirmations` int(11) DEFAULT NULL,
  `blk_num` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `lpool_data` (
  `id` int(11) NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `hashrate` bigint(20) DEFAULT NULL,
  `shares` int(11) DEFAULT NULL,
  `stale_doa` int(11) DEFAULT NULL,
  `stale_orphan` int(11) DEFAULT NULL,
  `p2pool_hashrate` bigint(20) DEFAULT NULL,
  `p2pool_stale_rate` int(11) DEFAULT NULL,
  `block_value` decimal(16,8) DEFAULT NULL,
  `peers_out` int(11) DEFAULT NULL,
  `peers_in` int(11) DEFAULT NULL,
  `current_payout` decimal(16,8) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `miner_data` (
  `id` int(11) NOT NULL,
  `address` varchar(48) DEFAULT NULL,
  `hashrate` bigint(20) DEFAULT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `miner_hist` (
  `id` int(11) NOT NULL,
  `address` varchar(48) DEFAULT NULL,
  `hashrate` bigint(20) DEFAULT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `namecoin_blocks` (
  `id` int(11) NOT NULL,
  `txid` varchar(64) DEFAULT NULL,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` varchar(16) DEFAULT NULL,
  `amount` decimal(16,8) DEFAULT NULL,
  `confirmations` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `namecoin_payouts` (
  `id` int(11) NOT NULL,
  `address` varchar(48) DEFAULT NULL,
  `amount` decimal(16,8) DEFAULT NULL,
  `txid` varchar(64) DEFAULT NULL,
  `paid` varchar(48) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `namecoin_reg` (
  `BTC_address` varchar(48) NOT NULL,
  `NMC_address` varchar(48) DEFAULT NULL,
  PRIMARY KEY (`BTC_address`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `pay_address` (
  `address` varchar(48) NOT NULL,
  `paddress` varchar(48) DEFAULT NULL,
  PRIMARY KEY (`address`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `payouts` (
  `id` int(11) DEFAULT NULL,
  `address` varchar(48) DEFAULT NULL,
  `amount` decimal(16,8) DEFAULT NULL,
  `txid` varchar(64) DEFAULT NULL,
  `paddress` varchar(48) DEFAULT NULL,
  `paid` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `pool_blocks` (
  `id` int(11) NOT NULL,
  `txid` varchar(64) DEFAULT NULL,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` varchar(16) DEFAULT NULL,
  `amount` decimal(16,8) DEFAULT NULL,
  `confirmations` int(11) DEFAULT NULL,
  `blk_num` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `pool_data` (
  `id` int(11) NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `hashrate` bigint(20) DEFAULT NULL,
  `shares` int(11) DEFAULT NULL,
  `stale_doa` int(11) DEFAULT NULL,
  `stale_orphan` int(11) DEFAULT NULL,
  `p2pool_hashrate` bigint(20) DEFAULT NULL,
  `p2pool_stale_rate` int(11) DEFAULT NULL,
  `block_value` decimal(16,8) DEFAULT NULL,
  `peers_out` int(11) DEFAULT NULL,
  `peers_in` int(11) DEFAULT NULL,
  `current_payout` decimal(16,8) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `signtime` (
  `address` varchar(48) NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`address`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
legendary
Activity: 924
Merit: 1000
Think. Positive. Thoughts.
Has anyone built the database from the code? I'd happily pay a small bounty for it. Smiley
sr. member
Activity: 448
Merit: 250
Thanks for proving me wrong Smiley
full member
Activity: 208
Merit: 100
Link to code http://serason.com/p2pmining.zip

You will need to build the database by inspecting the code. Shouldn't be too hard. Haven't updated p2pool code edits since stratum was implemented.

Enjoy

thx.
sr. member
Activity: 409
Merit: 251
Crypt'n Since 2011
Link to code http://serason.com/p2pmining.zip

You will need to build the database by inspecting the code. Shouldn't be too hard. Haven't updated p2pool code edits since stratum was implemented.

Enjoy
sr. member
Activity: 448
Merit: 250
I replied via PM to him back on the 5th May and not received anything yet. Don't hold your breath.
Pages:
Jump to: